Skip to content

Commit 79480cf

Browse files
authored
feat(nextjs): Add more attributes for generation functions (#16214)
Necessary for Next.js insights page
1 parent b3242e0 commit 79480cf

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

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

+4-4
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ test('Should set a "not_found" status on a server component span when notFound()
8080
op: 'function.nextjs',
8181
status: 'not_found',
8282
data: expect.objectContaining({
83-
'sentry.nextjs.function.type': 'Page',
84-
'sentry.nextjs.function.route': '/server-component/not-found',
83+
'sentry.nextjs.ssr.function.type': 'Page',
84+
'sentry.nextjs.ssr.function.route': '/server-component/not-found',
8585
}),
8686
}),
8787
);
@@ -112,8 +112,8 @@ test('Should capture an error and transaction for a app router page', async ({ p
112112
op: 'function.nextjs',
113113
status: 'internal_error',
114114
data: expect.objectContaining({
115-
'sentry.nextjs.function.type': 'Page',
116-
'sentry.nextjs.function.route': '/server-component/faulty',
115+
'sentry.nextjs.ssr.function.type': 'Page',
116+
'sentry.nextjs.ssr.function.route': '/server-component/faulty',
117117
}),
118118
}),
119119
);

packages/nextjs/src/common/wrapGenerationFunctionWithSentry.ts

+2
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@ export function wrapGenerationFunctionWithSentry<F extends (...args: any[]) => a
102102
attributes: {
103103
[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route',
104104
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.nextjs',
105+
'sentry.nextjs.ssr.function.type': generationFunctionIdentifier,
106+
'sentry.nextjs.ssr.function.route': componentRoute,
105107
},
106108
},
107109
span => {

packages/nextjs/src/common/wrapServerComponentWithSentry.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -89,8 +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,
92+
'sentry.nextjs.ssr.function.type': componentType,
93+
'sentry.nextjs.ssr.function.route': componentRoute,
9494
},
9595
},
9696
span => {

0 commit comments

Comments
 (0)