Лаб6 - оценка 4 fix

This commit is contained in:
Rakshasa2
2026-12-01 13:39:15 +03:00
parent 434e4b64a3
commit b6ed6780c5
8 changed files with 251 additions and 12 deletions
+33 -9
View File
@@ -5,28 +5,23 @@ groups:
- record: messenger:http_5xx_share:ratio2m
expr: |
(
sum(rate(messenger_http_responses_total{status_class="5xx"}[2m]))
sum(rate(http_server_request_duration_seconds_count{service_name="messenger-api",http_response_status_code=~"5..",http_route!~"/health/.*"}[2m]))
/
clamp_min(sum(rate(messenger_http_responses_total[2m])), 0.001)
clamp_min(sum(rate(http_server_request_duration_seconds_count{service_name="messenger-api",http_route!~"/health/.*"}[2m])), 0.001)
) or vector(0)
- record: messenger:worker_job_rate:by_status5m
expr: |
sum by (status) (rate(worker_jobs_processed_total[5m]))
or
max by (status) (worker_jobs_processed_total) * 0
- record: messenger:worker_job_duration_seconds:p95_5m
expr: |
histogram_quantile(0.95, sum by (le) (rate(worker_job_duration_seconds_bucket[5m])))
or vector(0)
- record: messenger:queue_depth
expr: max(attachment_jobs_queue_depth) or vector(0)
- record: messenger:collector_up
expr: max(up{job="otel-collector"}) or vector(0)
- name: messenger-slo
rules:
- alert: ApiHighErrorRate
@@ -36,6 +31,35 @@ groups:
severity: critical
slo: availability
annotations:
summary: "API 5xx share > 5% in 2m window"
summary: "API business 5xx share > 5% in 2m window"
description: "5xx share = {{ $value | humanizePercentage }}"
# ... остальные alert'ы без изменений
- alert: AttachmentQueueLagHigh
expr: attachment_jobs_oldest_age_seconds > 60
for: 1m
labels:
severity: warning
slo: freshness
annotations:
summary: "Oldest unfinished attachment job > 60s"
- alert: WorkerStalled
expr: |
attachment_jobs_queue_depth > 0
and
increase(worker_jobs_processed_total{status="done"}[10m]) == 0
for: 5m
labels:
severity: critical
slo: freshness
annotations:
summary: "Queue non-empty but no jobs completed in 10m"
- alert: ApiLatencyP95High
expr: |
histogram_quantile(0.95,
sum by (le) (rate(http_server_request_duration_seconds_bucket{service_name="messenger-api",http_route!~"/health/.*"}[5m]))
) > 0.5
for: 5m
labels:
severity: warning
slo: latency
annotations:
summary: "API p95 latency > 500ms"