Skip to content

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

Merged
msonnb merged 7 commits into
ms/browser-tests-trace-semanticsfrom
ms/browser-tests-browser-tracing
Oct 9, 2026
Merged

msonnb merged 7 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 📦

⚠️ Warning: Base artifact is not the latest one, because the latest workflow run is not done yet. This may lead to incorrect results. Try to re-run all tests to get up to date results.

Path Size % Change Change
@sentry/browser 29.8 kB - -
@sentry/browser - with treeshaking flags 27.92 kB - -
@sentry/browser - with treeshaking flags tracing without tracing 27.84 kB - -
@sentry/browser (incl. Tracing) 51.85 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 51.87 kB - -
@sentry/browser (incl. Tracing, Profiling) 54.8 kB - -
@sentry/browser (incl. Tracing, Replay) 91.58 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 80.45 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 96.29 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 109.27 kB - -
@sentry/browser (incl. Feedback) 47.32 kB - -
@sentry/browser (incl. sendFeedback) 34.84 kB - -
@sentry/browser (incl. FeedbackAsync) 39.95 kB - -
@sentry/browser (incl. Metrics) 30.82 kB - -
@sentry/browser (incl. Logs) 31.11 kB - -
@sentry/browser (incl. Metrics & Logs) 31.75 kB - -
@sentry/react 31.63 kB - -
@sentry/react (incl. Tracing) 54.17 kB - -
@sentry/vue 37.84 kB - -
@sentry/vue (incl. Tracing) 54.78 kB - -
@sentry/svelte 29.83 kB - -
@sentry/remix (Remix 3 client bundle) 56.83 kB - -
CDN Bundle 31.53 kB - -
CDN Bundle (incl. Tracing) 52.34 kB - -
CDN Bundle (incl. Logs, Metrics) 33.72 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 54.3 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 74.65 kB - -
CDN Bundle (incl. Tracing, Replay) 90.01 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 91.96 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 96.17 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 98.15 kB - -
CDN Bundle - uncompressed 92.92 kB - -
CDN Bundle (incl. Tracing) - uncompressed 155.46 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 99.46 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 161.41 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 229.5 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 275.63 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 281.57 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 289.33 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 295.26 kB - -
@sentry/nextjs (client) 56.53 kB - -
@sentry/sveltekit (client) 52.23 kB - -
@sentry/core/server 40.86 kB - -
@sentry/core/browser 13.71 kB - -
@sentry/node 150.99 kB +0.01% +7 B 🔺
@sentry/node/import (ESM hook with diagnostics-channel injection) 83.59 kB - -
@sentry/node - without tracing 94.01 kB +0.01% +5 B 🔺
@sentry/node - without channel injection 129.16 kB +0.01% +12 B 🔺
@sentry/aws-serverless 102.17 kB +0.01% +7 B 🔺
@sentry/cloudflare (withSentry) - minified 209.81 kB - -
@sentry/cloudflare (withSentry) 520.23 kB - -
@sentry/nextjs/cloudflare (withSentry) - minified 227.48 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
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.

Stale Bugbot comment from a previous run.

@Lms24 Lms24 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

just some optional improvement suggestions and a bug which we should address separately

});

expect(traceContextData![SEMANTIC_ATTRIBUTE_SENTRY_CUSTOM_SPAN_NAME]).toBeUndefined();
expect(attributes[SEMANTIC_ATTRIBUTE_SENTRY_CUSTOM_SPAN_NAME]).toEqual({ type: 'string', value: 'new name' });

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

m: This is a bug. this attribute shouldn't be sent along. I'm fine with merging this PR first and fixing it in a follow-up, so not a blocker for this PR!

on that note, we likely need to remove the attribute in another code path than we already do for transactions, so I'd argue we should keep this test around in both variants, static and streamed.

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.

added #25212 to the stack to fix

const testSpan = eventData.spans?.find(span => span.description === 'pageload-child-span');
expect(getSpanOp(pageloadSpan)).toBe('pageload');
expect(pageloadSpan.attributes['sentry.idle_span_discarded_spans']).toBeUndefined();
expect(spans.length).toBeGreaterThanOrEqual(1);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

l: should this be 2? (child and pageload)

Suggested change
expect(spans.length).toBeGreaterThanOrEqual(1);
expect(spans.length).toBeGreaterThanOrEqual(2);

discarded_events: [
{
category: 'transaction',
category: 'span',

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

l: this could be flaky since the navigation span here could include child spans. probably fine to assert on quantity equalOrGreater than 1

discarded_events: [
{
category: 'transaction',
category: 'span',

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

l: same flakiness concern here

await page.waitForTimeout(1000);
expect(txnsReceived).toEqual(0);
});
expect(spansReceived).toHaveLength(0);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

l: this check now got a little weaker since we don't send the segments immediately when they finish but we wait for 500ms before flushing them. I think what we could do here is trigger a Sentry.flush() and then assert expect(spansReceived).toHaveLength(0); again.

msonnb and others added 5 commits October 9, 2026 10:44
Co-Authored-By: GPT-6 <codex@openai.com>
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 40654a5 to 7bb14c7 Compare October 9, 2026 08:49

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

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 7bb14c7. Configure here.

Comment on lines +162 to +165
[SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: {
type: 'integer',
value: 1,
},

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: Test assertions for SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE incorrectly hardcode the attribute type as 'integer', but the SDK can serialize it as 'double' for fractional sample rates.
Severity: LOW

Suggested Fix

Update the test assertion to be flexible about the number type. Instead of type: 'integer', use type: expect.stringMatching(/^(integer)|(double)$/) to correctly handle both integer and float sample rates.

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/pageload/test.ts#L162-L165

Potential issue: The test assertions for the `SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE`
attribute hardcode the expected type as `'integer'`. However, the SDK's serialization
logic in `getTypedAttributeValue()` uses `Number.isInteger()` to determine the type,
serializing non-integer numbers as `'double'`. Since the sample rate can be a float
(e.g., 0.5), this will cause the test to fail whenever a non-integer sample rate is
used. This is inconsistent with other numeric attributes in the same tests which
correctly expect the type to be either `'integer'` or `'double'`. This bug affects tests
for both pageload and navigation spans.

Also affects:

  • dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/navigation/test.ts:162~165

Co-Authored-By: OpenAI ChatGPT <codex@openai.com>
@msonnb
msonnb merged commit 8a92d0d into develop Oct 9, 2026
67 checks passed
@msonnb
msonnb deleted the ms/browser-tests-browser-tracing branch October 9, 2026 11:02
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

3 participants