Skip to content

Commit 88656c2

Browse files
author
Luca Forstner
authored
feat(nextjs): Drop BaseServer.handleRequest without route (#13957)
We can assume that `BaseServer.handleRequest` without route is always low-quality data so we can drop it.
1 parent f24fc68 commit 88656c2

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

packages/nextjs/src/server/index.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,12 @@ 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,
312+
// we drop it because the chance that it is a low-quality transaction we don't want is pretty high.
313+
// This is important in the case of edge-runtime where Next.js will also create unnecessary Node.js root
314+
// spans, that are not parameterized.
315+
return null;
310316
}
311317
}
312318

0 commit comments

Comments
 (0)