Skip to content

Commit 49be37c

Browse files
authored
docs(js): Update tracing docs for react-router framework (#13817)
closes getsentry/sentry-javascript#16363
1 parent 725460a commit 49be37c

File tree

1 file changed

+25
-7
lines changed

1 file changed

+25
-7
lines changed
Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,39 @@
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}
26
import * as Sentry from "@sentry/react-router";
37

48
Sentry.init({
59
dsn: "___PUBLIC_DSN___",
610

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
1212
integrations: [Sentry.reactRouterTracingIntegration()],
1313

1414
// We recommend adjusting this value in production, or using tracesSampler
1515
// for finer control
1616
tracesSampleRate: 1.0,
17-
17+
1818
// Set `tracePropagationTargets` to control for which URLs trace propagation should be enabled
1919
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
2038
});
2139
```

0 commit comments

Comments
 (0)