Documentation comes from this release commit, without inheriting newer content. Commit: cc3dd17e61.
Performance monitoring (screens, frames, hangs, songs)
Per-screen and per-song performance, measured natively by the backends, with nothing running or sent while a song plays.
What measures what
Off on purpose (JS-thread work per tick / per touch): enableStallTracking,
enableUserInteractionTracing, enableAutoPerformanceTracing.
Layers
src/core/performance-monitor/
- Port
PerformanceMonitor(startScreen,startSession,capabilities). A backend that already measures a thing natively declares it; the facade does not ask it for that thing. - Facade
PerfFacade(perf-facade.ts):screenFocused,sessionBegin,sessionEnd,pause/resume. Pure logic: sampling decided once per song, kill switch, circuit breaker (a monitor that throws once is dropped),sessionEnddeferred to the idle queue. - Adapters:
ErrorReportingPerformanceMonitor(Sentry, through theErrorReportingServiceport, so@sentry/react-nativestays in its one file),FirebasePerformanceMonitor(throughPerformanceService),NoopPerformanceMonitor,FakePerformanceMonitor. - Composition:
src/bootstrap/performance-monitor-setup.ts(called fromentrySetup.ts).EXPO_PUBLIC_PERF_MONITOR=0turns it off at build time. - UI:
useScreenViewTracking(route focus, app background) andusePerfSessioninPlayScreenBody/TutorialGameplayScreen(mount / unmount). Nothing else.
Not hurting gameplay
sessionBeginruns at mount (prepare, before the countdown),sessionEndat unmount; no call between.- Hot-path code (
src/features/piano/components, sprite engine, rhythm-engine) may not import the monitor or the SDKs —__tests__/hot-path.test.ts. - Sentry sends at span end; its own
tracesSampleRate(0.2) samples songs and screens. - Known limit: envelopes queued earlier can still be sent by Sentry's native thread during a song.
Not built yet
- A native frame recorder for backends without native frames (Firebase custom traces carry no frame data), MetricKit / Play Vitals, draw-FPS in production.
- Remote Config kill switch / sample rate (today: build-time env + constant).
- Sentry dashboards and alerts (Insights → Mobile; custom gameplay dashboard).
The gameplay hitch tracer (EXPO_PUBLIC_HITCH_TRACE) stays a debug tool and is unrelated.
Non-fatal errors (overview of failures the app survived)
reportNonFatal(area, error, context?) in src/core/utils/crashReporting.ts records a handled
error to Crashlytics (non-fatal) and Sentry, tagged area (+ short context). Capped at 3 per
(area, message) and 60 per process, never throws. Not for the gameplay loop.
Areas wired today: audio-sampler (piano sampler load), purchase (a purchase that threw, not a
cancel), media-store (fetch / download), remote-config (fetch), hub-bootstrap,
reinstall-restore, sfx (load). Existing reportCrash(..., HANDLED) sites (catalog, MIDI,
atlas, lazy route groups) are unchanged. Add a new area at any catch that today only logs.
Sentry metrics (dashboards / alerts)
ErrorReportingService.recordDistribution / recordCount → Sentry.metrics.* (SDK ≥ 7.8; buffered
and sent periodically by the SDK, never per call). Recorded after the fact only:
Not verified: the SDK's send interval (doc says only "periodically") and whether any metric is
flushed while a song plays — measure on a device. No beforeSendMetric kill switch is set; typings
in 8.34.0 do not expose it.