groups: - name: messenger-lab6 interval: 5s rules: - alert: MessengerHighErrorRate expr: | ( sum(rate(messenger_http_requests_total{service_name="messenger-api",route!~"/health/.*",status_class="5xx"}[1m])) / clamp_min(sum(rate(messenger_http_requests_total{service_name="messenger-api",route!~"/health/.*"}[1m])), 1e-9) ) > 0.05 for: 10s labels: severity: warning annotations: summary: "Business API 5xx ratio exceeds 5%" description: "5xx / all business HTTP responses over 1 minute, continuously above 5% for 10 seconds. Health and client 4xx are not failures in this SLI." runbook: "infra/otel/RUNBOOK.md#api-errors" - alert: MessengerQueueLag expr: | max(messenger_queue_oldest_age_seconds{service_name="messenger-publisher"}) > 15 and max(messenger_queue_depth{service_name="messenger-publisher"}) > 0 and max(messenger_queue_sample_age_seconds{service_name="messenger-publisher"}) < 10 for: 10s labels: severity: warning annotations: summary: "Oldest unfinished attachment job exceeds 15 seconds" description: "Durable PostgreSQL backlog is nonempty and oldest job age is above 15 seconds for 10 seconds; the observer sample is less than 10 seconds old. This is queue age, not worker processing duration." runbook: "infra/otel/RUNBOOK.md#queue-lag"