Перенеси реализацию мессенджера из ЛР 6
Источник — проверенное рабочее дерево ЛР 6 поверх 18878d6, включая изменения после повторного ревью. SHA-256 списка исходных файлов: e45a3d85b41feff1da78dce3f20fd1f4af1c5ee629e6ed703218bc8e21ad58fe.
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
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"
|
||||
Reference in New Issue
Block a user