Skip to content

fix(browser): Set custom sentry source correctly #11735

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

Merged
merged 1 commit into from
Apr 23, 2024

Conversation

AbhiPrasad
Copy link
Member

The primary change is to make finalStartSpanOptions.name !== finalStartSpanOptions.name -> startSpanOptions.name !== finalStartSpanOptions.name in packages/browser/src/tracing/browserTracingIntegration.ts.

While I was here though I cleaned up some other code to improve bundle size. Let me know if you want me to extract the cleanup changes, I figured it's all easier to review here with the same context.

@AbhiPrasad AbhiPrasad requested review from a team, stephanie-anderson and Lms24 and removed request for a team April 22, 2024 23:49
@AbhiPrasad AbhiPrasad self-assigned this Apr 22, 2024
Copy link
Contributor

size-limit report 📦

Path Size
@sentry/browser 21.67 KB (0%)
@sentry/browser (incl. Tracing) 32.61 KB (-0.09% 🔽)
@sentry/browser (incl. Tracing, Replay) 67.89 KB (-0.06% 🔽)
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 61.31 KB (-0.05% 🔽)
@sentry/browser (incl. Tracing, Replay with Canvas) 71.91 KB (-0.05% 🔽)
@sentry/browser (incl. Tracing, Replay, Feedback) 84.11 KB (-0.05% 🔽)
@sentry/browser (incl. Feedback) 37.78 KB (0%)
@sentry/browser (incl. sendFeedback) 26.45 KB (0%)
@sentry/browser (incl. FeedbackAsync) 30.93 KB (0%)
@sentry/react 24.35 KB (0%)
@sentry/react (incl. Tracing) 35.51 KB (-0.1% 🔽)
@sentry/vue 25.25 KB (0%)
@sentry/vue (incl. Tracing) 34.37 KB (-0.08% 🔽)
@sentry/svelte 21.79 KB (0%)
CDN Bundle 23.97 KB (0%)
CDN Bundle (incl. Tracing) 33.87 KB (-0.01% 🔽)
CDN Bundle (incl. Tracing, Replay) 67.49 KB (+0.1% 🔺)
CDN Bundle (incl. Tracing, Replay, Feedback) 83.34 KB (+0.14% 🔺)
CDN Bundle - uncompressed 70.62 KB (0%)
CDN Bundle (incl. Tracing) - uncompressed 100.44 KB (-0.23% 🔽)
CDN Bundle (incl. Tracing, Replay) - uncompressed 209.88 KB (-0.11% 🔽)
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 256.2 KB (-0.09% 🔽)
@sentry/nextjs (client) 34.74 KB (-0.1% 🔽)
@sentry/sveltekit (client) 33.11 KB (-0.07% 🔽)
@sentry/node 139.43 KB (0%)

if (finalStartSpanOptions.name !== finalStartSpanOptions.name) {
// If `finalStartSpanOptions.name` is different than `startSpanOptions.name`
// it is because `beforeStartSpan` set a custom name. Therefore we set the source to 'custom'.
if (startSpanOptions.name !== finalStartSpanOptions.name) {
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 is the change. I'm not sure how the tests were passing 🤔

Copy link
Member

Choose a reason for hiding this comment

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

OMG 🤯

Copy link
Member

Choose a reason for hiding this comment

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

I guess we never tested starting a pageload/navigation txn with beforeStartSpan 🤔

Copy link
Member

@Lms24 Lms24 left a comment

Choose a reason for hiding this comment

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

Great catch and also good cleanup!

@AbhiPrasad AbhiPrasad merged commit bee0677 into develop Apr 23, 2024
91 checks passed
@AbhiPrasad AbhiPrasad deleted the abhi-browser-tracing-cleanup branch April 23, 2024 13:26
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