forked from mtusi2026/mtusi2026lab5
40 lines
1.2 KiB
YAML
40 lines
1.2 KiB
YAML
messenger_attachment_jobs:
|
|
query: |
|
|
WITH statuses(status) AS (
|
|
VALUES ('queued'), ('processing'), ('failed')
|
|
)
|
|
SELECT
|
|
statuses.status,
|
|
COUNT(j.id)::bigint AS count,
|
|
COALESCE(EXTRACT(EPOCH FROM (clock_timestamp() - MIN(j.created_at))), 0)::double precision AS oldest_age_seconds
|
|
FROM statuses
|
|
LEFT JOIN attachment_jobs j ON j.status = statuses.status
|
|
GROUP BY statuses.status
|
|
metrics:
|
|
- status:
|
|
usage: LABEL
|
|
description: Attachment job status.
|
|
- count:
|
|
usage: GAUGE
|
|
description: Attachment jobs in this status.
|
|
- oldest_age_seconds:
|
|
usage: GAUGE
|
|
description: Age of the oldest attachment job in this status.
|
|
|
|
messenger_outbox:
|
|
query: |
|
|
SELECT
|
|
COUNT(*) FILTER (WHERE published_at IS NULL)::bigint AS pending,
|
|
COALESCE(
|
|
EXTRACT(EPOCH FROM (clock_timestamp() - MIN(created_at) FILTER (WHERE published_at IS NULL))),
|
|
0
|
|
)::double precision AS oldest_pending_age_seconds
|
|
FROM outbox_events
|
|
metrics:
|
|
- pending:
|
|
usage: GAUGE
|
|
description: Unpublished outbox events.
|
|
- oldest_pending_age_seconds:
|
|
usage: GAUGE
|
|
description: Age of the oldest unpublished outbox event.
|