ref(core): Export browser-specific span start APIs - #23361
Merged
Merged
Conversation
Contributor
size-limit report 📦
|
Lms24
force-pushed
the
lms/ref-core-browser-span-apis
branch
from
August 12, 2026 16:50
e69bc0e to
c75bc8e
Compare
Lms24
marked this pull request as ready for review
August 13, 2026 09:09
msonnb
approved these changes
Aug 13, 2026
Lms24
force-pushed
the
lms/ref-core-browser-span-apis
branch
from
August 13, 2026 11:46
c75bc8e to
dc5ae72
Compare
chargome
approved these changes
Aug 13, 2026
| * | ||
| * See {@link startInactiveSpan} in `@sentry/core` for details. | ||
| */ | ||
| export function startInactiveSpan(options: StartSpanOptions): Span { |
Member
There was a problem hiding this comment.
q: Did you check that our browser SDKs all use this method and not import from core directly? e.g. svelte still does import { debug, startInactiveSpan } from '@sentry/core';
Member
Author
There was a problem hiding this comment.
I'll merge the two first PR in sync to avoid any temporary issues
Lms24
force-pushed
the
lms/ref-core-browser-span-apis
branch
from
August 13, 2026 16:36
dc5ae72 to
47848cf
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 47848cf. Configure here.
logaretm
approved these changes
Aug 14, 2026
Lms24
force-pushed
the
lms/ref-core-browser-span-apis
branch
from
August 24, 2026 12:48
47848cf to
2f768e0
Compare
`@sentry/core/browser` now exports `startSpan`, `startInactiveSpan`, `startSpanManual` and `startIdleSpan` variants that install `spanStreamingIntegration` on the client before starting the span. `@sentry/core` and `@sentry/core/server` keep serving the plain ones. This is what lets `@sentry/browser`'s `init()` stop referencing the integration in a follow-up, so error-only bundles can tree-shake the whole span streaming graph. `init()` still pushes it here, so nothing changes behaviourally or size-wise yet. Because both variants share their names, the root entry's star exports of `server-exports` and `browser-exports` become ambiguous; `index.ts` pins them to the plain variants with explicit re-exports. The same applies to every meta-framework `index.types.ts` that star-exports both its client and server entry. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…pan APIs `shared-exports` star-exports the tracing barrel, so leaving `startSpan`, `startInactiveSpan` and `startSpanManual` there made them collide with the browser variants in `browser-exports`, leaving `browser.ts` with ambiguous star exports. Internal callers already deep-import these from `tracing/trace`. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Lms24
force-pushed
the
lms/ref-core-browser-span-apis
branch
from
August 24, 2026 13:05
2f768e0 to
c6cac01
Compare
Lms24
added a commit
that referenced
this pull request
Aug 24, 2026
…3362) Following the prework in #23361, this PR: - switches all browser instrumentation to use span starting APIs from `@sentry/core/browser` - removes pushing `spanStreamingIntegration` during SDK setup and fully relies on span starting APIs to add the integration if it wasn't added yet - as a result reduces bundle size by ~1.6KB for setups that do not rely on tracing, as well as our errors-only CDN bundle. One special change for`@sentry/effect`: I had to create browser- and server-specific versions of the `SentryEffectTracer` which takes the respective span starting APIs. We now have a factory function that creates the tracer for both environments specifically that injects the respective span API. all credits to @mydea for the idea 🙏 --------- Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
JPeer264
pushed a commit
that referenced
this pull request
Aug 25, 2026
This PR is a preparation for making `spanStreamingIntegration` tree-shakeable. End state: Browser `Sentry.init` /client setup no longer references `spanStreamingIntegration` in code. Instead, every `start*Span*` call checks if the integration is already set up. If not, it initializes it. This way, only usage of a span starting API will add the bundle size for spanStreamingIntegration. Before we make the tree shaking-relevant changes to our browser instrumentation, this PR lays the groundwork: - adds a browser-specific variant of `startSpan`, `startInactiveSpan`, `startSpanManual` and `startIdleSpan` to the `@sentry/core/browser` subpath export - moves the browser-specific `spanStreamingIntegration` into `@sentry/core/browser` - adds disambiguating types exports so that TS doesn't throw a type error when `startSpan` et. al. are imported from `@sentry/core` or any meta framework packages (in user code) --------- Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
JPeer264
pushed a commit
that referenced
this pull request
Aug 25, 2026
…3362) Following the prework in #23361, this PR: - switches all browser instrumentation to use span starting APIs from `@sentry/core/browser` - removes pushing `spanStreamingIntegration` during SDK setup and fully relies on span starting APIs to add the integration if it wasn't added yet - as a result reduces bundle size by ~1.6KB for setups that do not rely on tracing, as well as our errors-only CDN bundle. One special change for`@sentry/effect`: I had to create browser- and server-specific versions of the `SentryEffectTracer` which takes the respective span starting APIs. We now have a factory function that creates the tracer for both environments specifically that injects the respective span API. all credits to @mydea for the idea 🙏 --------- Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

This PR is a preparation for making
spanStreamingIntegrationtree-shakeable. End state: BrowserSentry.init/client setup no longer referencesspanStreamingIntegrationin code. Instead, everystart*Span*call checks if the integration is already set up. If not, it initializes it. This way, only usage of a span starting API will add the bundle size for spanStreamingIntegration.Before we make the tree shaking-relevant changes to our browser instrumentation, this PR lays the groundwork:
startSpan,startInactiveSpan,startSpanManualandstartIdleSpanto the@sentry/core/browsersubpath exportspanStreamingIntegrationinto@sentry/core/browserstartSpanet. al. are imported from@sentry/coreor any meta framework packages (in user code)