Skip to content

ref(core): Remove otel-based suppressTracing implementation - #22574

Merged
mydea merged 3 commits into
developfrom
fn/suppressTracing
Jul 27, 2026
Merged

ref(core): Remove otel-based suppressTracing implementation#22574
mydea merged 3 commits into
developfrom
fn/suppressTracing

Conversation

@mydea

@mydea mydea commented Jul 24, 2026

Copy link
Copy Markdown
Member

Now, by default suppress tracing is async context aware, and we only overwrite this for the stack strategy (in browser) to have special handling (which used to be the default). node, cloudflare, deno can all use the default implementation.

@mydea mydea self-assigned this Jul 24, 2026
Comment thread packages/opentelemetry/src/asyncContextStrategy.ts
Comment thread packages/opentelemetry/src/exports.ts
@github-actions

github-actions Bot commented Jul 24, 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.

Path Size % Change Change
@sentry/browser 28 kB +0.21% +57 B 🔺
@sentry/browser - with treeshaking flags 26.45 kB +0.21% +53 B 🔺
@sentry/browser (incl. Tracing) 46.44 kB +0.08% +34 B 🔺
@sentry/browser (incl. Tracing + Span Streaming) 48.23 kB +0.1% +47 B 🔺
@sentry/browser (incl. Tracing, Profiling) 51.24 kB +0.06% +30 B 🔺
@sentry/browser (incl. Tracing, Replay) 85.73 kB +0.05% +42 B 🔺
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 75.38 kB +0.07% +49 B 🔺
@sentry/browser (incl. Tracing, Replay with Canvas) 90.44 kB +0.05% +39 B 🔺
@sentry/browser (incl. Tracing, Replay, Feedback) 103.1 kB +0.04% +38 B 🔺
@sentry/browser (incl. Feedback) 45.19 kB +0.14% +62 B 🔺
@sentry/browser (incl. sendFeedback) 32.81 kB +0.22% +69 B 🔺
@sentry/browser (incl. FeedbackAsync) 37.85 kB +0.14% +50 B 🔺
@sentry/browser (incl. Metrics) 29.11 kB +0.23% +64 B 🔺
@sentry/browser (incl. Logs) 29.32 kB +0.21% +61 B 🔺
@sentry/browser (incl. Metrics & Logs) 30.03 kB +0.21% +62 B 🔺
@sentry/react 29.79 kB +0.25% +73 B 🔺
@sentry/react (incl. Tracing) 48.72 kB +0.08% +35 B 🔺
@sentry/vue 33.43 kB +0.15% +47 B 🔺
@sentry/vue (incl. Tracing) 48.44 kB +0.1% +48 B 🔺
@sentry/svelte 28.02 kB +0.22% +59 B 🔺
CDN Bundle 30.31 kB +0.09% +27 B 🔺
CDN Bundle (incl. Tracing) 48.28 kB +0.05% +21 B 🔺
CDN Bundle (incl. Logs, Metrics) 31.88 kB +0.11% +33 B 🔺
CDN Bundle (incl. Tracing, Logs, Metrics) 49.61 kB +0.08% +36 B 🔺
CDN Bundle (incl. Replay, Logs, Metrics) 71.17 kB +0.06% +38 B 🔺
CDN Bundle (incl. Tracing, Replay) 85.85 kB +0.03% +24 B 🔺
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 87.15 kB +0.02% +11 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) 91.63 kB +0.03% +26 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 92.94 kB +0.06% +50 B 🔺
CDN Bundle - uncompressed 90.23 kB +0.1% +86 B 🔺
CDN Bundle (incl. Tracing) - uncompressed 145.3 kB +0.06% +86 B 🔺
CDN Bundle (incl. Logs, Metrics) - uncompressed 94.94 kB +0.1% +86 B 🔺
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 149.28 kB +0.06% +86 B 🔺
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 219.71 kB +0.04% +86 B 🔺
CDN Bundle (incl. Tracing, Replay) - uncompressed 264.54 kB +0.04% +86 B 🔺
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 268.51 kB +0.04% +86 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 278.24 kB +0.04% +86 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 282.2 kB +0.04% +86 B 🔺
@sentry/nextjs (client) 51.27 kB +0.08% +38 B 🔺
@sentry/sveltekit (client) 46.89 kB +0.1% +45 B 🔺
@sentry/core/server 80.04 kB -0.02% -10 B 🔽
@sentry/core/browser 52 kB -0.03% -12 B 🔽
@sentry/node 112.64 kB -0.03% -28 B 🔽
@sentry/node (incl. diagnostics channel injection) 156.79 kB -0.01% -1 B 🔽
@sentry/node/import (ESM hook with diagnostics-channel injection) 166 B - -
@sentry/node - without tracing 62.17 kB -0.03% -18 B 🔽
@sentry/aws-serverless 72.42 kB -0.05% -35 B 🔽
@sentry/cloudflare (withSentry) - minified 197.04 kB -0.01% -12 B 🔽
@sentry/cloudflare (withSentry) 484.79 kB +0.02% +54 B 🔺

View base workflow run

Comment thread packages/opentelemetry/src/utils/suppressTracing.ts
@mydea
mydea force-pushed the fn/suppressTracing branch 2 times, most recently from e8aa6c4 to b7af61f Compare July 27, 2026 11:29

@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 b7af61f. Configure here.

Comment thread packages/opentelemetry/src/trace.ts Outdated
@mydea
mydea force-pushed the fn/suppressTracing branch from b7af61f to cda341c Compare July 27, 2026 12:00
@mydea
mydea marked this pull request as ready for review July 27, 2026 12:00
@mydea
mydea requested a review from a team as a code owner July 27, 2026 12:00
@mydea
mydea requested review from JPeer264 and isaacs and removed request for a team July 27, 2026 12:00
Comment on lines 102 to 107
startSpanManual,
startInactiveSpan,
getActiveSpan,
suppressTracing,
isTracingSuppressed,
getTraceData,
continueTrace,
startNewTrace,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Bug: Removing the custom suppressTracing implementation for OTEL causes Sentry.suppressTracing() to no longer suppress OTEL-native span creation, as it now only sets Sentry-scope metadata.
Severity: HIGH

Suggested Fix

Reinstate the custom suppressTracing implementation in the OTEL async context strategy (asyncContextStrategy.ts). This implementation should call the native OpenTelemetry suppressTracing() function from @opentelemetry/core to ensure the suppression signal is correctly propagated within the OTEL context, which is what the OTEL tracer and propagator check.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.

Location: packages/opentelemetry/src/asyncContextStrategy.ts#L102-L107

Potential issue: In OpenTelemetry environments, the removal of the custom
`suppressTracing` implementation in `asyncContextStrategy.ts` causes a fallback to the
default Sentry implementation. This default only sets a `SUPPRESS_TRACING_KEY` in the
Sentry scope metadata. However, the OTEL tracer and propagator check for suppression
using OTEL's native context mechanism from `@opentelemetry/core`. Because the Sentry
metadata is not checked by OTEL, calling `Sentry.suppressTracing()` will fail to prevent
the creation of OTEL-native spans and the propagation of trace headers.

Did we get this right? 👍 / 👎 to inform future reviews.

@mydea
mydea requested a review from a team as a code owner July 27, 2026 12:28

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

Nice, one less thing to maintain!

@mydea
mydea merged commit c6e3775 into develop Jul 27, 2026
540 of 541 checks passed
@mydea
mydea deleted the fn/suppressTracing branch July 27, 2026 13:09
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.

2 participants