ref(core): Move shouldPropagateTraceForUrl from opentelemetry to core#19254
ref(core): Move shouldPropagateTraceForUrl from opentelemetry to core#19254andreiborza merged 2 commits intodevelopfrom
shouldPropagateTraceForUrl from opentelemetry to core#19254Conversation
This function is needed by light mode integrations that don't use OpenTelemetry. Move it to @sentry/core and re-export from @sentry/opentelemetry for backwards compatibility.
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.
|
|
||
| const cachedDecision = decisionMap?.get(url); | ||
| if (cachedDecision !== undefined) { | ||
| !cachedDecision && debug.log(NOT_PROPAGATED_MESSAGE, url); |
There was a problem hiding this comment.
Missing DEBUG_BUILD guard drops tree-shaking for debug logs
Medium Severity
The original code guarded debug.log calls with DEBUG_BUILD &&, enabling bundlers to tree-shake the entire expression (including NOT_PROPAGATED_MESSAGE) in production builds. The moved version drops the DEBUG_BUILD && prefix. While debug.log internally checks DEBUG_BUILD, the external guard is what allows dead-code elimination of the string constant and function call. Every other debug.log call in packages/core/src consistently uses the DEBUG_BUILD && pattern.
Additional Locations (1)
Triggered by project rule: PR Review Guidelines for Cursor Bot
Restore the DEBUG_BUILD && prefix that was present in the original opentelemetry version, enabling bundlers to tree-shake the debug log calls and string constant in production builds.
a76acf3 to
970a075
Compare
Codecov Results 📊Generated by Codecov Action |
size-limit report 📦
|
node-overhead report 🧳Note: This is a synthetic benchmark with a minimal express app and does not necessarily reflect the real-world performance impact in an application.
|


This function is needed in an upcoming pr by node-core/light, and since node-core/light does not depend on OpenTelemetry we need to move this to core and re-export it in
@sentry/opentelemetryfor backwards compatibility.Closes #19255 (added automatically)