forked from mtusi2026/mtusi2026lab6
fix: persist attachment SLO outcomes
This commit is contained in:
@@ -37,3 +37,61 @@ messenger_outbox:
|
||||
- oldest_pending_age_seconds:
|
||||
usage: GAUGE
|
||||
description: Age of the oldest unpublished outbox event.
|
||||
|
||||
messenger_attachment_terminal_transitions:
|
||||
query: |
|
||||
WITH statuses(status) AS (
|
||||
VALUES ('ready'), ('failed')
|
||||
)
|
||||
SELECT
|
||||
statuses.status,
|
||||
COUNT(events.job_id)::bigint AS total
|
||||
FROM statuses
|
||||
LEFT JOIN attachment_terminal_events events ON events.status = statuses.status
|
||||
GROUP BY statuses.status
|
||||
metrics:
|
||||
- status:
|
||||
usage: LABEL
|
||||
description: First terminal status recorded for a durable attachment job.
|
||||
- total:
|
||||
usage: COUNTER
|
||||
description: Durable attachment jobs whose first terminal outcome has this status.
|
||||
|
||||
messenger_attachment_time_to_ready_seconds:
|
||||
query: |
|
||||
WITH bounds(le, upper_bound) AS (
|
||||
VALUES
|
||||
('0.05', 0.05::double precision),
|
||||
('0.1', 0.1::double precision),
|
||||
('0.25', 0.25::double precision),
|
||||
('0.5', 0.5::double precision),
|
||||
('1', 1::double precision),
|
||||
('2.5', 2.5::double precision),
|
||||
('5', 5::double precision),
|
||||
('10', 10::double precision),
|
||||
('15', 15::double precision),
|
||||
('20', 20::double precision),
|
||||
('30', 30::double precision),
|
||||
('60', 60::double precision),
|
||||
('+Inf', NULL::double precision)
|
||||
)
|
||||
SELECT
|
||||
bounds.le,
|
||||
COUNT(events.job_id) FILTER (
|
||||
WHERE events.status = 'ready'
|
||||
AND (
|
||||
bounds.upper_bound IS NULL
|
||||
OR EXTRACT(EPOCH FROM (events.terminal_at - events.accepted_at)) <= bounds.upper_bound
|
||||
)
|
||||
)::bigint AS bucket
|
||||
FROM bounds
|
||||
LEFT JOIN attachment_terminal_events events ON events.status = 'ready'
|
||||
GROUP BY bounds.le, bounds.upper_bound
|
||||
ORDER BY bounds.upper_bound NULLS LAST
|
||||
metrics:
|
||||
- le:
|
||||
usage: LABEL
|
||||
description: Upper bound of the durable time-to-ready bucket in seconds.
|
||||
- bucket:
|
||||
usage: COUNTER
|
||||
description: Durable attachment jobs reaching ready within the bucket bound.
|
||||
|
||||
Reference in New Issue
Block a user