Skip to content
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

fix(node): Ensure isolation scope is correctly cloned for non-recording spans #11503

Merged
merged 4 commits into from
Apr 9, 2024

Conversation

Lms24
Copy link
Member

@Lms24 Lms24 commented Apr 9, 2024

Noticed that our Http instrumentation doesn't clone the isolation scope correctly when the request span is not recording.
The reason is that we early returned if the span was not a server kind span. However, non-recording spans apparently have no span kind, so we wrongfully early returned in the check for non-recording spans.

This probably led to pollution of the default isolation scope. Added tests to demonstrate the fixed behaviour.

@Lms24 Lms24 force-pushed the lms/fix-node-isolationscope-non-recording-spans branch from 0072aa9 to 4478007 Compare April 9, 2024 10:00
Copy link
Contributor

github-actions bot commented Apr 9, 2024

size-limit report 📦

Path Size
@sentry/browser 22.1 KB (0%)
@sentry/browser (incl. Tracing) 31.71 KB (0%)
@sentry/browser (incl. Tracing, Replay) 66.92 KB (0%)
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 60.52 KB (0%)
@sentry/browser (incl. Tracing, Replay with Canvas) 70.75 KB (0%)
@sentry/browser (incl. Tracing, Replay, Feedback) 75.67 KB (0%)
@sentry/browser (incl. Feedback) 30.87 KB (0%)
@sentry/browser (incl. Feedback, Feedback Modal) 30.88 KB (0%)
@sentry/browser (incl. Feedback, Feedback Modal, Feedback Screenshot) 30.89 KB (0%)
@sentry/browser (incl. sendFeedback) 26.88 KB (0%)
@sentry/react 24.78 KB (0%)
@sentry/react (incl. Tracing) 34.61 KB (0%)
@sentry/vue 25.53 KB (0%)
@sentry/vue (incl. Tracing) 33.44 KB (0%)
@sentry/svelte 22.23 KB (0%)
CDN Bundle 24.11 KB (0%)
CDN Bundle (incl. Tracing) 32.66 KB (0%)
CDN Bundle (incl. Tracing, Replay) 66.37 KB (0%)
CDN Bundle (incl. Tracing, Replay, Feedback) 71.63 KB (0%)
CDN Bundle - uncompressed 71.67 KB (0%)
CDN Bundle (incl. Tracing) - uncompressed 97.71 KB (0%)
CDN Bundle (incl. Tracing, Replay) - uncompressed 207.1 KB (0%)
@sentry/nextjs (client) 33.8 KB (0%)
@sentry/sveltekit (client) 32.24 KB (0%)
@sentry/node 120.01 KB (+0.06% 🔺)

@@ -19,6 +20,10 @@ const _expressIntegration = (() => {
addOriginToSpan(span, 'auto.http.otel.express');
},
spanNameHook(info, defaultName) {
if (getIsolationScope() === getDefaultIsolationScope()) {
logger.warn('Isolation scope is still default isolation scope - skipping setting transactionName');
Copy link
Member

Choose a reason for hiding this comment

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

l: should we add DEBUG_BUILD && here?

Copy link
Member

@mydea mydea left a comment

Choose a reason for hiding this comment

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

very nice catch! That's actually a huge fix, great find!

@Lms24 Lms24 enabled auto-merge (squash) April 9, 2024 12:18
@Lms24 Lms24 merged commit 76a2869 into develop Apr 9, 2024
78 checks passed
@Lms24 Lms24 deleted the lms/fix-node-isolationscope-non-recording-spans branch April 9, 2024 13:23
cadesalaberry pushed a commit to cadesalaberry/sentry-javascript that referenced this pull request Apr 19, 2024
…ng spans (getsentry#11503)

Our Http instrumentation didn't clone the isolation scope
correctly when the request span is not recording.
We early returned if the span was not a server kind
span. However, non-recording spans apparently have no span kind, so we
wrongfully early returned in the check for non-recording spans.
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.

2 participants