Skip to content

feat(node): Drop http.server spans with 404 status by default #16205

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 7, 2025

Conversation

mydea
Copy link
Member

@mydea mydea commented May 6, 2025

This can be configured like this:

httpIntegration({
  dropSpansForIncomingRequestStatusCodes: [404, [300,399]]
})

It defaults to [404].

Closes #16193

@mydea mydea self-assigned this May 6, 2025
Copy link
Contributor

github-actions bot commented May 6, 2025

size-limit report 📦

Path Size % Change Change
@sentry/browser 23.34 KB - -
@sentry/browser - with treeshaking flags 23.16 KB - -
@sentry/browser (incl. Tracing) 37.22 KB - -
@sentry/browser (incl. Tracing, Replay) 74.45 KB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 68.32 KB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 79.11 KB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 90.93 KB - -
@sentry/browser (incl. Feedback) 39.72 KB - -
@sentry/browser (incl. sendFeedback) 27.96 KB - -
@sentry/browser (incl. FeedbackAsync) 32.72 KB - -
@sentry/react 25.14 KB - -
@sentry/react (incl. Tracing) 39.22 KB - -
@sentry/vue 27.6 KB - -
@sentry/vue (incl. Tracing) 38.99 KB - -
@sentry/svelte 23.36 KB - -
CDN Bundle 24.55 KB - -
CDN Bundle (incl. Tracing) 37.3 KB - -
CDN Bundle (incl. Tracing, Replay) 72.34 KB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 77.62 KB - -
CDN Bundle - uncompressed 71.62 KB - -
CDN Bundle (incl. Tracing) - uncompressed 110.34 KB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 221.63 KB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 234.15 KB - -
@sentry/nextjs (client) 40.83 KB - -
@sentry/sveltekit (client) 37.72 KB - -
@sentry/node 144.41 KB +0.07% +99 B 🔺
@sentry/node - without tracing 96.28 KB +0.1% +92 B 🔺
@sentry/aws-serverless 120.65 KB +0.08% +89 B 🔺

View base workflow run

@mydea mydea marked this pull request as ready for review May 7, 2025 07:29
@mydea mydea requested review from lforst and andreiborza May 7, 2025 07:29
This can be configured via `dropSpansForIncomingRequestStatusCodes` option in `httpIntegration()`.
transport: loggingTransport,
integrations: [
Sentry.httpIntegration({
dropSpansForIncomingRequestStatusCodes: [499, /3\d{2}/],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The regex is an interesting API choice. I can kindof see the reason, just wanna suggest other options that might be a bit more intuitive to write and don't require googling what the regex for numbers is, like:

  • Providing intervals to drop for ranges like [from, to] e.g. [400, 499].
  • Providing strings with x as a wildcard e.g. "4xx"

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, I know what you mean. The drop ranges seem fine to me too, I'll adjust it to that instead!

@@ -125,20 +125,3 @@ test('Should send a transaction event with correct status for a generateMetadata

expect((await transactionPromise).contexts?.trace?.status).toBe('ok');
});

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lforst removed this test as this is no longer sent

@mydea mydea merged commit 3a81041 into develop May 7, 2025
135 checks passed
@mydea mydea deleted the fn/404-node branch May 7, 2025 11:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Filter http.server spans with status code 4xx by default
2 participants