Skip to content

feat(core): Expose sentry.op attribute to samplers - #23354

Merged
andreiborza merged 4 commits into
developfrom
ab/sampler-sees-sentry-op
Aug 12, 2026
Merged

feat(core): Expose sentry.op attribute to samplers#23354
andreiborza merged 4 commits into
developfrom
ab/sampler-sees-sentry-op

Conversation

@andreiborza

Copy link
Copy Markdown
Member

What

Folds the op option into the span attributes before sampling, so a tracesSampler sees sentry.op in the attributes. An explicit sentry.op attribute wins over the option.

Why

The OpenTelemetry startSpan implementations expose sentry.op to samplers, but core only adds it after the sampling decision. This aligns core with that behavior, extracted from #23198.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@andreiborza
andreiborza marked this pull request as ready for review August 12, 2026 13:04
Comment thread packages/core/test/lib/tracing/trace.test.ts
@Lms24

Lms24 commented Aug 12, 2026

Copy link
Copy Markdown
Member

good catch!

@github-actions

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size % Change Change
@sentry/browser 30.34 kB - -
@sentry/browser - with treeshaking flags 28.51 kB - -
@sentry/browser - with treeshaking flags tracing without tracing 26.85 kB - -
@sentry/browser (incl. Tracing) 48.57 kB +0.02% +9 B 🔺
@sentry/browser (incl. Tracing + Span Streaming) 48.58 kB +0.02% +9 B 🔺
@sentry/browser (incl. Tracing, Profiling) 51.46 kB +0.02% +9 B 🔺
@sentry/browser (incl. Tracing, Replay) 87.98 kB +0.02% +10 B 🔺
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 77.36 kB +0.02% +9 B 🔺
@sentry/browser (incl. Tracing, Replay with Canvas) 92.7 kB +0.02% +10 B 🔺
@sentry/browser (incl. Tracing, Replay, Feedback) 105.38 kB +0.01% +10 B 🔺
@sentry/browser (incl. Feedback) 47.66 kB - -
@sentry/browser (incl. sendFeedback) 35.16 kB - -
@sentry/browser (incl. FeedbackAsync) 40.31 kB - -
@sentry/browser (incl. Metrics) 31.31 kB - -
@sentry/browser (incl. Logs) 31.58 kB - -
@sentry/browser (incl. Metrics & Logs) 32.25 kB - -
@sentry/react 32.13 kB - -
@sentry/react (incl. Tracing) 50.78 kB +0.03% +13 B 🔺
@sentry/vue 35.36 kB +0.03% +9 B 🔺
@sentry/vue (incl. Tracing) 50.53 kB +0.03% +13 B 🔺
@sentry/svelte 30.37 kB - -
CDN Bundle 31.64 kB - -
CDN Bundle (incl. Tracing) 48.9 kB +0.02% +7 B 🔺
CDN Bundle (incl. Logs, Metrics) 33.86 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 50.86 kB +0.03% +11 B 🔺
CDN Bundle (incl. Replay, Logs, Metrics) 74.38 kB - -
CDN Bundle (incl. Tracing, Replay) 86.49 kB +0.02% +11 B 🔺
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 88.36 kB +0.02% +12 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) 92.2 kB +0.02% +11 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 94.17 kB +0.02% +12 B 🔺
CDN Bundle - uncompressed 93.94 kB - -
CDN Bundle (incl. Tracing) - uncompressed 146.81 kB +0.04% +49 B 🔺
CDN Bundle (incl. Logs, Metrics) - uncompressed 100.34 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 152.61 kB +0.04% +49 B 🔺
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 229.28 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 266.07 kB +0.02% +49 B 🔺
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 271.85 kB +0.02% +49 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 279.77 kB +0.02% +49 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 285.54 kB +0.02% +49 B 🔺
@sentry/nextjs (client) 53.3 kB +0.02% +9 B 🔺
@sentry/sveltekit (client) 48.99 kB +0.02% +9 B 🔺
@sentry/core/server 65.45 kB +0.02% +13 B 🔺
@sentry/core/browser 51.81 kB +0.03% +14 B 🔺
@sentry/node 117.98 kB +0.02% +12 B 🔺
@sentry/node/import (ESM hook with diagnostics-channel injection) 0 B added added
@sentry/node - without tracing 82.1 kB +0.02% +9 B 🔺
@sentry/aws-serverless 91.51 kB +0.01% +8 B 🔺
@sentry/cloudflare (withSentry) - minified 214.12 kB +0.03% +48 B 🔺
@sentry/cloudflare (withSentry) 529.03 kB +0.03% +139 B 🔺

View base workflow run

@andreiborza
andreiborza requested a review from a team as a code owner August 12, 2026 13:08
@andreiborza
andreiborza requested review from logaretm and removed request for a team August 12, 2026 13:08

@cursor cursor Bot 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 0ffb790. Configure here.

@andreiborza
andreiborza merged commit 1041f45 into develop Aug 12, 2026
276 of 279 checks passed
@andreiborza
andreiborza deleted the ab/sampler-sees-sentry-op branch August 12, 2026 13:40
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