Skip to content

Commit 7438608

Browse files
authored
feat(nextjs): Improve server component data (#15996)
1 parent a3d0224 commit 7438608

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

dev-packages/e2e-tests/test-applications/nextjs-app-dir/tests/server-components.test.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,10 @@ test('Should set a "not_found" status on a server component span when notFound()
7979
description: 'Page Server Component (/server-component/not-found)',
8080
op: 'function.nextjs',
8181
status: 'not_found',
82+
data: expect.objectContaining({
83+
'sentry.nextjs.function.type': 'Page',
84+
'sentry.nextjs.function.route': '/server-component/not-found',
85+
}),
8286
}),
8387
);
8488
});
@@ -107,6 +111,10 @@ test('Should capture an error and transaction for a app router page', async ({ p
107111
description: 'Page Server Component (/server-component/faulty)',
108112
op: 'function.nextjs',
109113
status: 'internal_error',
114+
data: expect.objectContaining({
115+
'sentry.nextjs.function.type': 'Page',
116+
'sentry.nextjs.function.route': '/server-component/faulty',
117+
}),
110118
}),
111119
);
112120

packages/nextjs/src/common/wrapServerComponentWithSentry.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ export function wrapServerComponentWithSentry<F extends (...args: any[]) => any>
8989
attributes: {
9090
[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'component',
9191
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.nextjs',
92+
'sentry.nextjs.function.type': componentType,
93+
'sentry.nextjs.function.route': componentRoute,
9294
},
9395
},
9496
span => {

0 commit comments

Comments
 (0)