feat(browser): opt-in long animation frame and slow interaction spans - #1158
Merged
Makisuo merged 6 commits intoSep 29, 2026
Merged
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.
startPerfobserves long frames and slow interactions in the deferred chunktracing.longFrames/tracing.slowInteractionsconfig options (default false)openNavigationSpanexported so perf spans nest under the navigationselectorOfexported from@maple/browser-sessionfor the interaction target
Fixed since the last review
F1 ·captureHeadersJSDoc block now documentslongFrames
What was checked
- Sampling: perf spans come from
liveMapleTracer, so they follow the provider'sSessionSampler(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
seenis 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.
Loading