Repository navigation
test(browser): port browser tracing suites to span streaming - #24888
Conversation
size-limit report 📦
|
8d885e5 to
9849fe3
Compare
9849fe3 to
e483312
Compare
c0cc99e to
fa408e7
Compare
fa408e7 to
7436507
Compare
7436507 to
b0cd816
Compare
85274b7 to
5782a9a
Compare
Lms24
left a comment
There was a problem hiding this comment.
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' }); |
There was a problem hiding this comment.
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.
| 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); |
There was a problem hiding this comment.
l: should this be 2? (child and pageload)
| expect(spans.length).toBeGreaterThanOrEqual(1); | |
| expect(spans.length).toBeGreaterThanOrEqual(2); |
| discarded_events: [ | ||
| { | ||
| category: 'transaction', | ||
| category: 'span', |
There was a problem hiding this comment.
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', |
| await page.waitForTimeout(1000); | ||
| expect(txnsReceived).toEqual(0); | ||
| }); | ||
| expect(spansReceived).toHaveLength(0); |
There was a problem hiding this comment.
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.
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>
Co-Authored-By: GPT-6 <codex@openai.com>
40654a5 to
7bb14c7
Compare
There was a problem hiding this comment.
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.
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.
| [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: { | ||
| type: 'integer', | ||
| value: 1, | ||
| }, |
There was a problem hiding this comment.
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>

Exercise browserTracingIntegration with default span streaming, including low-cardinality names and children sent across envelopes. Retain the existing transaction counterparts as explicitly pinned
*-staticsuites 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