feat(browser)!: Extract performance.{mark,measure} spans into new userTimingSpansIntegration#22554
feat(browser)!: Extract performance.{mark,measure} spans into new userTimingSpansIntegration#22554msonnb wants to merge 2 commits into
performance.{mark,measure} spans into new userTimingSpansIntegration#22554Conversation
…userTimingSpansIntegration`
|
bugbot run |
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.
Reviewed by Cursor Bugbot for commit 5e11523. Configure here.
| }; | ||
|
|
||
| addPerformanceInstrumentationHandler('mark', handleEntries); | ||
| addPerformanceInstrumentationHandler('measure', handleEntries); |
There was a problem hiding this comment.
Async capture drops late spans
Medium Severity
userTimingSpansIntegration only creates spans when getActiveSpan() is set at PerformanceObserver callback time, but observe always defers that callback by a microtask. The old path collected mark/measure entries synchronously in beforeSpanEnd via performance.getEntries(), so entries that occurred during the pageload/navigation were not lost if the idle span ended in the meantime. Entries reported just before the root span ends can now be dropped.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 5e11523. Configure here.
|
|
||
| const spans = await spansPromise; | ||
| const userTimingSpans = spans.filter(span => ['mark', 'measure'].includes(getSpanOp(span) ?? '')); | ||
| expect(userTimingSpans).toHaveLength(3); |
There was a problem hiding this comment.
Streamed test wait is racy
Medium Severity
The streamed integration test resolves as soon as any envelope contains a pageload span, then asserts that mark/measure spans are in that same envelope. SpanBuffer can flush earlier on its per-trace interval or size limit, so User Timing spans may already have been sent in a previous envelope. This violates the Testing Conventions rule against race-prone waits that are not unique enough for the data under assertion.
Triggered by project rule: PR Review Guidelines for Cursor Bot
Reviewed by Cursor Bugbot for commit 5e11523. Configure here.
size-limit report 📦
|


What?
browserTracingIntegrationno longer capturesperformance.mark()/performance.measure()spans by default. This behavior moves into a new opt-inuserTimingSpansIntegration, and theignorePerformanceApiSpansoption is replaced by the integration'signoreoption.Why?
User Timing spans are useful for some apps and pure noise for others (browser extensions and third-party libraries emit their own mark/measure entries). Bundling them into
browserTracingIntegrationmeant everyone paid the bundle-size and span-volume cost whether they wanted the data or not, and the only escape hatch was an ignore-list. Making it a separate, explicitly-added integration means you opt in when you want it, and it drops out of the tree-shaken bundle when you don't.Closes #22352