Dashboard-specific aggregation queries for the overview metrics page.
These are presentation-layer computations — time-windowed throughput,
success rates, duration percentiles — that don't belong in the Durable
runtime API (Durable.Query). They only read from the existing
WorkflowExecution and StepExecution schemas.
Summary
Functions
Duration percentiles (p50, p95, p99) from completed workflows in the window.
Queue depth — count of pending + running workflows per queue.
Status breakdown for the given time window.
Workflow throughput bucketed by 5-minute intervals.
Top failing workflow names in the last 24 hours.
Functions
Duration percentiles (p50, p95, p99) from completed workflows in the window.
Uses PostgreSQL's percentile_cont ordered-set aggregate function.
Returns %{p50: ms, p95: ms, p99: ms} or zeroed values if no data.
Queue depth — count of pending + running workflows per queue.
Returns %{"default" => 5, "priority" => 2}.
Status breakdown for the given time window.
Returns %{"completed" => N, "failed" => N, ...}.
Workflow throughput bucketed by 5-minute intervals.
Returns a list of %{time: iso8601, count: integer} maps ordered by time,
covering the last window_minutes.
Top failing workflow names in the last 24 hours.
Returns [%{name: "process_order", count: 12}, ...] ordered by count desc.