|
1 | | -Set `tracesSampleRate` in your config files, `instrumentation-client.js`, `sentry.server.config.js`, and `sentry.edge.config.js`: |
| 1 | +Set `tracesSampleRate` in your config files: |
| 2 | +- `sentry.server.config.js` |
| 3 | +- `sentry.edge.config.js`: |
| 4 | +- `instrumentation-client.js` |
| 5 | + - If you previously had file called `sentry.client.config.(js|ts)`, you can also safely rename this to `instrumentation-client.(js|ts)` for all Next.js versions. |
2 | 6 |
|
3 | | -```javascript |
| 7 | +```javascript {tabTitle:Client} {filename:instrumentation-client.(js|ts)} |
4 | 8 | import * as Sentry from "@sentry/nextjs"; |
5 | 9 |
|
6 | 10 | Sentry.init({ |
7 | 11 | dsn: "___PUBLIC_DSN___", |
| 12 | + // We recommend adjusting this value in production, or using `tracesSampler` |
| 13 | + // for finer control |
| 14 | + tracesSampleRate: 1.0, |
| 15 | + // ... rest of your config |
| 16 | +}); |
| 17 | + |
| 18 | +// This export will instrument router navigations, and is only relevant if you enable tracing. |
| 19 | +// `captureRouterTransitionStart` is available from SDK version 9.12.0 onwards |
| 20 | +export const onRouterTransitionStart = Sentry.captureRouterTransitionStart; |
| 21 | +``` |
| 22 | + |
| 23 | +```javascript {tabTitle:Server} {filename:sentry.server.config.(js|ts)} |
| 24 | +import * as Sentry from "@sentry/nextjs"; |
8 | 25 |
|
| 26 | +Sentry.init({ |
| 27 | + dsn: "___PUBLIC_DSN___", |
9 | 28 | // We recommend adjusting this value in production, or using `tracesSampler` |
10 | 29 | // for finer control |
11 | 30 | tracesSampleRate: 1.0, |
| 31 | + // ... rest of your config |
12 | 32 | }); |
13 | 33 | ``` |
| 34 | + |
| 35 | +```javascript {tabTitle:Edge} {filename:sentry.edge.config.(js|ts)} |
| 36 | +import * as Sentry from "@sentry/nextjs"; |
| 37 | + |
| 38 | +Sentry.init({ |
| 39 | + dsn: "___PUBLIC_DSN___", |
| 40 | + // We recommend adjusting this value in production, or using `tracesSampler` |
| 41 | + // for finer control |
| 42 | + tracesSampleRate: 1.0, |
| 43 | + // ... rest of your config |
| 44 | +}); |
| 45 | +``` |
0 commit comments