Skip to content

fix(browser): Apply Http timing attributes to streamed http.client spans#19643

Open
Lms24 wants to merge 7 commits intolms/feat-span-firstfrom
lms/fix-http-client-request-timing-attributes
Open

fix(browser): Apply Http timing attributes to streamed http.client spans#19643
Lms24 wants to merge 7 commits intolms/feat-span-firstfrom
lms/fix-http-client-request-timing-attributes

Conversation

@Lms24
Copy link
Member

@Lms24 Lms24 commented Mar 5, 2026

This PR fixes a temporary bug in span streaming where we didn't add Http timing attributes (see #19613). We can fix this by following OTels approach:

  • delay the ending of http.client spans until either 300ms pass by or we receive the PerformanceResourceTiming entry with the respective timing information. Of course we end the span with the original timestamp then.
  • Unfortunately, we can only do this for streamed span because transaction-based spans cannot stay open longer than their parent (e.g. a pageload or navigation). Otherwise they'd get dropped. So we have to differentiate between the two modes here (RIP bundle size 😢)
  • To ensure we don't flush unnecessarily often, we also now delay flushing the span buffer for 500ms after a segment span ends. This slightly changed test semantics in a few integration tests because manually consecutively segments are now also sent in one envelope. This is completely fine (actually preferred) because we flush less often (i.e. fewer requests).

closes #19613

@Lms24 Lms24 changed the base branch from develop to lms/feat-span-first March 5, 2026 09:59
@Lms24 Lms24 changed the base branch from lms/feat-span-first to lms/test-span-streaming-browser-integration-tests March 5, 2026 10:00
@github-actions
Copy link
Contributor

github-actions bot commented Mar 5, 2026

size-limit report 📦

Path Size % Change Change
@sentry/browser 25.71 kB added added
@sentry/browser - with treeshaking flags 24.21 kB added added
@sentry/browser (incl. Tracing) 42.8 kB added added
@sentry/browser (incl. Tracing, Profiling) 47.48 kB added added
@sentry/browser (incl. Tracing, Replay) 81.63 kB added added
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 71.23 kB added added
@sentry/browser (incl. Tracing, Replay with Canvas) 86.3 kB added added
@sentry/browser (incl. Tracing, Replay, Feedback) 98.57 kB added added
@sentry/browser (incl. Feedback) 42.51 kB added added
@sentry/browser (incl. sendFeedback) 30.38 kB added added
@sentry/browser (incl. FeedbackAsync) 35.43 kB added added
@sentry/browser (incl. Metrics) 26.87 kB added added
@sentry/browser (incl. Logs) 27.02 kB added added
@sentry/browser (incl. Metrics & Logs) 27.69 kB added added
@sentry/react 27.47 kB added added
@sentry/react (incl. Tracing) 45.15 kB added added
@sentry/vue 30.37 kB added added
@sentry/vue (incl. Tracing) 44.68 kB added added
@sentry/svelte 25.74 kB added added
CDN Bundle 28.24 kB added added
CDN Bundle (incl. Tracing) 43.63 kB added added
CDN Bundle (incl. Logs, Metrics) 29.07 kB added added
CDN Bundle (incl. Tracing, Logs, Metrics) 44.48 kB added added
CDN Bundle (incl. Replay, Logs, Metrics) 68.17 kB added added
CDN Bundle (incl. Tracing, Replay) 80.46 kB added added
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 81.37 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback) 86 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 86.9 kB added added
CDN Bundle - uncompressed 82.55 kB added added
⛔️ CDN Bundle (incl. Tracing) - uncompressed (max: 129 kB) 129.13 kB added added
CDN Bundle (incl. Logs, Metrics) - uncompressed 85.38 kB added added
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 131.96 kB added added
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 209.05 kB added added
CDN Bundle (incl. Tracing, Replay) - uncompressed 246.01 kB added added
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 248.83 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 258.92 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 261.73 kB added added
@sentry/nextjs (client) 47.56 kB added added
@sentry/sveltekit (client) 43.27 kB added added
@sentry/node-core 52.32 kB added added
@sentry/node 174.99 kB added added
@sentry/node - without tracing 97.46 kB added added
@sentry/aws-serverless 113.27 kB added added

@github-actions
Copy link
Contributor

github-actions bot commented Mar 5, 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,316 - 9,268 +1%
GET With Sentry 1,658 18% 1,666 -0%
GET With Sentry (error only) 6,059 65% 6,140 -1%
POST Baseline 1,181 - 1,158 +2%
POST With Sentry 591 50% 561 +5%
POST With Sentry (error only) 1,042 88% 1,043 -0%
MYSQL Baseline 3,179 - 3,185 -0%
MYSQL With Sentry 458 14% 429 +7%
MYSQL With Sentry (error only) 2,578 81% 2,608 -1%

View base workflow run

@Lms24 Lms24 force-pushed the lms/test-span-streaming-browser-integration-tests branch from c28083a to 06bccc6 Compare March 6, 2026 10:19
Base automatically changed from lms/test-span-streaming-browser-integration-tests to lms/feat-span-first March 6, 2026 12:33
@Lms24 Lms24 force-pushed the lms/fix-http-client-request-timing-attributes branch from bfee1f9 to 6b0eb4f Compare March 6, 2026 13:10
@Lms24 Lms24 marked this pull request as ready for review March 6, 2026 13:16
@Lms24 Lms24 requested review from JPeer264, andreiborza and s1gr1d March 6, 2026 13:16
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.

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