forked from mtusi2026/mtusi2026lab7
33 lines
1.7 KiB
YAML
33 lines
1.7 KiB
YAML
groups:
|
|
- name: messenger-slo
|
|
rules:
|
|
# SLI (availability): 1 - 5xx / all BUSINESS requests (health excluded; 4xx such as a wrong password are NOT errors).
|
|
# SLO: 99 % over a rolling 30 days (error budget 1 %). Alert = fast symptom: >5 % 5xx for 1 m with real traffic.
|
|
- alert: HighApiErrorRate
|
|
expr: |
|
|
(
|
|
sum(rate(http_server_request_duration_seconds_count{service_name="messenger-api",http_response_status_class="5xx"}[2m]))
|
|
/
|
|
sum(rate(http_server_request_duration_seconds_count{service_name="messenger-api"}[2m]))
|
|
) > 0.05
|
|
and
|
|
sum(rate(http_server_request_duration_seconds_count{service_name="messenger-api"}[2m])) > 0.2
|
|
for: 1m
|
|
labels:
|
|
severity: page
|
|
annotations:
|
|
summary: "API 5xx ratio above 5 % (2m window)"
|
|
description: "More than 5 % of business requests end with 5xx for 1 minute. Runbook: runbooks/high-error-rate.md"
|
|
runbook: runbooks/high-error-rate.md
|
|
# Queue lag: the oldest due job waits for a worker longer than 30 s for 1 m (worker stopped / too slow / broker problem).
|
|
# Backlog (age of waiting jobs) is NOT processing latency: processing time is messenger_job_duration_seconds.
|
|
- alert: QueueLagGrowing
|
|
expr: max(messenger_queue_oldest_job_age_seconds{queue_name="attachment-jobs"}) > 30
|
|
for: 1m
|
|
labels:
|
|
severity: page
|
|
annotations:
|
|
summary: "Oldest waiting job is older than 30 s"
|
|
description: "Jobs wait for a worker. Check messenger_worker_busy/capacity, messenger_queue_depth and the worker logs. Runbook: runbooks/queue-lag.md"
|
|
runbook: runbooks/queue-lag.md
|