groups: - name: messenger-recordings interval: 15s rules: - record: messenger:http_5xx_share:ratio2m expr: | ( sum(rate(http_server_request_duration_seconds_count{service_name="messenger-api",http_response_status_code=~"5..",http_route!~"/health/.*"}[2m])) / clamp_min(sum(rate(http_server_request_duration_seconds_count{service_name="messenger-api",http_route!~"/health/.*"}[2m])), 0.001) ) or vector(0) - record: messenger:worker_job_rate:by_status5m expr: | sum by (status) (rate(worker_jobs_processed_total[5m])) or max by (status) (worker_jobs_processed_total) * 0 - record: messenger:worker_job_duration_seconds:p95_5m expr: | histogram_quantile(0.95, sum by (le) (rate(worker_job_duration_seconds_bucket[5m]))) or vector(0) - record: messenger:queue_depth expr: max(attachment_jobs_queue_depth) or vector(0) - record: messenger:collector_up expr: max(up{job="otel-collector"}) or vector(0) - name: messenger-slo rules: - alert: ApiHighErrorRate expr: messenger:http_5xx_share:ratio2m > 0.05 for: 1m labels: severity: critical slo: availability annotations: summary: "API business 5xx share > 5% in 2m window" description: "5xx share = {{ $value | humanizePercentage }}" - alert: AttachmentQueueLagHigh expr: attachment_jobs_oldest_age_seconds > 60 for: 1m labels: severity: warning slo: freshness annotations: summary: "Oldest unfinished attachment job > 60s" - alert: WorkerStalled expr: | attachment_jobs_queue_depth > 0 and increase(worker_jobs_processed_total{status="done"}[10m]) == 0 for: 5m labels: severity: critical slo: freshness annotations: summary: "Queue non-empty but no jobs completed in 10m" - alert: ApiLatencyP95High expr: | histogram_quantile(0.95, sum by (le) (rate(http_server_request_duration_seconds_bucket{service_name="messenger-api",http_route!~"/health/.*"}[5m])) ) > 0.5 for: 5m labels: severity: warning slo: latency annotations: summary: "API p95 latency > 500ms"