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(core): Allow to pass scope to startSpan APIs #10076

Merged
merged 1 commit into from Jan 8, 2024
Merged

Conversation

mydea
Copy link
Member

@mydea mydea commented Jan 5, 2024

Also allow to pass this to withScope(), which actually aligns with OTEL as well, where you can also do that. If you pass a scope there, it will use this instead of forking a new one.

This should be the last thing needed to refactor some span.startChild() occurrences - you can now store the scope you want to fork off, and pass this into startSpan as needed.

@mydea mydea self-assigned this Jan 5, 2024

it('forks the scope', () => {
const initialScope = getCurrentScope();
it('creates & finishes span', async () => {
Copy link
Member Author

Choose a reason for hiding this comment

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

just moved these out of the it.each() as they aren't actually using any of it.


/**
* Get the context related to a scope.
* TODO v8: Use this for the `trace` functions.
Copy link
Member Author

Choose a reason for hiding this comment

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

These functions still live in opentelemetry which needs to be aligned for v8. It's not worth it to do that now IMHO, just wanted to show that it is possible to implement this in the new model, which it is!

Copy link
Contributor

github-actions bot commented Jan 5, 2024

size-limit report 📦

Path Size
@sentry/browser (incl. Tracing, Replay, Feedback) - Webpack (gzipped) 76.35 KB (+0.19% 🔺)
@sentry/browser (incl. Tracing, Replay) - Webpack (gzipped) 67.74 KB (+0.21% 🔺)
@sentry/browser (incl. Tracing, Replay) - Webpack with treeshaking flags (gzipped) 61.35 KB (+0.24% 🔺)
@sentry/browser (incl. Tracing) - Webpack (gzipped) 31.99 KB (+0.45% 🔺)
@sentry/browser (incl. Feedback) - Webpack (gzipped) 30.69 KB (+0.47% 🔺)
@sentry/browser - Webpack (gzipped) 22.06 KB (+0.67% 🔺)
@sentry/browser (incl. Tracing, Replay, Feedback) - ES6 CDN Bundle (gzipped) 74 KB (+0.25% 🔺)
@sentry/browser (incl. Tracing, Replay) - ES6 CDN Bundle (gzipped) 65.65 KB (+0.28% 🔺)
@sentry/browser (incl. Tracing) - ES6 CDN Bundle (gzipped) 31.85 KB (+0.61% 🔺)
@sentry/browser - ES6 CDN Bundle (gzipped) 23.77 KB (+0.83% 🔺)
@sentry/browser (incl. Tracing, Replay) - ES6 CDN Bundle (minified & uncompressed) 206.24 KB (+0.47% 🔺)
@sentry/browser (incl. Tracing) - ES6 CDN Bundle (minified & uncompressed) 96.13 KB (+1% 🔺)
@sentry/browser - ES6 CDN Bundle (minified & uncompressed) 70.97 KB (+1.36% 🔺)
@sentry/browser (incl. Tracing) - ES5 CDN Bundle (gzipped) 34.77 KB (+0.54% 🔺)
@sentry/react (incl. Tracing, Replay) - Webpack (gzipped) 68.1 KB (+0.21% 🔺)
@sentry/react - Webpack (gzipped) 22.09 KB (+0.64% 🔺)
@sentry/nextjs Client (incl. Tracing, Replay) - Webpack (gzipped) 84.84 KB (+0.19% 🔺)
@sentry/nextjs Client - Webpack (gzipped) 49.18 KB (+0.3% 🔺)
@sentry-internal/feedback - Webpack (gzipped) 16.73 KB (+0.89% 🔺)

Also allow to pass this to `withScope()`, which actually aligns with OTEL as well, where you can also do that. If you pass a scope there, it will use this instead of forking a new one.
@mydea mydea merged commit b6c369d into develop Jan 8, 2024
95 checks passed
@mydea mydea deleted the fn/startSpanScope branch January 8, 2024 13:18
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