Skip to content

Commit

Permalink
feat(nextjs): Drop BaseServer.handleRequest without route (#13957)
Browse files Browse the repository at this point in the history
We can assume that `BaseServer.handleRequest` without route is always
low-quality data so we can drop it.
  • Loading branch information
lforst authored Oct 14, 2024
1 parent f24fc68 commit 88656c2
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/nextjs/src/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,12 @@ export function init(options: NodeOptions): NodeClient | undefined {
if (typeof method === 'string' && typeof route === 'string') {
event.transaction = `${method} ${route.replace(/\/route$/, '')}`;
event.contexts.trace.data[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE] = 'route';
} else {
// If we cannot hoist the route (or rather parameterize the transaction) for BaseServer.handleRequest spans,
// we drop it because the chance that it is a low-quality transaction we don't want is pretty high.
// This is important in the case of edge-runtime where Next.js will also create unnecessary Node.js root
// spans, that are not parameterized.
return null;
}
}

Expand Down

0 comments on commit 88656c2

Please sign in to comment.