groups: - name: messenger-slo interval: 10s rules: - record: messenger:api_5xx_ratio:rate5m expr: | (sum(rate(messenger_http_requests_total{status_class="5xx",http_route!~"/health/.*"}[5m])) or vector(0)) / clamp_min(sum(rate(messenger_http_requests_total{http_route!~"/health/.*"}[5m])), 1e-9) - record: messenger:api_availability:ratio7d expr: | 1 - (sum(increase(messenger_http_requests_total{status_class="5xx",http_route!~"/health/.*"}[7d])) or vector(0)) / clamp_min(sum(increase(messenger_http_requests_total{http_route!~"/health/.*"}[7d])), 1) - alert: MessengerApiErrorBudgetBurn expr: messenger:api_5xx_ratio:rate5m > 0.01 for: 2m labels: severity: warning annotations: summary: API error budget burn exceeds the 1% short-window budget description: The rolling 5-minute business API 5xx ratio is above 1%. runbook: Check API traces for the failing route, then inspect correlated logs and DB/S3 spans. - alert: MessengerQueueLag expr: max(messenger_queue_oldest_age_seconds) > 60 and max(messenger_queue_depth) > 0 for: 2m labels: severity: warning annotations: summary: Oldest attachment job has waited for more than 60 seconds description: Inspect worker availability, RabbitMQ health, and the worker trace for the oldest job. runbook: Check queue depth and age, worker consuming logs, broker, then recover the worker and confirm resolved state. - alert: MessengerDatabasePoolSaturation expr: max(messenger_db_pool_requests_waiting) > 0 for: 2m labels: severity: warning annotations: summary: Requests are waiting for a database connection description: Compare DB waiters with request traces and PostgreSQL health. runbook: Inspect DB spans and pool use; verify database health and connection limits.