Documentation
¶
Overview ¶
Command dashboard-api is a read-only JSON API over a flywheel database — the shape an external dashboard service takes when it imports flywheel and reads the runtime's tables from its own database. It serves:
GET /running the jobs running now, slow ones flagged
GET /queues per-queue depth and lag
GET /finished the most recently finished jobs (?state=discarded&before=<finalized_at>,<id>)
GET /stats per-kind stats (?since=24h&kind=…&queue=…)
GET /series a trend series (?since=720h&interval=hour|day&kind=…&tz=America/New_York)
GET /anomalies the latest rolled hour's anomalies
GET /jobs/{id}/runs one job's attempts (?before_attempt=<attempt>)
A /finished cursor is the previous page's last job: its finalized_at exactly as the JSON carried it, a comma, and its id. URL-encode it — an RFC3339 offset such as +02:00 carries a '+', which a query string otherwise reads as a space (the handler restores one left unencoded, but a client should not rely on it).
It writes nothing and runs no runtime: the database's own flywheel deployment (a Node with a Scheduler whose StatsRollupInterval is set, or `flywheel serve`) keeps the rollups the history endpoints read. It opens the database read-only in spirit — nothing here calls a write API — so it can point at a replica.
go run ./examples/dashboard-api -db 'file:flywheel.db?_pragma=busy_timeout(5000)' go run ./examples/dashboard-api -db "$DATABASE_URL" -dialect postgres
See docs/INTEGRATING.md for what each endpoint costs and how often to poll it.