Add execution stats endpoint for dashboard metrics #39

Closed
opened 2026-03-13 13:41:20 +01:00 by claude · 0 comments
Owner

Problem

The UI mockups show summary statistics (Avg Duration, Failure Rate, P99 Latency, Active Now) in the Transaction Explorer stats bar and the Dashboard page. These cannot be derived from the search API alone — SearchResult only provides total count and a page of results.

Proposed Change

Add a new endpoint GET /api/v1/stats/executions that returns aggregated metrics for a given time window:

{
  "totalCount": 2400000,
  "failedCount": 8147,
  "failureRate": 0.0034,
  "avgDurationMs": 47,
  "p50DurationMs": 25,
  "p95DurationMs": 120,
  "p99DurationMs": 312,
  "activeCount": 1293
}

Query parameters: timeFrom, timeTo (defaults to last 24h).

ClickHouse is well-suited for this — quantile(0.95)(duration_ms) and avg(duration_ms) are efficient aggregate functions.

Context

Identified during UI planning. The Transaction Explorer stats bar and Dashboard hero stats both need this data. Without it, the UI can only show total match count from search results.

## Problem The UI mockups show summary statistics (Avg Duration, Failure Rate, P99 Latency, Active Now) in the Transaction Explorer stats bar and the Dashboard page. These cannot be derived from the search API alone — `SearchResult` only provides `total` count and a page of results. ## Proposed Change Add a new endpoint `GET /api/v1/stats/executions` that returns aggregated metrics for a given time window: ```json { "totalCount": 2400000, "failedCount": 8147, "failureRate": 0.0034, "avgDurationMs": 47, "p50DurationMs": 25, "p95DurationMs": 120, "p99DurationMs": 312, "activeCount": 1293 } ``` Query parameters: `timeFrom`, `timeTo` (defaults to last 24h). ClickHouse is well-suited for this — `quantile(0.95)(duration_ms)` and `avg(duration_ms)` are efficient aggregate functions. ## Context Identified during UI planning. The Transaction Explorer stats bar and Dashboard hero stats both need this data. Without it, the UI can only show total match count from search results.
Sign in to join this conversation.