Skip to content

fix(browser): Correctly parse sampleRate when consistentTraceSampling is enabled - #21281

Merged
Lms24 merged 2 commits into
developfrom
lms/fix-browser-linked-traces-consistentSampling-rate
Jun 2, 2026
Merged

fix(browser): Correctly parse sampleRate when consistentTraceSampling is enabled#21281
Lms24 merged 2 commits into
developfrom
lms/fix-browser-linked-traces-consistentSampling-rate

Conversation

@Lms24

@Lms24Lms24 commented Jun 2, 2026

Copy link
Copy Markdown
Member

This PR fixes 2 bugs in our trace linking logic that would emerge when consistentTraceSampling was enabled:

  1. We'd incorrectly parse an undefined sample rate as 0 on the last DSC instead of falling back to the sampling rate on the span
  2. The order of checking for the sample rate on the span vs. DSC was incorrect. This just didn't surface because of bug 1

closes#21264

@Lms24Lms24 self-assigned this Jun 2, 2026
@Lms24
Lms24 requested a review from s1gr1dJune 2, 2026 08:49
@Lms24
Lms24 marked this pull request as ready for review June 2, 2026 08:50
@Lms24
Lms24 requested a review from a team as a code ownerJune 2, 2026 08:50
@Lms24
Lms24 requested review from logaretm and mydea and removed request for a teamJune 2, 2026 08:50

@cursorcursorBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 87d27eb. Configure here.

Comment threadpackages/browser/test/tracing/linkedTraces.test.ts
@github-actions

github-actionsBot commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

size-limit report 📦

⚠️Warning: Base artifact is not the latest one, because the latest workflow run is not done yet. This may lead to incorrect results. Try to re-run all tests to get up to date results.

PathSize% ChangeChange
@sentry/browser27.2 kB--
@sentry/browser - with treeshaking flags25.65 kB--
@sentry/browser (incl. Tracing)45.25 kB+0.02%+8 B 🔺
@sentry/browser (incl. Tracing + Span Streaming)47.48 kB+0.02%+7 B 🔺
@sentry/browser (incl. Tracing, Profiling)50.24 kB+0.01%+3 B 🔺
@sentry/browser (incl. Tracing, Replay)84.84 kB+0.02%+10 B 🔺
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags74.41 kB+0.02%+9 B 🔺
@sentry/browser (incl. Tracing, Replay with Canvas)89.55 kB+0.02%+10 B 🔺
@sentry/browser (incl. Tracing, Replay, Feedback)102.17 kB+0.01%+10 B 🔺
@sentry/browser (incl. Feedback)44.36 kB--
@sentry/browser (incl. sendFeedback)32.02 kB--
@sentry/browser (incl. FeedbackAsync)37.11 kB--
@sentry/browser (incl. Metrics)28.27 kB--
@sentry/browser (incl. Logs)28.51 kB--
@sentry/browser (incl. Metrics & Logs)29.22 kB--
@sentry/react29.03 kB--
@sentry/react (incl. Tracing)47.53 kB+0.01%+3 B 🔺
@sentry/vue32.22 kB--
@sentry/vue (incl. Tracing)47.17 kB+0.02%+5 B 🔺
@sentry/svelte27.23 kB--
CDN Bundle29.57 kB--
CDN Bundle (incl. Tracing)47.82 kB+0.03%+11 B 🔺
CDN Bundle (incl. Logs, Metrics)31.08 kB--
CDN Bundle (incl. Tracing, Logs, Metrics)49.06 kB+0.02%+9 B 🔺
CDN Bundle (incl. Replay, Logs, Metrics)70.34 kB--
CDN Bundle (incl. Tracing, Replay)85.19 kB+0.01%+8 B 🔺
CDN Bundle (incl. Tracing, Replay, Logs, Metrics)86.35 kB+0.01%+7 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback)91.06 kB+0.01%+8 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics)92.2 kB+0.01%+7 B 🔺
CDN Bundle - uncompressed87.7 kB--
CDN Bundle (incl. Tracing) - uncompressed144.13 kB+0.02%+20 B 🔺
CDN Bundle (incl. Logs, Metrics) - uncompressed92.19 kB--
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed147.88 kB+0.02%+20 B 🔺
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed216.91 kB--
CDN Bundle (incl. Tracing, Replay) - uncompressed262.9 kB+0.01%+20 B 🔺
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed266.65 kB+0.01%+20 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed276.6 kB+0.01%+20 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed280.34 kB+0.01%+20 B 🔺
@sentry/nextjs (client)50.05 kB+0.02%+9 B 🔺
@sentry/sveltekit (client)45.71 kB+0.02%+7 B 🔺
@sentry/core/server75.94 kB--
@sentry/core/browser63.09 kB--
@sentry/node-core61.69 kB-0.01%-1 B 🔽
@sentry/node130.4 kB--
@sentry/node - without tracing74.06 kB+0.01%+1 B 🔺
@sentry/aws-serverless86.26 kB--
@sentry/cloudflare (withSentry) - minified171.49 kB--
@sentry/cloudflare (withSentry)428.63 kB--

View base workflow run

@JPeer264JPeer264 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.

LGTM. Nice catch!

@Lms24
Lms24 merged commit 01104fb into developJun 2, 2026
189 of 190 checks passed
@Lms24
Lms24 deleted the lms/fix-browser-linked-traces-consistentSampling-rate branch June 2, 2026 11:37
Sign up for freeto 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.

investigate invalid streamed spans

2 participants

@Lms24@JPeer264