groups: - name: lab6 interval: 2s rules: - alert: ApiHighErrorRate expr: | (sum(increase(http_server_requests_total{route=~"/api/v1/.*",status_class="5xx"}[30s])) / clamp_min(sum(increase(http_server_requests_total{route=~"/api/v1/.*"}[30s])), 1) > 0.05) and sum(increase(http_server_requests_total{route=~"/api/v1/.*"}[30s])) >= 3 for: 5s labels: severity: warning annotations: summary: "Business API 5xx ratio exceeds 5% over 30 seconds" description: "Exclude health and client errors. Inspect DB spans, db.error logs and pool waiting. See RUNBOOK.md." - alert: QueueLagGrowing expr: max(queue_oldest_age_seconds) > 15 and max(queue_depth) > 0 for: 5s labels: severity: warning annotations: summary: "Oldest accepted job has waited more than 15 seconds" description: "Inspect queue depth, worker capacity/busy and job traces. Restore worker and verify lag returns to zero. See RUNBOOK.md."