Skip to content

fix(replay): Set sentry.replay_id attribute on streamed spans#20897

Open
nicohrubec wants to merge 1 commit into
developfrom
feat/replay-id-span-streaming
Open

fix(replay): Set sentry.replay_id attribute on streamed spans#20897
nicohrubec wants to merge 1 commit into
developfrom
feat/replay-id-span-streaming

Conversation

@nicohrubec
Copy link
Copy Markdown
Member

@nicohrubec nicohrubec commented May 15, 2026

Sets sentry.replay_id as a span attribute on streamed spans via a processSpan hook on the Replay integration. This is expected as per https://develop.sentry.dev/sdk/telemetry/spans/span-protocol/#common-attribute-keys and wasn't previously set, so replays could not be connected to their traces in the UI when span streaming is active.

Fix lives in the replay integration to not impact bundle size for users who don't use session replays. However, since this is quite a small change with only a small bundle impact we can also discuss putting this in captureSpan for maintainability reasons (so we have more of the logic in a central place instead of cluttered all over).

Currently this still doesn't work yet in the product. It seems that the UI relies on replayId instead of sentry.replay_id, butsentry.replay_id is the attribute we defined for SDKs (conventions, dev docs) so the fix will likely be to update this in the product (but will confirm with them before merging). No harm in already reviewing so we have it ready to go.

Closes #20880

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@nicohrubec nicohrubec changed the title feat(replay): Set sentry.replay_id attribute on streamed spans fix(replay): Set sentry.replay_id attribute on streamed spans May 15, 2026
@nicohrubec nicohrubec requested a review from chargome May 15, 2026 06:26
@github-actions
Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size % Change Change
@sentry/browser 26.92 kB - -
@sentry/browser - with treeshaking flags 25.35 kB - -
@sentry/browser (incl. Tracing) 44.83 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 46.83 kB - -
@sentry/browser (incl. Tracing, Profiling) 49.82 kB - -
@sentry/browser (incl. Tracing, Replay) 84.47 kB +0.03% +22 B 🔺
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 73.94 kB +0.04% +24 B 🔺
@sentry/browser (incl. Tracing, Replay with Canvas) 89.17 kB +0.03% +20 B 🔺
@sentry/browser (incl. Tracing, Replay, Feedback) 101.82 kB +0.03% +24 B 🔺
@sentry/browser (incl. Feedback) 44.11 kB - -
@sentry/browser (incl. sendFeedback) 31.73 kB - -
@sentry/browser (incl. FeedbackAsync) 36.84 kB - -
@sentry/browser (incl. Metrics) 28.01 kB - -
@sentry/browser (incl. Logs) 28.16 kB - -
@sentry/browser (incl. Metrics & Logs) 28.84 kB - -
@sentry/react 28.67 kB - -
@sentry/react (incl. Tracing) 47.1 kB - -
@sentry/vue 31.84 kB - -
@sentry/vue (incl. Tracing) 46.7 kB - -
@sentry/svelte 26.94 kB - -
CDN Bundle 29.31 kB - -
CDN Bundle (incl. Tracing) 47.23 kB - -
CDN Bundle (incl. Logs, Metrics) 30.68 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 48.36 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 70.07 kB +0.04% +25 B 🔺
CDN Bundle (incl. Tracing, Replay) 84.67 kB +0.04% +26 B 🔺
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 85.75 kB +0.03% +25 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) 90.49 kB +0.03% +26 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 91.58 kB +0.03% +26 B 🔺
CDN Bundle - uncompressed 86.28 kB - -
CDN Bundle (incl. Tracing) - uncompressed 141.83 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 90.47 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 145.29 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 215.39 kB +0.04% +76 B 🔺
CDN Bundle (incl. Tracing, Replay) - uncompressed 260.64 kB +0.03% +76 B 🔺
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 264.09 kB +0.03% +76 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 274.34 kB +0.03% +76 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 277.78 kB +0.03% +76 B 🔺
@sentry/nextjs (client) 49.61 kB - -
@sentry/sveltekit (client) 45.31 kB - -
@sentry/node-core 61.97 kB +0.02% +11 B 🔺
@sentry/node 166.93 kB +0.01% +6 B 🔺
@sentry/node - without tracing 74.38 kB +0.01% +5 B 🔺
@sentry/aws-serverless 109.18 kB +0.01% +6 B 🔺
@sentry/cloudflare (withSentry) - minified 170.88 kB - -
@sentry/cloudflare (withSentry) 431.1 kB - -

View base workflow run

@nicohrubec nicohrubec marked this pull request as ready for review May 15, 2026 07:48
@nicohrubec nicohrubec requested a review from a team as a code owner May 15, 2026 07:48
Copy link
Copy Markdown
Member

@chargome chargome left a comment

Choose a reason for hiding this comment

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

LGTM! Just confirming that we do want this on every span, not just segment spans?

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.

Streamed spans are missing sentry.replay_id attribute

2 participants