Skip to content

feat(node): Update httpIntegration handling of incoming requests #17371

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

Draft
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

mydea
Copy link
Member

@mydea mydea commented Aug 11, 2025

This PR updates the handling of the Node SDK of incoming requests. Instead of relying on @opentelemetry/instrumentation-http for this, we now handle this internally, ensuring that we can optimize performance as much as possible and avoid interop problems. This will also allow us to extract this out of an OTEL instrumentation, eventually paving the way for a non-OTEL SDK with basic tracing capabilities.

This change should not affect users, unless they are relying on very in-depth implementation details. Importantly, this also drops the _experimentalConfig option of the integration - this will no longer do anything.
Finally, you can still pass instrumentation.{requestHook,responseHook,applyCustomAttributesOnSpan} options, but they are deprecated and will be removed in v11. Instead, you can use the new incomingRequestSpanHook configuration option if you want to adjust the incoming request span.

I have tried to ensure the spans look as similar as possible as before, I still may need to tweak a few attributes here or there though, I'll try to make a before and after comparison!

On top of #17373

@mydea mydea self-assigned this Aug 11, 2025
Copy link
Contributor

github-actions bot commented Aug 11, 2025

size-limit report 📦

Path Size % Change Change
@sentry/browser 24.16 kB added added
@sentry/browser - with treeshaking flags 22.73 kB added added
@sentry/browser (incl. Tracing) 39.87 kB added added
@sentry/browser (incl. Tracing, Replay) 77.99 kB added added
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 67.83 kB added added
@sentry/browser (incl. Tracing, Replay with Canvas) 82.69 kB added added
@sentry/browser (incl. Tracing, Replay, Feedback) 94.79 kB added added
@sentry/browser (incl. Feedback) 40.83 kB added added
@sentry/browser (incl. sendFeedback) 28.81 kB added added
@sentry/browser (incl. FeedbackAsync) 33.7 kB added added
@sentry/react 25.88 kB added added
@sentry/react (incl. Tracing) 41.86 kB added added
@sentry/vue 28.64 kB added added
@sentry/vue (incl. Tracing) 41.69 kB added added
@sentry/svelte 24.18 kB added added
CDN Bundle 25.66 kB added added
CDN Bundle (incl. Tracing) 39.76 kB added added
CDN Bundle (incl. Tracing, Replay) 75.82 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback) 81.27 kB added added
CDN Bundle - uncompressed 74.96 kB added added
CDN Bundle (incl. Tracing) - uncompressed 117.59 kB added added
CDN Bundle (incl. Tracing, Replay) - uncompressed 231.88 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 244.48 kB added added
@sentry/nextjs (client) 43.89 kB added added
@sentry/sveltekit (client) 40.32 kB added added
@sentry/node-core 49.27 kB added added
@sentry/node 147.65 kB added added
@sentry/node - without tracing 92.68 kB added added
@sentry/aws-serverless 103.98 kB added added

@mydea mydea force-pushed the fn/ref-otel-incoming-request branch from 8d7f49c to e798a09 Compare August 11, 2025 10:49
Add tests that definitely show:
1. How get and post spans are captured
2. How URLs are handled with params and fragments
@mydea mydea force-pushed the fn/ref-otel-incoming-request branch from e798a09 to 57f8184 Compare August 11, 2025 11:30
@mydea mydea changed the base branch from develop to fn/add-full-attribute-http-span-test August 11, 2025 11:30
const runner = createRunner(__dirname, 'server.js')
.expect({
transaction: {
transaction: 'GET /test/:id/span-updateName-source',
transaction: 'new-name',
Copy link
Member Author

Choose a reason for hiding this comment

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

this is actually... fixed here now? Not quite sure why/how, but apparently some timing stuff is better now?

@mydea mydea force-pushed the fn/ref-otel-incoming-request branch 2 times, most recently from c882fb0 to 356461f Compare August 11, 2025 11:38
@mydea mydea force-pushed the fn/ref-otel-incoming-request branch from 2f90c3c to c120396 Compare August 11, 2025 12:01
mydea added a commit that referenced this pull request Aug 11, 2025
…17373)

Add tests that definitely show:
1. How get and post spans are captured
2. How URLs are handled with params and fragments

This should make
#17371 much easier to
verify.
Base automatically changed from fn/add-full-attribute-http-span-test to develop August 11, 2025 13:00
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.

1 participant