|
1 | | -```javascript |
| 1 | +To enable automatic tracing you need to update the configuration of your client and server instrumentation: |
| 2 | +- For client-side tracing, include the `reactRouterTracingIntegration` to your integrations array. |
| 3 | +- Additionally you need to set the `tracesSampleRate` in your `Sentry.init()` calls. |
| 4 | + |
| 5 | +```javascript {tabTitle:Client} {filename:entry.client.tsx} {7,11} |
2 | 6 | import * as Sentry from "@sentry/react-router"; |
3 | 7 |
|
4 | 8 | Sentry.init({ |
5 | 9 | dsn: "___PUBLIC_DSN___", |
6 | 10 |
|
7 | | - // This enables automatic instrumentation (highly recommended), |
8 | | - // but is not necessary for purely manual usage |
9 | | - // If you only want to use custom instrumentation: |
10 | | - // * Remove the `reactRouterTracingIntegration` integration |
11 | | - // * add `Sentry.addTracingExtensions()` above your Sentry.init() call |
| 11 | + // This enables automatic instrumentation for client-side navigations |
12 | 12 | integrations: [Sentry.reactRouterTracingIntegration()], |
13 | 13 |
|
14 | 14 | // We recommend adjusting this value in production, or using tracesSampler |
15 | 15 | // for finer control |
16 | 16 | tracesSampleRate: 1.0, |
17 | | - |
| 17 | + |
18 | 18 | // Set `tracePropagationTargets` to control for which URLs trace propagation should be enabled |
19 | 19 | tracePropagationTargets: ["localhost", /^https:\/\/yourserver\.io\/api/], |
| 20 | + |
| 21 | + // ... rest of your config |
| 22 | +}); |
| 23 | + |
| 24 | +// ... rest of the file |
| 25 | +``` |
| 26 | + |
| 27 | +```javascript {tabTitle:Server} {filename:instrument.server.(mjs|ts)} {8} |
| 28 | +import * as Sentry from "@sentry/react-router"; |
| 29 | + |
| 30 | +Sentry.init({ |
| 31 | + dsn: "___PUBLIC_DSN___", |
| 32 | + |
| 33 | + // We recommend adjusting this value in production, or using tracesSampler |
| 34 | + // for finer control |
| 35 | + tracesSampleRate: 1.0, |
| 36 | + |
| 37 | + // ... rest of your config |
20 | 38 | }); |
21 | 39 | ``` |
0 commit comments