# Alert rules (grade 4). Local firing/resolved state only; no external delivery. # Error ratio excludes health endpoints and 4xx (client mistakes), so a wrong # password is not confused with a real server failure. groups: - name: messenger-sli rules: - alert: HighErrorRate expr: | ( sum(rate(http_server_requests_total{status_class="5xx",route!~".*health.*"}[5m])) / clamp_min(sum(rate(http_server_requests_total{route!~".*health.*"}[5m])), 1) ) > 0.05 for: 2m labels: severity: warning annotations: summary: "API 5xx ratio above 5% of business requests" description: "5xx / business requests > 5% for 2 minutes. Runbook: docs in REPORT.md (incident 2)." - alert: QueueLagGrowing expr: messenger_queue_oldest_job_age_seconds > 30 for: 2m labels: severity: warning annotations: summary: "Oldest queued attachment job is older than 30s" description: "Backlog is not draining (worker down or overloaded). Runbook: REPORT.md incident 1." - alert: QueueDepthHigh expr: messenger_queue_depth > 20 for: 2m labels: severity: info annotations: summary: "Attachment queue depth above 20" description: "Sustained backlog; check worker capacity and processing time." - alert: WorkerInactive expr: max(messenger_worker_capacity) == 0 for: 1m labels: severity: warning annotations: summary: "No worker reporting capacity" description: "The worker is not exporting metrics (stopped or telemetry broken)."