groups: - name: messenger rules: - record: lab:queue_snapshot:latest expr: topk(1, messenger_queue_snapshot_timestamp_seconds) - record: lab:http_count:30s expr: sum(increase(messenger_http_requests_total[30s])) - record: lab:http_bad_ratio:30s expr: (sum(increase(messenger_http_requests_total{status_class="5xx"}[30s])) or 0 * lab:http_count:30s) / lab:http_count:30s >= 0 - record: lab:ready_count:30s expr: max(messenger_ready_cohort_total_count{window="30s"} and on(job, instance) lab:queue_snapshot:latest) - record: lab:ready_bad_ratio:30s expr: max(messenger_ready_cohort_bad_count{window="30s"} and on(job, instance) lab:queue_snapshot:latest) / lab:ready_count:30s >= 0 - record: lab:http_count:2m expr: sum(increase(messenger_http_requests_total[2m])) - record: lab:http_bad_ratio:2m expr: (sum(increase(messenger_http_requests_total{status_class="5xx"}[2m])) or 0 * lab:http_count:2m) / lab:http_count:2m >= 0 - record: lab:ready_count:2m expr: max(messenger_ready_cohort_total_count{window="2m"} and on(job, instance) lab:queue_snapshot:latest) - record: lab:ready_bad_ratio:2m expr: max(messenger_ready_cohort_bad_count{window="2m"} and on(job, instance) lab:queue_snapshot:latest) / lab:ready_count:2m >= 0 - alert: HighHTTP5xx expr: lab:http_bad_ratio:30s > 0.20 and lab:http_count:30s >= 3 for: 10s annotations: summary: "Over 20% of business requests failed in 30 seconds." runbook: "infra/otel/README.md" - alert: QueueLag expr: max(messenger_queue_oldest_seconds and on(job, instance) lab:queue_snapshot:latest) > 15 for: 10s annotations: summary: "Oldest queued job has waited over 15 seconds." runbook: "infra/otel/README.md" - alert: APIAvailabilityBudgetBurn expr: lab:http_bad_ratio:30s > 0.20 and lab:http_bad_ratio:2m > 0.10 and lab:http_count:30s >= 3 and lab:http_count:2m >= 10 for: 10s annotations: summary: "API availability error budget is burning above 20x and 10x." runbook: "infra/otel/README.md" - alert: AttachmentReadyBudgetBurn expr: lab:ready_bad_ratio:30s > 0.20 and lab:ready_bad_ratio:2m > 0.10 and lab:ready_count:30s >= 3 and lab:ready_count:2m >= 10 for: 10s annotations: summary: "Ready deadline error budget is burning above 20x and 10x." runbook: "infra/otel/README.md"