Skip to content

feat(core): Convert scope contexts to segment span attributes in span streaming#20828

Open
chargome wants to merge 3 commits into
developfrom
cg-applyScopeToSegmentSpan
Open

feat(core): Convert scope contexts to segment span attributes in span streaming#20828
chargome wants to merge 3 commits into
developfrom
cg-applyScopeToSegmentSpan

Conversation

@chargome
Copy link
Copy Markdown
Member

  • Implements applyScopeToSegmentSpan in the captureSpan pipeline to convert known scope
    contexts (set via scope.setContext()) to segment span attributes
  • Only maps browser-relevant contexts in core: response, profile, cloud_resource, culture, state, angular, react
  • Server-only contexts (aws, gcp, missing_instrumentation, trpc) will be handled by processSegmentSpan hooks in their respective packages in a follow-up PR

ref #20385

@chargome chargome self-assigned this May 12, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 12, 2026

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 26.88 kB - -
@sentry/browser - with treeshaking flags 25.32 kB - -
@sentry/browser (incl. Tracing) 44.78 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 47.01 kB +0.55% +256 B 🔺
@sentry/browser (incl. Tracing, Profiling) 49.77 kB - -
@sentry/browser (incl. Tracing, Replay) 84.41 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 73.84 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 89.11 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 101.75 kB - -
@sentry/browser (incl. Feedback) 44.06 kB - -
@sentry/browser (incl. sendFeedback) 31.69 kB - -
@sentry/browser (incl. FeedbackAsync) 36.8 kB - -
@sentry/browser (incl. Metrics) 27.97 kB - -
@sentry/browser (incl. Logs) 28.11 kB - -
@sentry/browser (incl. Metrics & Logs) 28.8 kB - -
@sentry/react 28.63 kB - -
@sentry/react (incl. Tracing) 47.05 kB - -
@sentry/vue 31.8 kB - -
@sentry/vue (incl. Tracing) 46.65 kB - -
@sentry/svelte 26.9 kB - -
CDN Bundle 29.26 kB - -
CDN Bundle (incl. Tracing) 47.45 kB +0.6% +279 B 🔺
CDN Bundle (incl. Logs, Metrics) 30.64 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 48.56 kB +0.57% +272 B 🔺
CDN Bundle (incl. Replay, Logs, Metrics) 69.97 kB - -
CDN Bundle (incl. Tracing, Replay) 84.83 kB +0.33% +275 B 🔺
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 85.89 kB +0.31% +265 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) 90.64 kB +0.3% +271 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 91.74 kB +0.3% +271 B 🔺
CDN Bundle - uncompressed 86.08 kB - -
CDN Bundle (incl. Tracing) - uncompressed 142.44 kB +0.64% +901 B 🔺
CDN Bundle (incl. Logs, Metrics) - uncompressed 90.28 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 145.9 kB +0.63% +901 B 🔺
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 215.1 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 261.14 kB +0.35% +901 B 🔺
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 264.59 kB +0.35% +901 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 274.84 kB +0.33% +901 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 278.28 kB +0.33% +901 B 🔺
@sentry/nextjs (client) 49.56 kB - -
@sentry/sveltekit (client) 45.27 kB - -
@sentry/node-core 61.06 kB +0.37% +222 B 🔺
@sentry/node 166.28 kB +0.19% +311 B 🔺
@sentry/node - without tracing 74.23 kB +0.37% +268 B 🔺
@sentry/aws-serverless 108.32 kB +0.24% +258 B 🔺
@sentry/cloudflare (withSentry) - minified 171.65 kB +0.57% +966 B 🔺
@sentry/cloudflare (withSentry) 432.55 kB +0.49% +2.07 kB 🔺

View base workflow run

@chargome
Copy link
Copy Markdown
Member Author

@cursor review

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit b7285a8. Configure here.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@chargome chargome requested a review from nicohrubec May 13, 2026 09:46
@chargome chargome marked this pull request as ready for review May 13, 2026 09:46
@chargome chargome requested a review from a team as a code owner May 13, 2026 09:46
Copy link
Copy Markdown
Member

@JPeer264 JPeer264 left a comment

Choose a reason for hiding this comment

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

Just one devils advocate comment

}

// Framework version contexts
const angular = contexts['angular'];
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.

q: Does it make sense to have framework specific code in core? I'm fine with it, just challenging if we really want to do this.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It basically syncs all context centrally that can make its way into browser sdks. But I do see your point obv

Copy link
Copy Markdown
Member

@nicohrubec nicohrubec left a comment

Choose a reason for hiding this comment

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

lgtm if conventions are approved

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.

3 participants