sentry-javascript icon indicating copy to clipboard operation
sentry-javascript copied to clipboard

[WIP] feat: Span Streaming POC

Open Lms24 opened this issue 3 months ago • 2 comments

This PR contains the POC span streaming implementation for browser SDKs.

Can be tested on @sentry/[email protected] and any higher-level SDKs.

To opt into span streaming, set:

Sentry.init({
  dsn: '...',
  tracesSampleRate: 1,
  traceLifecycle: 'stream', <-- 
  integrations: [
    Sentry.browserTracingIntegration();
    Sentry.spanStreamingIntegration(); <-- 
  ],

  // if you use beforeSendSpan, you have to opt into the new serialized span format:
  beforeSendSpan: withStreamSpan(serializedSpan => {
     // do something
     return serializedSpan
   }),
})

Also note that spans will no longer be sent to any event processors added via one if the *.addEventProcessor APIs. If you have any event processors, consider using beforeSendSpan or ignoreSpans.

Lms24 avatar Oct 02 '25 14:10 Lms24

size-limit report 📦

Path Size % Change Change
@sentry/browser 25.81 kB +4.03% +998 B 🔺
@sentry/browser - with treeshaking flags 24.3 kB +4.28% +996 B 🔺
@sentry/browser (incl. Tracing) 42.79 kB +2.94% +1.22 kB 🔺
@sentry/browser (incl. Tracing, Profiling) 47.39 kB +2.62% +1.21 kB 🔺
@sentry/browser (incl. Tracing, Replay) 81.47 kB +1.64% +1.31 kB 🔺
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 71.02 kB +1.6% +1.12 kB 🔺
@sentry/browser (incl. Tracing, Replay with Canvas) 86.14 kB +1.53% +1.29 kB 🔺
@sentry/browser (incl. Tracing, Replay, Feedback) 98.29 kB +1.26% +1.22 kB 🔺
@sentry/browser (incl. Feedback) 42.5 kB +2.39% +989 B 🔺
@sentry/browser (incl. sendFeedback) 30.48 kB +3.36% +988 B 🔺
@sentry/browser (incl. FeedbackAsync) 35.48 kB +2.88% +991 B 🔺
@sentry/react 27.53 kB +3.82% +1.01 kB 🔺
@sentry/react (incl. Tracing) 45.03 kB +2.86% +1.25 kB 🔺
@sentry/vue 30.44 kB +4.01% +1.17 kB 🔺
@sentry/vue (incl. Tracing) 44.6 kB +2.8% +1.21 kB 🔺
@sentry/svelte 25.83 kB +4.09% +1.01 kB 🔺
CDN Bundle 28.14 kB +3.35% +910 B 🔺
CDN Bundle (incl. Tracing) 43.4 kB +2.79% +1.18 kB 🔺
CDN Bundle (incl. Tracing, Replay) 80.08 kB +1.46% +1.15 kB 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) 85.56 kB +1.39% +1.17 kB 🔺
CDN Bundle - uncompressed 82.55 kB +3.16% +2.53 kB 🔺
CDN Bundle (incl. Tracing) - uncompressed 128.73 kB +2.68% +3.35 kB 🔺
CDN Bundle (incl. Tracing, Replay) - uncompressed 245.26 kB +1.39% +3.35 kB 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 258.03 kB +1.32% +3.36 kB 🔺
@sentry/nextjs (client) 47.22 kB +2.67% +1.22 kB 🔺
@sentry/sveltekit (client) 43.21 kB +3.02% +1.26 kB 🔺
@sentry/node-core 52.5 kB +1.75% +899 B 🔺
@sentry/node 164.33 kB +1.77% +2.85 kB 🔺
@sentry/node - without tracing 95.98 kB +3.18% +2.96 kB 🔺
@sentry/aws-serverless 111.24 kB +2.49% +2.7 kB 🔺

View base workflow run

github-actions[bot] avatar Oct 02 '25 15:10 github-actions[bot]

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 11,596 - 8,607 +35%
GET With Sentry 1,857 16% 1,699 +9%
GET With Sentry (error only) 7,938 68% 5,911 +34%
POST Baseline 1,221 - 1,176 +4%
POST With Sentry 569 47% 589 -3%
POST With Sentry (error only) 1,087 89% 1,039 +5%
MYSQL Baseline 4,089 - 3,259 +25%
MYSQL With Sentry 593 15% 449 +32%
MYSQL With Sentry (error only) 3,347 82% 2,664 +26%

View base workflow run

github-actions[bot] avatar Oct 02 '25 15:10 github-actions[bot]