Files
mtusi2026lab6/infra/prometheus/alerts.yml
T
2026-11-23 14:54:48 +03:00

29 lines
1.3 KiB
YAML

groups:
- name: messenger-slo-alerts
rules:
- alert: HighApiErrorRatio
expr: >
sum(rate(http_server_requests_total{service_name="messenger-api",http_route!~"/health/.*",http_response_status_class="5xx"}[1m]))
/ clamp_min(sum(rate(http_server_requests_total{service_name="messenger-api",http_route!~"/health/.*"}[1m])), 0.001) > 0.05
for: 15s
labels:
severity: critical
annotations:
summary: "High API 5xx error ratio (> 5%)"
runbook: "infra/otel/RUNBOOKS.md#1-high-api-5xx-error-ratio-messenger-high-5xx"
- alert: GrowingQueueLag
expr: max(worker_oldest_job_age_seconds{queue_name="attachment-jobs"}) > 15
for: 15s
labels:
severity: warning
annotations:
summary: "Oldest attachment job age exceeds 15s"
runbook: "infra/otel/RUNBOOKS.md#2-growing-queue-lag-messenger-queue-lag"
- alert: ApiLatencySloBreach
expr: histogram_quantile(0.95, sum by (le) (rate(http_server_request_duration_seconds_bucket{service_name="messenger-api",http_route!~"/health/.*"}[1m]))) > 0.5
for: 30s
labels:
severity: warning
annotations:
summary: "API p95 latency exceeds 500ms SLO"
runbook: "infra/otel/RUNBOOKS.md#3-api-p95-latency-slo-breach-messenger-latency-slo"