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(core): Only return trace data from span if it is recording in getTraceData #13265

Closed
wants to merge 1 commit into from

Conversation

Lms24
Copy link
Member

@Lms24 Lms24 commented Aug 7, 2024

In Node/Otel we seem to create a non-recording span, even in tracing without performance mode. Therefore, our check to take the span data if there is an active span present led us to return trace data from that non-recording span. This caused a -0 being attached to the sentry-trace data and sentry-sampled: 1 to be contained in baggage when it shouldn't be.

This PR changes the logic, to not only check for the presence of an active span but also if it is recording

While it's good that we found this, the impact on shipped SDK code was negligible, given the function was only previously used in Astro and only recently made its way into core.

I'm not too sure about the fix yet, so would appreciate a review!

@Lms24 Lms24 requested a review from mydea August 7, 2024 14:42
@Lms24 Lms24 self-assigned this Aug 7, 2024
Copy link
Contributor

github-actions bot commented Aug 7, 2024

size-limit report 📦

Path Size
@sentry/browser 22.47 KB (0%)
@sentry/browser (incl. Tracing) 34.26 KB (0%)
@sentry/browser (incl. Tracing, Replay) 70.31 KB (0%)
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 63.64 KB (0%)
@sentry/browser (incl. Tracing, Replay with Canvas) 74.71 KB (0%)
@sentry/browser (incl. Tracing, Replay, Feedback) 87.32 KB (0%)
@sentry/browser (incl. Tracing, Replay, Feedback, metrics) 89.16 KB (0%)
@sentry/browser (incl. metrics) 26.77 KB (0%)
@sentry/browser (incl. Feedback) 39.42 KB (0%)
@sentry/browser (incl. sendFeedback) 27.09 KB (0%)
@sentry/browser (incl. FeedbackAsync) 31.75 KB (0%)
@sentry/react 25.24 KB (0%)
@sentry/react (incl. Tracing) 37.25 KB (0%)
@sentry/vue 26.62 KB (0%)
@sentry/vue (incl. Tracing) 36.1 KB (0%)
@sentry/svelte 22.61 KB (0%)
CDN Bundle 23.69 KB (0%)
CDN Bundle (incl. Tracing) 35.93 KB (0%)
CDN Bundle (incl. Tracing, Replay) 70.36 KB (0%)
CDN Bundle (incl. Tracing, Replay, Feedback) 75.61 KB (0%)
CDN Bundle - uncompressed 69.52 KB (0%)
CDN Bundle (incl. Tracing) - uncompressed 106.43 KB (0%)
CDN Bundle (incl. Tracing, Replay) - uncompressed 218.27 KB (0%)
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 231.16 KB (0%)
@sentry/nextjs (client) 37.1 KB (0%)
@sentry/sveltekit (client) 34.81 KB (0%)
@sentry/node 114.85 KB (+0.08% 🔺)
@sentry/node - without tracing 89.33 KB (-0.01% 🔽)
@sentry/aws-serverless 98.5 KB (-0.01% 🔽)

@Lms24
Copy link
Member Author

Lms24 commented Aug 7, 2024

I'm gonna close this for a better solution discussed with @mydea. We're gonna make getTraceData use an Otel-sepcific version in Potel SDKs that relies on getting trace data via Otel's propagator and the original version everywhere else.

The benefit is that this way we don't have potentially diverging trace data creation logic in Potel and core.

@Lms24 Lms24 closed this Aug 7, 2024
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.

1 participant