groups: - name: lab6-slo interval: 3s rules: - record: messenger:api_error_ratio:15s expr: sum(rate(http_server_requests_total{service_name="messenger-api",status_class="5xx"}[15s])) / clamp_min(sum(rate(http_server_requests_total{service_name="messenger-api"}[15s])), 0.001) - record: messenger:api_error_ratio:60s expr: sum(rate(http_server_requests_total{service_name="messenger-api",status_class="5xx"}[60s])) / clamp_min(sum(rate(http_server_requests_total{service_name="messenger-api"}[60s])), 0.001) - alert: APIHighErrorRate expr: messenger:api_error_ratio:15s > 0.05 for: 6s labels: {severity: warning} annotations: summary: Business API 5xx exceeds 5 percent over 15 seconds runbook_url: https://localhost:3007/d/messenger-lab7 description: See RUNBOOK.md. Use storage.failure logs and db spans to distinguish DB failure from handler latency. - alert: APIErrorBudgetBurn expr: (messenger:api_error_ratio:15s / 0.01 > 6) and (messenger:api_error_ratio:60s / 0.01 > 6) for: 10s labels: {severity: critical} annotations: summary: API 99 percent SLO consumes budget at more than 6x in both windows description: Educational compressed windows 15s and 60s; see RUNBOOK.md for production limitations. - alert: QueueLagGrowing expr: max(queue_oldest_age_seconds{service_name="messenger-publisher"}) > 10 and max(deriv(queue_oldest_age_seconds{service_name="messenger-publisher"}[15s])) > 0.1 for: 6s labels: {severity: warning} annotations: summary: Durable backlog age exceeds 10 seconds and grows description: Check worker busy/capacity, job completions, consumer logs and trace. Restore worker and verify backlog drains. - alert: ReadyErrorBudgetBurn expr: ((sum(rate(attachment_ready_duration_seconds_count[15s])) - sum(rate(attachment_ready_duration_seconds_bucket{le="10"}[15s]))) / clamp_min(sum(rate(attachment_ready_duration_seconds_count[15s])),0.001) / 0.05 > 3) and ((sum(rate(attachment_ready_duration_seconds_count[60s])) - sum(rate(attachment_ready_duration_seconds_bucket{le="10"}[60s]))) / clamp_min(sum(rate(attachment_ready_duration_seconds_count[60s])),0.001) / 0.05 > 3) for: 6s labels: {severity: warning} annotations: summary: Ready within 10s SLO budget burns in both windows description: Completed-job SLI has survivorship delay; QueueLagGrowing covers uncompleted jobs. See RUNBOOK.md.