Repository navigation
feat(admin): real user monitoring (v1.19.0) - #104
Merged
Merged
Conversation
Adds the platform-admin Real user monitoring page (/admin/monitoring, INNOBOX_SPEC.md §14.12): page views and sessions per page, p75 LCP, INP, CLS, TTFB, navigation and API latency, API error rate and client errors, measured in people's browsers. - Collector in the authenticated app shell only; off by default, sampled once per tab, anonymous, route templates only. Hard-load vitals through web-vitals 5.3.0; per-view INP; fetch wrapper for the page's own /api calls (pollers excluded); deduplicated script errors. - POST /api/rum beacon: session-gated, own rate-limit bucket whose 429s stay out of the system log, discards everything while off, never stores a user id. - Migration 0052: rum_views (7-day raw), rum_daily (per-route rollup plus an all-routes row, kept forever), rum_client_errors (90 days), and the rum_enabled / rum_sample_rate settings. - Worker hourly sweep recomputes the open 7-day window, then trims. - 7d reads raw views (true p75); 30d, 90d and All blend daily p75 by views, as the page caption states. - Unit, live-DB and e2e tests.
CodeQL flagged the Firefox-frame check (/@\S+:\d+/) and the line:col split as polynomial on browser-supplied stacks such as a long run of '@'. Both are now string operations plus a single unambiguous trailing pattern, and only the first 20 stack lines, each cut to 1000 characters, are read at all. A unit test feeds 50 000-character hostile stacks.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
A new platform-admin page, Real user monitoring (
/admin/monitoring, INNOBOX_SPEC.md §14.12). It shows how InnoBox performs in people's browsers, page by page: views, sessions, p75 LCP, INP, CLS, TTFB, navigation time, the app's own API latency and failure rate, and script errors. The spec section was approved before implementation.1. Collection (off by default)
sessionStorage. The sample rate is 100 / 50 / 25 / 10 / 1 %.app/**/page.tsxand fails when a page is missing from the registry.web-vitals5.3.0 (new dependency, Apache-2.0, no NOTICE file). INP is per view, fromeventtiming entries.window.fetchwrapper around same-origin/apicalls. The shell's 30-second pulse, the beacon and/api/auth/*are excluded. Only 5xx, network failures and timeouts count as errors; a cancelled request is not counted.2. Beacon endpoint
POST /api/rumtakes a session, then the newrumrate-limit bucket (20 a minute), then the switch. While off it answers 204 and discards the body unread.unrecordedStatusesoption on the system-log wrapper keeps the beacon's 429s out of the system log.3. Storage and the worker (migration 0052)
rum_viewsholds raw views for 7 days.rum_dailyholds a per-route rollup plus an all-routes row, kept forever.rum_client_errorskeeps error rows 90 days past last seen.platform_settingskeys. A change writes onesettings.telemetry_changedaudit row; reads are not audited.4. The page
For reviewers
window.fetch, and how a non-Error promise rejection is recorded.pagehide/ hidden, not on the regular tick.rum_dailyhas no DELETE grant. Days outside the 7-day window are never recomputed, so there is nothing to delete.Testing
pnpm typecheckpasses.e2e/admin-monitoring.spec.tsturns collection on, posts a beacon, and switches it back off at the end.