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

feat(next): Handle existing root spans for isolation scope #11479

Merged
merged 1 commit into from
Apr 8, 2024

Conversation

mydea
Copy link
Member

@mydea mydea commented Apr 8, 2024

This updates handling of next.js instrumentation to re-use an isolation scope from a root span.

This should ensure we have consistent isolation scopes, no matter if next.js auto creates spans or not.

@mydea mydea requested review from lforst and s1gr1d April 8, 2024 13:47
@mydea mydea self-assigned this Apr 8, 2024
const rootSpan = getRootSpan(activeSpan);

// Verify this is a next span
if (!spanToJSON(rootSpan).data?.['next.route']) {
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 feels like a reasonable starting point here I guess? We should sync this with the (not yet existing) isolation scope integration!

Copy link
Member

Choose a reason for hiding this comment

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

We could also use next.span_name here as this attribute is added to (I think) almost all spans. Look here

Copy link
Contributor

github-actions bot commented Apr 8, 2024

size-limit report 📦

Path Size
@sentry/browser (incl. Tracing, Replay, Feedback) 75.67 KB (+0.04% 🔺)
@sentry/browser (incl. Tracing, Replay) 66.92 KB (+0.08% 🔺)
@sentry/browser (incl. Tracing, Replay with Canvas) 70.75 KB (+0.03% 🔺)
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 60.52 KB (+0.14% 🔺)
@sentry/browser (incl. Tracing) 31.71 KB (-0.14% 🔽)
@sentry/browser (incl. browserTracingIntegration) 0 B (removed)
@sentry/browser (incl. feedbackIntegration) 0 B (removed)
@sentry/browser (incl. feedbackModalIntegration) 0 B (removed)
@sentry/browser (incl. feedbackScreenshotIntegration) 0 B (removed)
@sentry/browser (incl. sendFeedback) 26.88 KB (-0.01% 🔽)
@sentry/browser 22.1 KB (0%)
CDN Bundle (incl. Tracing, Replay, Feedback) 71.63 KB (+0.02% 🔺)
CDN Bundle (incl. Tracing, Replay) 66.37 KB (-0.01% 🔽)
CDN Bundle (incl. Tracing) 32.66 KB (-0.12% 🔽)
CDN Bundle 24.11 KB (-0.11% 🔽)
CDN Bundle (incl. Tracing, Replay) - uncompressed 207.1 KB (+0.06% 🔺)
CDN Bundle (incl. Tracing) - uncompressed 97.71 KB (+0.13% 🔺)
CDN Bundle - uncompressed 71.67 KB (+0.42% 🔺)
@sentry/react (incl. Tracing, Replay) 0 B (removed)
@sentry/react 24.78 KB (+12.01% 🔺)
@sentry/browser (incl. Feedback) 30.87 KB (added)
@sentry/browser (incl. Feedback, Feedback Modal) 30.89 KB (added)
@sentry/browser (incl. Feedback, Feedback Modal, Feedback Screenshot) 30.9 KB (added)
@sentry/react (incl. Tracing) 34.61 KB (added)
@sentry/vue 25.53 KB (added)
@sentry/vue (incl. Tracing) 33.44 KB (added)
@sentry/svelte 22.23 KB (added)
@sentry/nextjs (client) 33.8 KB (added)
@sentry/sveltekit (client) 32.24 KB (added)
@sentry/node 119.95 KB (added)

@mydea mydea merged commit 75d288c into develop Apr 8, 2024
66 checks passed
@mydea mydea deleted the fn/next-isolation-scope branch April 8, 2024 14:02
cadesalaberry pushed a commit to cadesalaberry/sentry-javascript that referenced this pull request Apr 19, 2024
…#11479)

This updates handling of next.js instrumentation to re-use an isolation
scope from a root span.

This should ensure we have consistent isolation scopes, no matter if
next.js auto creates spans or not.
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.

3 participants