You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Vendored uPlot (~12 KB) from /admin/assets/uplot.min.js; no CDN
Use events snapshot or BEGIN IMMEDIATE for consistent reads during long aggregations
Tests: TTFB < 200 ms with 1M fixture events, query plans use indices, CSV parses cleanly in csv-parse
Acceptance criteria
Charts render in browser with 1M-event fixture in < 1s
CSV opens correctly in Excel/Numbers, no broken rows for models with commas
All queries on the dashboard hit indices (verified)
⚠️ Open question
Should CSV export be paginated (download in chunks) or a single streamed file? Recommended: streamed file (Bun handles this natively). Flag if you want pagination instead.
Part of #23. Depends on F1.D, F3.A.
Background
Operators need to see token spend by key × model × time without writing SQL.
Goal
/admin/usagerenders charts (requests/min, tokens/h, p95 latency/h) with filters for time range, key, and model; supports CSV export.Tasks
EXPLAIN QUERY PLANin tests/admin/usage/export.csv?…— streams rows for >1M-row windows; RFC 4180 quoting (per backend review [Epic] Admin Plane: model config, multi-key auth, usage dashboard, debug mode #23) so model names with commas don't break Excel/admin/assets/uplot.min.js; no CDNeventssnapshot orBEGIN IMMEDIATEfor consistent reads during long aggregationscsv-parseAcceptance criteria
Should CSV export be paginated (download in chunks) or a single streamed file? Recommended: streamed file (Bun handles this natively). Flag if you want pagination instead.
File pointers
src/admin/usage/{page,export}.tsx,src/admin/usage/queries.ts,tests/usage-queries.test.tssrc/admin/layout.tsxDependencies
Depends on F1.D, F3.A.