Skip to content

feat(core)!: Enable span streaming by default#22642

Draft
Lms24 wants to merge 1 commit into
feat/span-streaming-test-opt-outsfrom
feat/span-streaming-default
Draft

feat(core)!: Enable span streaming by default#22642
Lms24 wants to merge 1 commit into
feat/span-streaming-test-opt-outsfrom
feat/span-streaming-default

Conversation

@Lms24

@Lms24 Lms24 commented Jul 24, 2026

Copy link
Copy Markdown
Member

Make stream the default trace lifecycle for server runtime clients and automatically install spanStreamingIntegration in the browser SDK unless users explicitly select the static lifecycle.

Browser users should receive the same default experience as server SDK users, without manually adding the integration. Explicit static configurations and explicit integration lists remain respected, and duplicate streaming integrations are avoided.

This is the middle PR in the span-streaming-default stack and depends on the transaction-test opt-outs below it.

Fixes #22349

Made with Cursor

Default clients to the streamed trace lifecycle and automatically install
the required streaming integration in browser and server runtimes.
Explicit static lifecycle configuration remains supported.

BREAKING CHANGE: Spans use the streamed trace lifecycle unless configured otherwise.
Fixes #22344

Co-Authored-By: Cursor <cursoragent@cursor.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 3 potential issues.

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 2eeaff8. Configure here.

*/
protected constructor(options: O) {
this._options = { attachStacktrace: true, ...options };
this._options = { attachStacktrace: true, traceLifecycle: 'stream', ...options };

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Stream default drops browser spans

High Severity

Defaulting traceLifecycle to stream on base Client skips the static transaction path, but BrowserClient never auto-installs spanStreamingIntegration. Only init() adds it, unlike ServerRuntimeClient. Constructing BrowserClient directly therefore enables streaming with no flusher, so finished spans are never sent.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 2eeaff8. Configure here.

import { httpContextIntegration } from './integrations/httpcontext';
import { linkedErrorsIntegration } from './integrations/linkederrors';
import { spotlightBrowserIntegration } from './integrations/spotlight';
import { spanStreamingIntegration } from './integrations/spanstreaming';

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Browser bundle size increase

Medium Severity

This violates the review rule on large browser bundle size increases. Importing spanStreamingIntegration into sdk.ts pulls SpanBuffer and related streaming code into every bundle that ships init, including non-tracing CDN entry points that previously only exposed a shim.

Additional Locations (1)
Fix in Cursor Fix in Web

Triggered by project rule: PR Review Guidelines for Cursor Bot

Reviewed by Cursor Bugbot for commit 2eeaff8. Configure here.


if (options.traceLifecycle !== 'static' && !integrations.some(integration => integration.name === 'SpanStreaming')) {
integrations.push(spanStreamingIntegration());
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Missing integration or E2E tests

Medium Severity

This violates the Testing Conventions rule for feat PRs. The change only adds unit coverage that the integration is present in options; there is no integration or E2E test that asserts streamed spans are actually emitted under the new default.

Fix in Cursor Fix in Web

Triggered by project rule: PR Review Guidelines for Cursor Bot

Reviewed by Cursor Bugbot for commit 2eeaff8. Configure here.

@github-actions

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size % Change Change
@sentry/browser 29.88 kB added added
@sentry/browser - with treeshaking flags 28.08 kB added added
@sentry/browser (incl. Tracing) 48.06 kB added added
@sentry/browser (incl. Tracing + Span Streaming) 48.07 kB added added
@sentry/browser (incl. Tracing, Profiling) 52.85 kB added added
@sentry/browser (incl. Tracing, Replay) 87.42 kB added added
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 76.79 kB added added
@sentry/browser (incl. Tracing, Replay with Canvas) 92.13 kB added added
@sentry/browser (incl. Tracing, Replay, Feedback) 104.78 kB added added
@sentry/browser (incl. Feedback) 47.19 kB added added
@sentry/browser (incl. sendFeedback) 34.72 kB added added
@sentry/browser (incl. FeedbackAsync) 39.82 kB added added
@sentry/browser (incl. Metrics) 30.97 kB added added
@sentry/browser (incl. Logs) 31.2 kB added added
@sentry/browser (incl. Metrics & Logs) 31.86 kB added added
@sentry/react 31.73 kB added added
@sentry/react (incl. Tracing) 50.39 kB added added
@sentry/vue 35.1 kB added added
@sentry/vue (incl. Tracing) 50.05 kB added added
@sentry/svelte 29.91 kB added added
CDN Bundle 31.88 kB added added
CDN Bundle (incl. Tracing) 48.3 kB added added
CDN Bundle (incl. Logs, Metrics) 33.44 kB added added
CDN Bundle (incl. Tracing, Logs, Metrics) 49.62 kB added added
CDN Bundle (incl. Replay, Logs, Metrics) 72.78 kB added added
CDN Bundle (incl. Tracing, Replay) 85.87 kB added added
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 87.2 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback) 91.68 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 92.96 kB added added
CDN Bundle - uncompressed 95.28 kB added added
CDN Bundle (incl. Tracing) - uncompressed 145.33 kB added added
CDN Bundle (incl. Logs, Metrics) - uncompressed 99.99 kB added added
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 149.31 kB added added
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 224.76 kB added added
CDN Bundle (incl. Tracing, Replay) - uncompressed 264.57 kB added added
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 268.54 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 278.27 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 282.23 kB added added
@sentry/nextjs (client) 52.9 kB added added
@sentry/sveltekit (client) 48.52 kB added added
@sentry/core/server 80.08 kB added added
@sentry/core/browser 52.02 kB added added
@sentry/node 123.16 kB added added
@sentry/node (incl. diagnostics channel injection) 167.16 kB added added
@sentry/node/import (ESM hook with diagnostics-channel injection) 166 B added added
@sentry/node - without tracing 73.33 kB added added
@sentry/aws-serverless 82.84 kB added added
@sentry/cloudflare (withSentry) - minified 197.12 kB added added
@sentry/cloudflare (withSentry) 484.83 kB added added

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.

Make streamed span types the default in public APIs

1 participant