ref(core): Remove otel-based suppressTracing implementation - #22574
Conversation
size-limit report 📦
|
e8aa6c4 to
b7af61f
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ 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.
b7af61f to
cda341c
Compare
| startSpanManual, | ||
| startInactiveSpan, | ||
| getActiveSpan, | ||
| suppressTracing, | ||
| isTracingSuppressed, | ||
| getTraceData, | ||
| continueTrace, | ||
| startNewTrace, |
There was a problem hiding this comment.
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.
andreiborza
left a comment
There was a problem hiding this comment.
Nice, one less thing to maintain!

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.