Skip to content

feat(opentelemetry): Remove setupEventContextTrace - #23226

Open
mydea wants to merge 2 commits into
fn/remove-span-scope-datafrom
fn/remove-setupEventContextTrace
Open

feat(opentelemetry): Remove setupEventContextTrace#23226
mydea wants to merge 2 commits into
fn/remove-span-scope-datafrom
fn/remove-setupEventContextTrace

Conversation

@mydea

@mydea mydea commented Aug 10, 2026

Copy link
Copy Markdown
Member

We no longer need this after #23225, as this should now pick up the correct span also for otel.

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

@@ -1,7 +1,5 @@
export { getScopesFromContext } from './utils/contextData';

export { setupEventContextTrace } from './setupEventContextTrace';

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Public API removed without deprecation

High Severity

Flagged because of the PR Review Guidelines rule on breaking changes: setupEventContextTrace was a publicly exported @sentry/opentelemetry API and is removed here with no deprecation path. Downstream imports will fail, and MIGRATION.md also does not mention this removal.

Fix in Cursor Fix in Web

Triggered by project rule: PR Review Guidelines for Cursor Bot

Reviewed by Cursor Bugbot for commit 4bf1290. Configure here.

@github-actions

github-actions Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size % Change Change
@sentry/browser 30.37 kB +0.06% +16 B 🔺
@sentry/browser - with treeshaking flags 28.55 kB +0.1% +26 B 🔺
@sentry/browser - with treeshaking flags tracing without tracing 26.87 kB +0.08% +20 B 🔺
@sentry/browser (incl. Tracing) 48.6 kB -0.02% -9 B 🔽
@sentry/browser (incl. Tracing + Span Streaming) 48.61 kB -0.02% -9 B 🔽
@sentry/browser (incl. Tracing, Profiling) 53.45 kB -0.02% -8 B 🔽
@sentry/browser (incl. Tracing, Replay) 88.03 kB -0.02% -11 B 🔽
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 77.45 kB -0.02% -8 B 🔽
@sentry/browser (incl. Tracing, Replay with Canvas) 92.76 kB -0.02% -10 B 🔽
@sentry/browser (incl. Tracing, Replay, Feedback) 105.43 kB -0.02% -19 B 🔽
@sentry/browser (incl. Feedback) 47.69 kB +0.01% +2 B 🔺
@sentry/browser (incl. sendFeedback) 35.19 kB +0.04% +14 B 🔺
@sentry/browser (incl. FeedbackAsync) 40.35 kB +0.05% +18 B 🔺
@sentry/browser (incl. Metrics) 31.4 kB -0.08% -22 B 🔽
@sentry/browser (incl. Logs) 31.65 kB -0.02% -5 B 🔽
@sentry/browser (incl. Metrics & Logs) 32.34 kB -0.01% -2 B 🔽
@sentry/react 32.17 kB +0.1% +32 B 🔺
@sentry/react (incl. Tracing) 50.81 kB -0.02% -8 B 🔽
@sentry/vue 35.44 kB -0.02% -6 B 🔽
@sentry/vue (incl. Tracing) 50.58 kB -0.02% -9 B 🔽
@sentry/svelte 30.39 kB +0.06% +16 B 🔺
CDN Bundle 31.59 kB -0.04% -12 B 🔽
CDN Bundle (incl. Tracing) 48.91 kB -0.01% -4 B 🔽
CDN Bundle (incl. Logs, Metrics) 33.84 kB -0.03% -7 B 🔽
CDN Bundle (incl. Tracing, Logs, Metrics) 50.88 kB -0.02% -6 B 🔽
CDN Bundle (incl. Replay, Logs, Metrics) 74.37 kB -0.01% -7 B 🔽
CDN Bundle (incl. Tracing, Replay) 86.49 kB -0.01% -5 B 🔽
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 88.39 kB -0.02% -9 B 🔽
CDN Bundle (incl. Tracing, Replay, Feedback) 92.2 kB -0.01% -4 B 🔽
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 94.18 kB -0.01% -8 B 🔽
CDN Bundle - uncompressed 93.93 kB -0.02% -18 B 🔽
CDN Bundle (incl. Tracing) - uncompressed 146.9 kB -0.02% -23 B 🔽
CDN Bundle (incl. Logs, Metrics) - uncompressed 100.39 kB -0.03% -23 B 🔽
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 152.75 kB -0.02% -23 B 🔽
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 229.32 kB -0.02% -23 B 🔽
CDN Bundle (incl. Tracing, Replay) - uncompressed 266.15 kB -0.01% -23 B 🔽
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 271.99 kB -0.01% -23 B 🔽
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 279.85 kB -0.01% -23 B 🔽
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 285.68 kB -0.01% -23 B 🔽
@sentry/nextjs (client) 53.39 kB +0.04% +18 B 🔺
@sentry/sveltekit (client) 49.02 kB -0.02% -7 B 🔽
@sentry/core/server 65.57 kB -0.05% -32 B 🔽
@sentry/core/browser 51.9 kB -0.04% -20 B 🔽
@sentry/node 118.42 kB -0.04% -36 B 🔽
@sentry/node/import (ESM hook with diagnostics-channel injection) 0 B added added
@sentry/node - without tracing 82.54 kB -0.04% -29 B 🔽
@sentry/aws-serverless 91.9 kB -0.05% -41 B 🔽
@sentry/cloudflare (withSentry) - minified 214.67 kB -0.02% -30 B 🔽
@sentry/cloudflare (withSentry) 530.2 kB -0.01% -31 B 🔽

View base workflow run

@mydea
mydea force-pushed the fn/remove-setupEventContextTrace branch from 4bf1290 to 453bfc7 Compare August 10, 2026 12:40
@mydea
mydea marked this pull request as ready for review August 10, 2026 13:15
@mydea
mydea requested review from a team as code owners August 10, 2026 13:15
@mydea
mydea requested review from JPeer264 and isaacs and removed request for a team August 10, 2026 13:15
Comment on lines 98 to 103
setupOtel(client);
}

setupEventContextTrace(client);

return client;
}

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: The removal of setupEventContextTrace in the Node SDK is not automatically replaced. Users with enableOpenTelemetrySetup: true will lose OTel trace context unless they manually add otlpIntegration.
Severity: MEDIUM

Suggested Fix

Automatically add otlpIntegration to the default integrations in the Node SDK when the enableOpenTelemetrySetup option is set to true. This would restore the previous behavior where OpenTelemetry trace context is automatically captured without requiring manual configuration from the user. Alternatively, clearly document this breaking change and instruct users to add the integration manually.

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/vercel-edge/src/sdk.ts#L98-L103

Potential issue: The Node SDK previously used `setupEventContextTrace` to automatically
link Sentry events with active OpenTelemetry (OTel) spans when
`enableOpenTelemetrySetup` was true. This function has been removed. The replacement,
`otlpIntegration`, is not enabled by default. Consequently, users who enable OTel setup
will no longer have trace context from active OTel spans automatically associated with
their Sentry events. This is a breaking change that can lead to broken or incomplete
traces for users relying on the previous automatic OTel span linkage, unless they
manually add `otlpIntegration()` to their Sentry configuration.

Also affects:

  • packages/node/src/sdk/index.ts:230~235

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

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.

1 participant