Skip to content

docs(js): Update tracing docs for react-router framework #13817

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 28, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,21 +1,36 @@
```javascript
To enable automatic tracing you need to update the configuration of your client and server instrumentation:
- For client-side tracing, include the `reactRouterTracingIntegration` to your integrations array.
- Additionally you need to set the `tracesSampleRate` in your `Sentry.init()` calls.

```javascript {tabTitle:Client} {filename:entry.client.tsx} {7,11}
import * as Sentry from "@sentry/react-router";

Sentry.init({
dsn: "___PUBLIC_DSN___",

// This enables automatic instrumentation (highly recommended),
// but is not necessary for purely manual usage
// If you only want to use custom instrumentation:
// * Remove the `reactRouterTracingIntegration` integration
// * add `Sentry.addTracingExtensions()` above your Sentry.init() call
// This enables automatic instrumentation for client-side navigations
integrations: [Sentry.reactRouterTracingIntegration()],

// We recommend adjusting this value in production, or using tracesSampler
// for finer control
tracesSampleRate: 1.0,

// Set `tracePropagationTargets` to control for which URLs trace propagation should be enabled
tracePropagationTargets: ["localhost", /^https:\/\/yourserver\.io\/api/],
// ... rest of your config
});

// ... rest of the file
```

```javascript {tabTitle:Server} {filename:instrument.server.(mjs|ts)} {8}
import * as Sentry from "@sentry/react-router";

Sentry.init({
dsn: "___PUBLIC_DSN___",

// We recommend adjusting this value in production, or using tracesSampler
// for finer control
tracesSampleRate: 1.0,

// ... rest of your config
});
```