Skip to content

test(browser): port browser tracing suites to span streaming - #24888

Open
msonnb wants to merge 5 commits into
ms/browser-tests-trace-semanticsfrom
ms/browser-tests-browser-tracing
Open

msonnb wants to merge 5 commits into
ms/browser-tests-trace-semanticsfrom
ms/browser-tests-browser-tracing

Conversation

@msonnb

@msonnb msonnb commented Sep 30, 2026 •

Copy link
Copy Markdown
Member

Exercise browserTracingIntegration with default span streaming, including low-cardinality names and children sent across envelopes. Retain the existing transaction counterparts as explicitly pinned *-static suites to preserve compatibility coverage for navigation, pageloads, linked traces, timing, and sampling.

Stacked on #24881 for the shared span collector and dynamic sampling context helpers.

Fixes #24142

@msonnb
msonnb added this pull request to stack #24891 September 30, 2026 12:22
@github-actions

github-actions Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size % Change Change
@sentry/browser 29.6 kB - -
@sentry/browser - with treeshaking flags 27.75 kB - -
@sentry/browser - with treeshaking flags tracing without tracing 27.65 kB - -
@sentry/browser (incl. Tracing) 51.52 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 51.52 kB - -
@sentry/browser (incl. Tracing, Profiling) 54.5 kB - -
@sentry/browser (incl. Tracing, Replay) 91.23 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 80.18 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 95.93 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 108.89 kB - -
@sentry/browser (incl. Feedback) 47.12 kB - -
@sentry/browser (incl. sendFeedback) 34.65 kB - -
@sentry/browser (incl. FeedbackAsync) 39.76 kB - -
@sentry/browser (incl. Metrics) 30.61 kB - -
@sentry/browser (incl. Logs) 30.89 kB - -
@sentry/browser (incl. Metrics & Logs) 31.55 kB - -
@sentry/react 31.43 kB - -
@sentry/react (incl. Tracing) 53.84 kB - -
@sentry/vue 37.55 kB - -
@sentry/vue (incl. Tracing) 54.4 kB - -
@sentry/svelte 29.63 kB - -
@sentry/remix (Remix 3 client bundle) 56.54 kB - -
CDN Bundle 31.33 kB - -
CDN Bundle (incl. Tracing) 52.07 kB - -
CDN Bundle (incl. Logs, Metrics) 33.56 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 54.03 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 74.38 kB - -
CDN Bundle (incl. Tracing, Replay) 89.74 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 91.69 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 95.9 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 97.87 kB - -
CDN Bundle - uncompressed 92.46 kB - -
CDN Bundle (incl. Tracing) - uncompressed 154.77 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 99.04 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 160.72 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 228.98 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 274.89 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 280.83 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 288.59 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 294.52 kB - -
@sentry/nextjs (client) 56.19 kB - -
@sentry/sveltekit (client) 51.9 kB - -
@sentry/core/server 40.65 kB - -
@sentry/core/browser 13.51 kB - -
@sentry/node 145.57 kB +0.01% +4 B 🔺
@sentry/node/import (ESM hook with diagnostics-channel injection) 83.22 kB - -
@sentry/node - without tracing 93.46 kB +0.01% +1 B 🔺
@sentry/node - without channel injection 123.73 kB +0.02% +15 B 🔺
@sentry/aws-serverless 101.69 kB - -
@sentry/cloudflare (withSentry) - minified 209.03 kB - -
@sentry/cloudflare (withSentry) 517.8 kB - -

View base workflow run

@msonnb
msonnb force-pushed the ms/browser-tests-browser-tracing branch from 8d885e5 to 9849fe3 Compare October 5, 2026 07:41
@msonnb
msonnb force-pushed the ms/browser-tests-browser-tracing branch from 9849fe3 to e483312 Compare October 5, 2026 09:10
@msonnb
msonnb force-pushed the ms/browser-tests-browser-tracing branch 2 times, most recently from c0cc99e to fa408e7 Compare October 7, 2026 11:24
@msonnb
msonnb force-pushed the ms/browser-tests-browser-tracing branch from fa408e7 to 7436507 Compare October 7, 2026 11:27
@msonnb
msonnb marked this pull request as ready for review October 7, 2026 12:32
@msonnb
msonnb requested a review from a team as a code owner October 7, 2026 12:32
@msonnb
msonnb requested review from Lms24 and logaretm and removed request for a team October 7, 2026 12:32

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

Stale Bugbot comment from a previous run.

@msonnb
msonnb force-pushed the ms/browser-tests-browser-tracing branch from 7436507 to b0cd816 Compare October 7, 2026 12:50

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

Stale Bugbot comment from a previous run.

msonnb and others added 3 commits October 7, 2026 15:12
Co-Authored-By: GPT-6 <codex@openai.com>
Co-Authored-By: GPT-6 <codex@openai.com>
Co-Authored-By: GPT-6 <codex@openai.com>
@msonnb
msonnb force-pushed the ms/browser-tests-browser-tracing branch from 85274b7 to 5782a9a Compare October 7, 2026 13:12

@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 4 potential issues.

There are 5 total unresolved issues (including 1 from previous review).

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 5782a9a. Configure here.

Comment on lines 14 to 18

const pageloadTransaction = await getFirstSentryEnvelopeRequest<Event>(page);

expect(pageloadTransaction.contexts?.trace?.op).toBe('pageload');
expect(pageloadTransaction.contexts?.trace?.status).toBe('cancelled');
expect(pageloadTransaction.contexts?.trace?.data?.['sentry.cancellation_reason']).toBe('document.hidden');
expect(getSpanOp(pageloadSpan)).toBe('pageload');
expect(pageloadSpan.status).toBe('ok');
expect(pageloadSpan.attributes['sentry.cancellation_reason']?.value).toBe('document.hidden');
});

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Bug: The backgroundtab-pageload streaming test incorrectly asserts the pageload span status is 'ok'. It should expect 'cancelled' when the tab is backgrounded.
Severity: LOW

Suggested Fix

In the backgroundtab-pageload test, change the assertion from expect(pageloadSpan.status).toBe('ok') to expect(pageloadSpan.status).toBe('cancelled'). This will align the test with the actual behavior of the registerBackgroundTabDetection function and the corresponding static test.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.

Location:
dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/backgroundtab-pageload/test.ts#L14-L18

Potential issue: The streaming `backgroundtab-pageload` test incorrectly expects a
pageload span to have a status of `'ok'` after the page is moved to the background. The
`registerBackgroundTabDetection` function is designed to change the span's status from
`'ok'` to `'cancelled'` in this scenario before the span is ended and streamed. As a
result, the test assertion `expect(pageloadSpan.status).toBe('ok')` will fail because
the actual status will be `'cancelled'`. This is confirmed by an equivalent static test
which correctly asserts the status is `'cancelled'`.

Did we get this right? 👍 / 👎 to inform future reviews.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

streamed spans map cancelled to ok

msonnb and others added 2 commits October 7, 2026 15:25

This branch has not been deployed

No deployments
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.

browser-integration-tests: port browserTracingIntegration suites to span streaming

2 participants