Skip to content

feat(browser): opt-in long animation frame and slow interaction spans - #1158

Merged
Makisuo merged 6 commits into
feat/browser-sdk-network-canvasfrom
feat/browser-sdk-long-frames
Sep 29, 2026
Merged

Makisuo merged 6 commits into
feat/browser-sdk-network-canvasfrom
feat/browser-sdk-long-frames

fix(browser): read long-frame script attribution through the prototype

f8588b2
Select commit
Loading
Failed to load commit list.
Maple Review Bot / Maple / review succeeded Sep 29, 2026 in 2m 14s

Confidence 4/5 · No issues found

Confidence 4/5 · likely safe to merge
The perf spans reuse the existing tracer, sampler and consent gate, and the browser tests exercise a real slow click and the LoAF fallback.
quality 100/100 · no findings · tests covered · risk medium · 2/2 new units observable

Adds two opt-in browser tracing sources: longAnimationFrame/longtask spans for frames ≥100ms (with script attribution) and interaction <event> spans for interactions ≥200ms, both buffered and nested under the open navigation span. Contained, tested, safe to merge.

  • startPerf observes long frames and slow interactions in the deferred chunk
  • tracing.longFrames / tracing.slowInteractions config options (default false)
  • openNavigationSpan exported so perf spans nest under the navigation
  • selectorOf exported from @maple/browser-session for the interaction target

Fixed since the last review

  • F1 · captureHeaders JSDoc block now documents longFrames
What was checked
  • Sampling: perf spans come from liveMapleTracer, so they follow the provider's SessionSampler (tracing.ts:184)
  • Consent: spans are only created under hasConsent() and the exporter drops pre-consent start times (tracing.ts:78)
  • Threshold filter makes split event batches safe: a sub-200ms first entry is skipped before seen is written (perf.ts:148)
Observability coverage: 2 of 2 changes observable
Change Kind Observable Evidence
long-frame spans (longAnimationFrame / longtask fallback) span yes packages/browser/src/deferred/perf.ts:75-90 starts the span with maple.browser.frame.blocking_duration_ms, code.file.path, code.function.name, maple.browser.script.*
slow-interaction spans (interaction <event>) span yes packages/browser/src/deferred/perf.ts:112-123 starts the span with input delay / processing / presentation / target attributes

f8588b2 · Updated on every push. Reply "won't fix" to dismiss a finding, or mention @maple to ask about one.