Skip to content

ref(browser): Tree-shake span streaming out of error-only bundles - #23362

Draft
Lms24 wants to merge 1 commit into
lms/ref-core-browser-span-apisfrom
lms/ref-browser-treeshake-span-streaming
Draft

ref(browser): Tree-shake span streaming out of error-only bundles#23362
Lms24 wants to merge 1 commit into
lms/ref-core-browser-span-apisfrom
lms/ref-browser-treeshake-span-streaming

Conversation

@Lms24

@Lms24 Lms24 commented Aug 12, 2026

Copy link
Copy Markdown
Member

A lot of useless clanker shit

@github-actions

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size % Change Change
@sentry/browser 28.59 kB added added
@sentry/browser - with treeshaking flags 26.95 kB added added
@sentry/browser - with treeshaking flags tracing without tracing 26.85 kB added added
@sentry/browser (incl. Tracing) 48.56 kB added added
@sentry/browser (incl. Tracing + Span Streaming) 48.57 kB added added
@sentry/browser (incl. Tracing, Profiling) 51.51 kB added added
@sentry/browser (incl. Tracing, Replay) 87.95 kB added added
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 77.32 kB added added
@sentry/browser (incl. Tracing, Replay with Canvas) 92.67 kB added added
@sentry/browser (incl. Tracing, Replay, Feedback) 105.34 kB added added
@sentry/browser (incl. Feedback) 45.82 kB added added
@sentry/browser (incl. sendFeedback) 33.39 kB added added
@sentry/browser (incl. FeedbackAsync) 38.49 kB added added
@sentry/browser (incl. Metrics) 29.59 kB added added
@sentry/browser (incl. Logs) 29.86 kB added added
@sentry/browser (incl. Metrics & Logs) 30.55 kB added added
@sentry/react 30.37 kB added added
@sentry/react (incl. Tracing) 50.81 kB added added
@sentry/vue 35.39 kB added added
@sentry/vue (incl. Tracing) 50.53 kB added added
@sentry/svelte 28.62 kB added added
CDN Bundle 30.34 kB added added
CDN Bundle (incl. Tracing) 48.99 kB added added
CDN Bundle (incl. Logs, Metrics) 32.58 kB added added
CDN Bundle (incl. Tracing, Logs, Metrics) 50.91 kB added added
CDN Bundle (incl. Replay, Logs, Metrics) 72.98 kB added added
CDN Bundle (incl. Tracing, Replay) 86.57 kB added added
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 88.44 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback) 92.26 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 94.23 kB added added
CDN Bundle - uncompressed 89.98 kB added added
CDN Bundle (incl. Tracing) - uncompressed 146.85 kB added added
CDN Bundle (incl. Logs, Metrics) - uncompressed 96.38 kB added added
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 152.64 kB added added
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 225.33 kB added added
CDN Bundle (incl. Tracing, Replay) - uncompressed 266.11 kB added added
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 271.89 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 279.8 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 285.57 kB added added
@sentry/nextjs (client) 53.3 kB added added
@sentry/sveltekit (client) 49 kB added added
@sentry/core/server 65.45 kB added added
@sentry/core/browser 52.05 kB added added
@sentry/node 117.97 kB added added
@sentry/node/import (ESM hook with diagnostics-channel injection) 0 B added added
@sentry/node - without tracing 82.09 kB added added
@sentry/aws-serverless 91.5 kB added added
@sentry/cloudflare (withSentry) - minified 214.07 kB added added
@sentry/cloudflare (withSentry) 528.89 kB added added

`init()` no longer pushes `spanStreamingIntegration()`. That single
reference was the only thing retaining `SpanBuffer`, `captureSpan`,
`estimateSize` and `scopeContextAttributes` in every browser bundle,
including bundles for apps that never use tracing.

Instead, browser-facing packages import their span-start APIs from
`@sentry/core/browser`, which installs the integration on the client
before the first span starts. A span can only end if it was started, so
the `afterSpanEnd` listener is always registered in time.

`init` alone drops from 28.52 kB to 26.95 kB gzipped, within 0.1 kB of
the `__SENTRY_TRACING__: false` floor. Tracing users pay nothing extra.

Both variants share their names, so a stray plain import compiles fine
and silently stops sending spans. `sdk/no-unguarded-span-apis` is the
only thing that catches that, hence it lands here rather than later.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@Lms24
Lms24 force-pushed the lms/ref-browser-treeshake-span-streaming branch from b7fb94f to eb0bfb1 Compare August 12, 2026 16:50
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