Skip to content

feat(browser): Add spanStreamingIntegration#19218

Open
Lms24 wants to merge 8 commits intolms/feat-span-firstfrom
lms/feat-browser-spanStreamingIntegration
Open

feat(browser): Add spanStreamingIntegration#19218
Lms24 wants to merge 8 commits intolms/feat-span-firstfrom
lms/feat-browser-spanStreamingIntegration

Conversation

@Lms24
Copy link
Member

@Lms24 Lms24 commented Feb 6, 2026

to be merged after #19204

This PR adds the final big building block for span streaming functionality in the browser SDK: spanStreamingIntegation.

This integration:

  • enables traceLifecycle: 'stream' if not already set by users. This allows us to avoid the double-opt-in problem we usually have in browser SDKs because we want to keep integration tree-shakeable but also support the runtime-agnostic traceLifecycle option.
    • to do this properly, I decided to introduce a new integration hook: beforeSetup. This is allows us to safely modify client options before other integrations read it. We'll need this because browserTracingIntegration needs to check for span streaming later on. Let me know what you think!
  • validates that beforeSendSpan is compatible with span streaming. If not, it falls back to static tracing (transactions).
  • listens to a new afterSpanEnd hook. Once called, it will capture the span and hand it off to the span buffer.
  • listens to a new afterSegmentSpanEnd hook. Once called it will flush the trace from the buffer to ensure we flush out the trace as soon as possible. In browser, it's more likely that users refresh or close the tab/window before our buffer's internal flush interval triggers. We don't have to do this but I figured it would be a good trigger point.

While "final building block" sounds nice, there's still a lot of stuff to take care of in the browser. But with this in place we can also start integration-testing the browser SDKs.

ref #17836

@Lms24 Lms24 mentioned this pull request Feb 6, 2026
22 tasks
@github-actions
Copy link
Contributor

github-actions bot commented Feb 6, 2026

Codecov Results 📊


Generated by Codecov Action

@github-actions
Copy link
Contributor

github-actions bot commented Feb 6, 2026

size-limit report 📦

Path Size % Change Change
@sentry/browser 25.64 kB added added
@sentry/browser - with treeshaking flags 24.16 kB added added
@sentry/browser (incl. Tracing) 42.66 kB added added
@sentry/browser (incl. Tracing, Profiling) 47.33 kB added added
@sentry/browser (incl. Tracing, Replay) 81.49 kB added added
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 71.11 kB added added
@sentry/browser (incl. Tracing, Replay with Canvas) 86.18 kB added added
@sentry/browser (incl. Tracing, Replay, Feedback) 98.34 kB added added
@sentry/browser (incl. Feedback) 42.36 kB added added
@sentry/browser (incl. sendFeedback) 30.31 kB added added
@sentry/browser (incl. FeedbackAsync) 35.3 kB added added
@sentry/browser (incl. Metrics) 26.81 kB added added
@sentry/browser (incl. Logs) 26.96 kB added added
@sentry/browser (incl. Metrics & Logs) 27.64 kB added added
@sentry/react 27.4 kB added added
@sentry/react (incl. Tracing) 45 kB added added
@sentry/vue 30.3 kB added added
@sentry/vue (incl. Tracing) 44.51 kB added added
@sentry/svelte 25.67 kB added added
CDN Bundle 28.18 kB added added
CDN Bundle (incl. Tracing) 43.5 kB added added
CDN Bundle (incl. Logs, Metrics) 29.02 kB added added
CDN Bundle (incl. Tracing, Logs, Metrics) 44.33 kB added added
CDN Bundle (incl. Replay, Logs, Metrics) 68.11 kB added added
CDN Bundle (incl. Tracing, Replay) 80.33 kB added added
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 81.24 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback) 85.79 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 86.69 kB added added
CDN Bundle - uncompressed 82.41 kB added added
CDN Bundle (incl. Tracing) - uncompressed 128.77 kB added added
CDN Bundle (incl. Logs, Metrics) - uncompressed 85.25 kB added added
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 131.6 kB added added
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 208.91 kB added added
CDN Bundle (incl. Tracing, Replay) - uncompressed 245.65 kB added added
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 248.47 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 258.45 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 261.26 kB added added
@sentry/nextjs (client) 47.36 kB added added
@sentry/sveltekit (client) 43.11 kB added added
@sentry/node-core 52.24 kB added added
@sentry/node 166.79 kB added added
@sentry/node - without tracing 94.02 kB added added
@sentry/aws-serverless 109.52 kB added added

@github-actions
Copy link
Contributor

github-actions bot commented Feb 6, 2026

node-overhead report 🧳

Note: This is a synthetic benchmark with a minimal express app and does not necessarily reflect the real-world performance impact in an application.

Scenario Requests/s % of Baseline Prev. Requests/s Change %
GET Baseline 9,024 - - added
GET With Sentry 1,749 19% - added
GET With Sentry (error only) 6,332 70% - added
POST Baseline 1,195 - - added
POST With Sentry 606 51% - added
POST With Sentry (error only) 1,062 89% - added
MYSQL Baseline 3,316 - - added
MYSQL With Sentry 482 15% - added
MYSQL With Sentry (error only) 2,663 80% - added

Base automatically changed from lms/feat-core-spanBuffer to lms/feat-span-first February 9, 2026 10:05
@Lms24 Lms24 force-pushed the lms/feat-browser-spanStreamingIntegration branch from a294754 to 518df92 Compare February 10, 2026 12:41
@Lms24 Lms24 marked this pull request as ready for review February 10, 2026 16:10
@Lms24 Lms24 force-pushed the lms/feat-span-first branch from 28441df to bad8399 Compare February 13, 2026 15:29
@Lms24 Lms24 force-pushed the lms/feat-browser-spanStreamingIntegration branch from 04fbd09 to e14ab4f Compare February 13, 2026 15:40
Copy link

@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.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

@Lms24 Lms24 force-pushed the lms/feat-span-first branch from bad8399 to 5a165d4 Compare February 16, 2026 17:38
@Lms24 Lms24 force-pushed the lms/feat-browser-spanStreamingIntegration branch from 50532e0 to c5156fe Compare February 16, 2026 17:38
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

Comments