Skip to content

test(browser): Add span streaming integration tests#19581

Open
Lms24 wants to merge 15 commits intolms/feat-span-firstfrom
lms/test-span-streaming-browser-integration-tests
Open

test(browser): Add span streaming integration tests#19581
Lms24 wants to merge 15 commits intolms/feat-span-firstfrom
lms/test-span-streaming-browser-integration-tests

Conversation

@Lms24
Copy link
Member

@Lms24 Lms24 commented Mar 2, 2026

This PR adds browser integration to test testing span streaming:

  • Added test helpers:
    • waitForStreamedSpan: Returns a promise of a single matching span
    • waitForStreamedSpans: Returns a promise of all spans in an array whenever the callback returns true
    • waitForStreamedSpanEnvelope: Returns an entire streamed span (v2) envelope (including headers)
    • observeStreamedSpan: Can be used to observe sent span envelopes without blocking the test if no envelopes are sent (good for testing that spans are not sent)
    • getSpanOp: Small helper to easily get the op of a span which we almost always need for the waitFor* function callbacks

Added 50+ tests, mostly converted from transaction integration tests around spans from browserTracingIntegration:

  • tests asserting the entire span v2 envelope payloads of manually started, pageload and navigation span trees
  • tests for trace linking and trace lifetime
  • tests for spans coming from browserTracingIntegration (fetch, xhr, long animation frame, long tasks)

Also, this PR fixes two bugs discovered through tests:

  • negatively sampled spans were still sent (because non-recording spans go through the same span life cycle)
  • cancelled spans received status error instead of ok. We want them to have status ok but an attribute detailing the cancellation reason.

Lastly, I discovered a problem with timing data on fetch and XHR spans. Will try to fix as a follow-up. Tracked in #19613

ref #17836

@Lms24 Lms24 changed the base branch from develop to lms/feat-span-first March 2, 2026 11:57
@github-actions
Copy link
Contributor

github-actions bot commented Mar 2, 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.72 kB added added
@sentry/browser (incl. Tracing, Profiling) 47.4 kB added added
@sentry/browser (incl. Tracing, Replay) 81.56 kB added added
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 71.17 kB added added
@sentry/browser (incl. Tracing, Replay with Canvas) 86.24 kB added added
@sentry/browser (incl. Tracing, Replay, Feedback) 98.48 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.07 kB added added
@sentry/vue 30.37 kB added added
@sentry/vue (incl. Tracing) 44.59 kB added added
@sentry/svelte 25.74 kB added added
CDN Bundle 28.24 kB added added
CDN Bundle (incl. Tracing) 43.56 kB added added
CDN Bundle (incl. Logs, Metrics) 29.07 kB added added
CDN Bundle (incl. Tracing, Logs, Metrics) 44.41 kB added added
CDN Bundle (incl. Replay, Logs, Metrics) 68.17 kB added added
CDN Bundle (incl. Tracing, Replay) 80.4 kB added added
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 81.3 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback) 85.94 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 86.83 kB added added
CDN Bundle - uncompressed 82.55 kB added added
CDN Bundle (incl. Tracing) - uncompressed 128.93 kB added added
CDN Bundle (incl. Logs, Metrics) - uncompressed 85.38 kB added added
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 131.76 kB added added
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 209.05 kB added added
CDN Bundle (incl. Tracing, Replay) - uncompressed 245.81 kB added added
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 248.63 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 258.73 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 261.54 kB added added
@sentry/nextjs (client) 47.48 kB added added
@sentry/sveltekit (client) 43.18 kB added added
@sentry/node-core 52.33 kB added added
@sentry/node 174.99 kB added added
@sentry/node - without tracing 97.47 kB added added
@sentry/aws-serverless 113.27 kB added added

@github-actions
Copy link
Contributor

github-actions bot commented Mar 2, 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 8,471 - - added
GET With Sentry 1,581 19% - added
GET With Sentry (error only) 5,715 67% - added
POST Baseline 1,146 - - added
POST With Sentry 517 45% - added
POST With Sentry (error only) 999 87% - added
MYSQL Baseline 3,130 - - added
MYSQL With Sentry 348 11% - added
MYSQL With Sentry (error only) 2,505 80% - added

@Lms24 Lms24 force-pushed the lms/test-span-streaming-browser-integration-tests branch from c2b23bf to e4011e4 Compare March 4, 2026 13:43
@Lms24 Lms24 self-assigned this Mar 4, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Mar 4, 2026

Codecov Results 📊


Generated by Codecov Action

@Lms24 Lms24 mentioned this pull request Mar 4, 2026
20 tasks
@Lms24 Lms24 force-pushed the lms/feat-span-first branch from 24015b1 to e5c1208 Compare March 4, 2026 14:20
@Lms24 Lms24 force-pushed the lms/test-span-streaming-browser-integration-tests branch from 4dbb4e3 to 9f490f4 Compare March 4, 2026 14:20
@Lms24 Lms24 marked this pull request as ready for review March 4, 2026 15:52
@Lms24 Lms24 requested review from JPeer264, andreiborza and s1gr1d March 4, 2026 15:52
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 1 potential issue.

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