Skip to content

fix: Make startSpan, startSpanManual and startInactiveSpan pick up the scopes at time of creation instead of termination - #10492

Merged
lforst merged 3 commits into
developfrom
lforst-span-take-scope-from-start
Feb 5, 2024
Merged

lforst merged 3 commits into
developfrom
lforst-span-take-scope-from-start

Conversation

@lforst

@lforst lforst commented Feb 5, 2024

Copy link
Copy Markdown
Contributor

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.

Luca Forstner added 2 commits February 5, 2024 11:34
@lforst
lforst requested a review from mydea February 5, 2024 11:45
@github-actions

github-actions Bot commented Feb 5, 2024 •

Copy link
Copy Markdown
Contributor

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%)

@mydea mydea left a comment

Copy link
Copy Markdown
Member

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

lforst commented Feb 5, 2024

Copy link
Copy Markdown
Contributor Author

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
@lforst
lforst deleted the lforst-span-take-scope-from-start branch February 5, 2024 13:25
@lforst lforst mentioned this pull request Mar 25, 2024
3 tasks done
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