From 42ecae645b7da6f6cbe778d1817ad3abde66486f Mon Sep 17 00:00:00 2001 From: vasyukova Date: Sat, 24 Oct 2026 22:17:11 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB?= =?UTF-8?q?=D0=B0=20=D0=B4=D0=BB=D1=8F=20=D1=83=D1=80=D0=BE=D0=B2=D0=BD?= =?UTF-8?q?=D1=8F=204=20alert=20rules?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- infra/prometheus/rules/alerts.yaml | 44 ++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 infra/prometheus/rules/alerts.yaml diff --git a/infra/prometheus/rules/alerts.yaml b/infra/prometheus/rules/alerts.yaml new file mode 100644 index 0000000..4c027c6 --- /dev/null +++ b/infra/prometheus/rules/alerts.yaml @@ -0,0 +1,44 @@ +groups: + - name: messenger-alerts + interval: 30s + rules: + - alert: MessengerHighErrorRate + expr: | + sum(rate(http_requests_total{http_status_class="5xx"}[5m])) + / + sum(rate(http_requests_total[5m])) + > 0.05 + for: 2m + labels: + severity: warning + annotations: + summary: "API error rate > 5% over 5m" + description: "5xx ratio exceeds SLO 5% for 2 minutes." + runbook: "infra/runbooks/high-error-rate.md" + + - alert: MessengerJobsBacklogGrowing + expr: | + sum(increase(jobs_processed_total{outcome="retry"}[10m])) + > + sum(increase(jobs_processed_total{outcome="success"}[10m])) + + 5 + for: 5m + labels: + severity: warning + annotations: + summary: "Retries outpace successes" + description: "Worker retry count exceeds successes for 5m." + runbook: "infra/runbooks/queue-lag.md" + + - alert: MessengerUploadLatencyHigh + expr: | + histogram_quantile(0.95, + sum by (le, http_route) + (rate(http_request_duration_seconds_bucket{http_route=~"/api/v1/chats/.*/attachments"}[5m])) + ) > 2 + for: 3m + labels: + severity: warning + annotations: + summary: "p95 upload latency > 2s" + runbook: "infra/runbooks/slow-upload.md" \ No newline at end of file