feat(observability): add product metrics for API, outbox and delivery
This commit is contained in:
1 parent
560724e2aa
commit
94488e2b57
51 files changed
+3655
-68
No files matched your search
@@ -219,3 +219,19 @@ WHERE
|
||||
AND kind = sqlc.arg(kind)
|
||||
ORDER BY created_at DESC, id DESC
|
||||
LIMIT 1;
|
||||
|
||||
-- Aggregates the deliveries by kind and status for the metrics, at most once
|
||||
-- per metrics interval. It reads only kind, status, and next_attempt_at,
|
||||
-- never an address, a body, or an ID. No index covers status, so it scans
|
||||
-- the table; add an index on (status) or keep per-status counters before
|
||||
-- the table holds millions of rows.
|
||||
-- name: GetDeliveryStatistics :many
|
||||
SELECT
|
||||
kind,
|
||||
status,
|
||||
count(*) AS deliveries,
|
||||
min(next_attempt_at) FILTER (
|
||||
WHERE status = 'pending'
|
||||
)::timestamptz AS earliest_pending_attempt_at
|
||||
FROM deliveries
|
||||
GROUP BY kind, status;
|
||||
Reference in new issue
Block a user