Skip to content

Commit 0994d0e

Browse files
author
Luca Forstner
committed
Drop bad Node.js Next.js spans without parameterization
1 parent 793a4b5 commit 0994d0e

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

packages/nextjs/src/server/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,10 @@ export function init(options: NodeOptions): NodeClient | undefined {
307307
if (typeof method === 'string' && typeof route === 'string') {
308308
event.transaction = `${method} ${route.replace(/\/route$/, '')}`;
309309
event.contexts.trace.data[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE] = 'route';
310+
} else {
311+
// If we cannot hoist the route (or rather parameterize the transaction) for BaseServer.handleRequest spans, we drop it.
312+
// This is important in the case of edge-runtime where Next.js will also create unnecessary Node.js root spans, that are not parameterized.
313+
return null;
310314
}
311315
}
312316

0 commit comments

Comments
 (0)