Skip to content

feat(core)!: Return StreamedSpanJSON from spanToJSON - #23238

Draft
Lms24 wants to merge 2 commits into
lms/migrate-to-streamed-span-jsonfrom
lms/spanToJSON-returns-streamed
Draft

feat(core)!: Return StreamedSpanJSON from spanToJSON#23238
Lms24 wants to merge 2 commits into
lms/migrate-to-streamed-span-jsonfrom
lms/spanToJSON-returns-streamed

Conversation

@Lms24

@Lms24 Lms24 commented Aug 10, 2026

Copy link
Copy Markdown
Member

Swaps the two span serialization helpers: spanToJSON now returns StreamedSpanJSON — the same shape users already get in beforeSendSpan — and the previous static behavior is available as spanToStaticSpanJSON.

Stacked on #23237, which already moved every internal consumer onto the streamed representation. That makes this PR a pure identifier rename: no call site changes shape, so despite the file count the diff is mechanically verifiable. Reviewing packages/core/src/utils/spanUtils.ts, packages/core/src/types/span.ts and MIGRATION.md covers the actual API change; the rest is the rename.

One addition beyond the rename: spanToStaticSpanJSON is re-exported from the SDK packages that already re-export spanToJSON (node, browser, vercel-edge, cloudflare, bun, deno and the meta-frameworks). Those barrels enumerate their exports rather than re-exporting @sentry/core wholesale, so without it the migration guide's advice to switch to spanToStaticSpanJSON would not have been followable.

Swaps the two span serialization helpers:

- `spanToJSON` now returns `StreamedSpanJSON`, the same shape users already get
  in `beforeSendSpan`.
- The previous static `SpanJSON` behavior is available as `spanToStaticSpanJSON`,
  which is what users opting out of span streaming should switch to.

This commit is a pure identifier rename on top of the preceding migration — no
call site changes shape, because every internal consumer was already moved onto
the streamed representation. That makes the diff mechanically verifiable.

`spanToStaticSpanJSON` is also re-exported from the SDK packages that already
re-export `spanToJSON` (node, browser, vercel-edge, cloudflare, bun, deno, and
the meta-frameworks). Those barrels enumerate their exports rather than
re-exporting `@sentry/core` wholesale, so without this the migration guide's
advice to switch to `spanToStaticSpanJSON` would not be followable.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

@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 6e900a8. Configure here.

Comment thread packages/core/src/shared-exports.ts
@github-actions

github-actions Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size % Change Change
@sentry/browser 30.36 kB +0.02% +4 B 🔺
@sentry/browser - with treeshaking flags 28.53 kB +0.04% +10 B 🔺
@sentry/browser - with treeshaking flags tracing without tracing 26.86 kB +0.03% +8 B 🔺
@sentry/browser (incl. Tracing) 48.64 kB +0.06% +25 B 🔺
@sentry/browser (incl. Tracing + Span Streaming) 48.65 kB +0.06% +29 B 🔺
@sentry/browser (incl. Tracing, Profiling) 53.48 kB +0.04% +19 B 🔺
@sentry/browser (incl. Tracing, Replay) 88.06 kB +0.03% +19 B 🔺
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 77.48 kB +0.03% +22 B 🔺
@sentry/browser (incl. Tracing, Replay with Canvas) 92.79 kB +0.03% +25 B 🔺
@sentry/browser (incl. Tracing, Replay, Feedback) 105.48 kB +0.03% +24 B 🔺
@sentry/browser (incl. Feedback) 47.69 kB +0.01% +1 B 🔺
@sentry/browser (incl. sendFeedback) 35.18 kB +0.02% +4 B 🔺
@sentry/browser (incl. FeedbackAsync) 40.34 kB +0.01% +3 B 🔺
@sentry/browser (incl. Metrics) 31.43 kB +0.02% +5 B 🔺
@sentry/browser (incl. Logs) 31.66 kB +0.03% +7 B 🔺
@sentry/browser (incl. Metrics & Logs) 32.35 kB +0.03% +8 B 🔺
@sentry/react 32.15 kB +0.03% +7 B 🔺
@sentry/react (incl. Tracing) 50.83 kB +0.03% +11 B 🔺
@sentry/vue 35.45 kB +0.01% +2 B 🔺
@sentry/vue (incl. Tracing) 50.6 kB +0.04% +16 B 🔺
@sentry/svelte 30.38 kB +0.02% +4 B 🔺
CDN Bundle 31.62 kB +0.05% +14 B 🔺
CDN Bundle (incl. Tracing) 48.96 kB +0.09% +40 B 🔺
CDN Bundle (incl. Logs, Metrics) 33.85 kB +0.04% +11 B 🔺
CDN Bundle (incl. Tracing, Logs, Metrics) 50.91 kB +0.06% +30 B 🔺
CDN Bundle (incl. Replay, Logs, Metrics) 74.39 kB +0.02% +11 B 🔺
CDN Bundle (incl. Tracing, Replay) 86.52 kB +0.03% +22 B 🔺
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 88.42 kB +0.03% +25 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) 92.23 kB +0.03% +22 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 94.21 kB +0.03% +23 B 🔺
CDN Bundle - uncompressed 94.01 kB +0.07% +60 B 🔺
CDN Bundle (incl. Tracing) - uncompressed 147.06 kB +0.1% +142 B 🔺
CDN Bundle (incl. Logs, Metrics) - uncompressed 100.48 kB +0.06% +60 B 🔺
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 152.92 kB +0.1% +142 B 🔺
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 229.41 kB +0.04% +70 B 🔺
CDN Bundle (incl. Tracing, Replay) - uncompressed 266.32 kB +0.06% +152 B 🔺
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 272.17 kB +0.06% +152 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 280.02 kB +0.06% +152 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 285.85 kB +0.06% +152 B 🔺
@sentry/nextjs (client) 53.4 kB +0.04% +20 B 🔺
@sentry/sveltekit (client) 49.05 kB +0.05% +22 B 🔺
@sentry/core/server 65.61 kB +0.03% +15 B 🔺
@sentry/core/browser 51.93 kB +0.03% +12 B 🔺
@sentry/node 118.47 kB +0.02% +15 B 🔺
@sentry/node/import (ESM hook with diagnostics-channel injection) 0 B added added
@sentry/node - without tracing 82.58 kB +0.02% +13 B 🔺
@sentry/aws-serverless 91.95 kB +0.02% +10 B 🔺
@sentry/cloudflare (withSentry) - minified 214.73 kB +0.02% +29 B 🔺
@sentry/cloudflare (withSentry) 530.46 kB +0.05% +226 B 🔺

View base workflow run

`spanToStreamedSpanJSON` was public API in v10 (exported from `@sentry/core`),
so its removal needs an explicit migration path. It is now equivalent to
`spanToJSON`.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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