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: Make startSpan, startSpanManual and startInactiveSpan pick up the scopes at time of creation instead of termination #10492

Merged
merged 3 commits into from
Feb 5, 2024

Conversation

lforst
Copy link
Member

@lforst lforst commented Feb 5, 2024

Makes spans/transactions created with startSpan, startSpanManual and startInactiveSpan use data from the scopes that were active at the time these functions were called instead of using the scopes that are active when the span was .end()ed.

We already do this in the otel compatible SDK and we deem this behaviour more intuitive than using the scopes on span finish.

@lforst lforst requested a review from mydea February 5, 2024 11:45
Copy link
Contributor

github-actions bot commented Feb 5, 2024

size-limit report 📦

Path Size
@sentry/browser (incl. Tracing, Replay, Feedback) - Webpack (gzipped) 78.33 KB (+0.17% 🔺)
@sentry/browser (incl. Tracing, Replay) - Webpack (gzipped) 69.57 KB (+0.2% 🔺)
@sentry/browser (incl. Tracing, Replay with Canvas) - Webpack (gzipped) 73.5 KB (+0.19% 🔺)
@sentry/browser (incl. Tracing, Replay) - Webpack with treeshaking flags (gzipped) 63.18 KB (+0.22% 🔺)
@sentry/browser (incl. Tracing) - Webpack (gzipped) 33.52 KB (+0.41% 🔺)
@sentry/browser (incl. browserTracingIntegration) - Webpack (gzipped) 33.39 KB (+0.41% 🔺)
@sentry/browser (incl. Feedback) - Webpack (gzipped) 31.37 KB (+0.11% 🔺)
@sentry/browser (incl. sendFeedback) - Webpack (gzipped) 31.37 KB (+0.1% 🔺)
@sentry/browser - Webpack (gzipped) 22.64 KB (+0.17% 🔺)
@sentry/browser (incl. Tracing, Replay, Feedback) - ES6 CDN Bundle (gzipped) 76.36 KB (+0.25% 🔺)
@sentry/browser (incl. Tracing, Replay) - ES6 CDN Bundle (gzipped) 67.89 KB (+0.25% 🔺)
@sentry/browser (incl. Tracing) - ES6 CDN Bundle (gzipped) 33.66 KB (+0.5% 🔺)
@sentry/browser - ES6 CDN Bundle (gzipped) 24.73 KB (+0.3% 🔺)
@sentry/browser (incl. Tracing, Replay) - ES6 CDN Bundle (minified & uncompressed) 214.06 KB (+0.18% 🔺)
@sentry/browser (incl. Tracing) - ES6 CDN Bundle (minified & uncompressed) 101.87 KB (+0.38% 🔺)
@sentry/browser - ES6 CDN Bundle (minified & uncompressed) 74.25 KB (+0.34% 🔺)
@sentry/browser (incl. Tracing) - ES5 CDN Bundle (gzipped) 36.8 KB (+0.47% 🔺)
@sentry/react (incl. Tracing, Replay) - Webpack (gzipped) 69.93 KB (+0.2% 🔺)
@sentry/react - Webpack (gzipped) 22.67 KB (+0.17% 🔺)
@sentry/nextjs Client (incl. Tracing, Replay) - Webpack (gzipped) 87.55 KB (+0.15% 🔺)
@sentry/nextjs Client - Webpack (gzipped) 51.72 KB (+0.3% 🔺)
@sentry-internal/feedback - Webpack (gzipped) 17.21 KB (0%)

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.

looks good to me! When we actually do v8 we should align using either weak maps or non-enumerable properties for all the stuff we have to relate to spans, but this is purely internal and I have no strong feelings on this either way. We can think about this some more..!

@lforst
Copy link
Member Author

lforst commented Feb 5, 2024

looks good to me! When we actually do v8 we should align using either weak maps or non-enumerable properties for all the stuff we have to relate to spans, but this is purely internal and I have no strong feelings on this either way. We can think about this some more..!

Agreed. I think I like non-enumerables a bit more because you can rely on them working across package boundaries without having to rely on getters-setters, meaning they won't widen the API surface in any way.

@lforst lforst merged commit 99d1114 into develop Feb 5, 2024
122 checks passed
@lforst lforst deleted the lforst-span-take-scope-from-start branch February 5, 2024 13:25
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.

None yet

2 participants