Add 6 lab code

This commit is contained in:
2026-11-25 12:55:15 +03:00
parent 20afc2c790
commit f6882a77b4
56 changed files with 3570 additions and 0 deletions
+28
View File
@@ -0,0 +1,28 @@
groups:
- name: messenger
rules:
- record: messenger:http_error_ratio:2m
expr: |
(sum(rate(http_requests_total{service_name="messenger-api",status_class="5xx"}[2m])) or vector(0))
/ clamp_min(sum(rate(http_requests_total{service_name="messenger-api"}[2m])), 0.001)
- alert: ApiHighErrorRate
expr: messenger:http_error_ratio:2m > 0.05 and sum(increase(http_requests_total{service_name="messenger-api"}[2m])) >= 20
for: 20s
labels:
severity: warning
annotations:
summary: 'API: more than 5% server errors over 2 minutes'
description: 'SLI is 5xx / all non-health requests. At least 20 requests in the window.'
runbook: 'infra/otel/README.md#api-errors'
- alert: QueueLagHigh
expr: |
max(queue_oldest_age_seconds) > 30
and max(queue_depth) > 0
and time() - max(queue_sample_timestamp_seconds) < 15
for: 15s
labels:
severity: warning
annotations:
summary: 'Oldest queued attachment waits more than 30 seconds'
description: 'Check worker capacity/busy and job errors; backlog is sampled by dispatcher.'
runbook: 'infra/otel/README.md#queue-lag'