fix(site-call-audit): KPI snapshots as single conditional-aggregate queries (review 2026-10-21 06/PERF-3, 08/P3)
This commit is contained in:
@@ -209,6 +209,13 @@ mirroring the Notification Outbox KPI shape:
|
||||
- Stuck count — `Pending`/`Retrying` older than a configurable threshold
|
||||
(default 10 minutes); display-only, no escalation.
|
||||
|
||||
Each snapshot (global, per-site, per-node) is **one conditional-aggregation
|
||||
query** over the rows that contribute to at least one metric (non-terminal,
|
||||
Parked, or Delivered/Failed inside the interval), with the oldest-pending age a
|
||||
`MIN` over a `CASE` in the same scan — the same shape as the Notification
|
||||
Outbox repository. (It used to cost 7 / 6 / 6 sequential round trips, paid by
|
||||
the 10 s dashboard poll and the per-minute KPI sampler.)
|
||||
|
||||
## Retention
|
||||
|
||||
Daily purge of terminal rows (`Delivered`, `Failed`, `Discarded`) after a
|
||||
|
||||
Reference in New Issue
Block a user