Skip to content

Commit 8ba5f24

Browse files
chargomeantonpirker
authored andcommitted
docs(js): Add note for distributed tracing in Next.js 14 App router (#13858)
1 parent 5572ce5 commit 8ba5f24

File tree

5 files changed

+23
-11
lines changed

5 files changed

+23
-11
lines changed

docs/platforms/javascript/common/tracing/distributed-tracing/index.mdx

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,6 @@ If you run any JavaScript applications in your distributed system, make sure tha
2727

2828
</Alert>
2929

30-
<PlatformSection supported={["javascript.nextjs"]}>
31-
32-
<Alert>
33-
34-
Pageload to SSR tracing is currently not supported on the App Router with Next.js versions up to and including 14.
35-
36-
</Alert>
37-
38-
</PlatformSection>
39-
4030
## How to Use Distributed Tracing?
4131

4232
<PlatformContent includePath="distributed-tracing/how-to-use/" />

docs/platforms/javascript/guides/nextjs/manual-setup.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ export default withSentryConfig(nextConfig, {
8585
});
8686
```
8787

88+
<Include name="nextjs-app-router-14-config" />
89+
8890
### Initialize Sentry Client-Side and Server-Side SDKs
8991

9092
Create three files in your application's root directory:
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<Expandable title="Additional Configuration for App Router on Next.js 14" level="warning">
2+
In order to enable distributed tracing for App Router on Next.js 14 you need to add or modify the `generateMetadata` function of your root layout:
3+
```typescript {filename:app/layout.tsx}
4+
import * as Sentry from '@sentry/nextjs';
5+
import type { Metadata } from 'next';
6+
7+
export function generateMetadata(): Metadata {
8+
return {
9+
// ... your existing metadata
10+
other: {
11+
...Sentry.getTraceData(),
12+
}
13+
}
14+
};
15+
```
16+
</Expandable>

platform-includes/distributed-tracing/how-to-use/javascript.nextjs.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
If you're using the current version of our Next.js SDK, distributed tracing will work out of the box for the client, server, and edge runtimes.
22

3+
<Include name="nextjs-app-router-14-config" />
4+
35
For client-side, when you are interacting with other external API systems, you might have to define `tracePropagationTargets` to get around possible [Browser CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) issues.
46

57
<Alert>

platform-includes/performance/configure-sample-rate/javascript.nextjs.mdx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,6 @@ Sentry.init({
4242
tracesSampleRate: 1.0,
4343
// ... rest of your config
4444
});
45-
```
45+
```
46+
47+
<Include name="nextjs-app-router-14-config" />

0 commit comments

Comments
 (0)