Files
mtusi2026lab6/infra/otel/prometheus-alerts.yaml
T

52 lines
2.1 KiB
YAML

groups:
- name: messenger-slo
rules:
- alert: MessengerApiHighErrorRate
expr: |
(
(sum(rate(http_server_request_duration_seconds_count{service_name="messenger-api",http_response_status_code=~"5..",http_route!~"/health/.*"}[5m])) or vector(0))
/
clamp_min(sum(rate(http_server_request_duration_seconds_count{service_name="messenger-api",http_route!~"/health/.*"}[5m])), 0.001)
) > 0.05
for: 2m
labels:
severity: warning
slo: api-availability
annotations:
summary: Messenger API 5xx ratio exceeds 5%
description: Five-minute 5xx ratio is above 5% for two minutes.
runbook: infra/otel/runbooks.md#api-high-error-rate
- alert: AttachmentQueueLagHigh
expr: messenger_queue_oldest_job_age_seconds{service_name="messenger-api"} > 60
for: 1m
labels:
severity: warning
slo: attachment-time-to-ready
annotations:
summary: Oldest attachment job is over 60 seconds old
description: The durable worker queue has not drained within the SLO threshold.
runbook: infra/otel/runbooks.md#queue-lag
- alert: AttachmentWorkerSaturated
expr: |
messenger_worker_busy{service_name="messenger-worker"}
/ clamp_min(messenger_worker_capacity{service_name="messenger-worker"}, 1) >= 1
for: 2m
labels:
severity: warning
annotations:
summary: All attachment workers are busy
description: Worker busy/capacity has remained at 100% for two minutes.
runbook: infra/otel/runbooks.md#worker-saturation
- alert: TelemetryExportFailures
expr: sum(rate(otelcol_exporter_send_failed_spans_total[5m])) + sum(rate(otelcol_exporter_send_failed_log_records_total[5m])) > 0
for: 1m
labels:
severity: info
annotations:
summary: Collector is dropping traces or logs
description: A telemetry backend is unavailable or rejecting data.
runbook: infra/otel/runbooks.md#telemetry-backend