forked from mtusi2026/mtusi2026lab6
lab 6 observability
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
groups:
|
||||
- name: messenger-slo
|
||||
rules:
|
||||
# SLI (availability): 1 - 5xx / all BUSINESS requests (health excluded; 4xx such as a wrong password are NOT errors).
|
||||
# SLO: 99 % over a rolling 30 days (error budget 1 %). Alert = fast symptom: >5 % 5xx for 1 m with real traffic.
|
||||
- alert: HighApiErrorRate
|
||||
expr: |
|
||||
(
|
||||
sum(rate(http_server_request_duration_seconds_count{service_name="messenger-api",http_response_status_class="5xx"}[2m]))
|
||||
/
|
||||
sum(rate(http_server_request_duration_seconds_count{service_name="messenger-api"}[2m]))
|
||||
) > 0.05
|
||||
and
|
||||
sum(rate(http_server_request_duration_seconds_count{service_name="messenger-api"}[2m])) > 0.2
|
||||
for: 1m
|
||||
labels:
|
||||
severity: page
|
||||
annotations:
|
||||
summary: "API 5xx ratio above 5 % (2m window)"
|
||||
description: "More than 5 % of business requests end with 5xx for 1 minute. Runbook: runbooks/high-error-rate.md"
|
||||
runbook: runbooks/high-error-rate.md
|
||||
# Queue lag: the oldest due job waits for a worker longer than 30 s for 1 m (worker stopped / too slow / broker problem).
|
||||
# Backlog (age of waiting jobs) is NOT processing latency: processing time is messenger_job_duration_seconds.
|
||||
- alert: QueueLagGrowing
|
||||
expr: max(messenger_queue_oldest_job_age_seconds{queue_name="attachment-jobs"}) > 30
|
||||
for: 1m
|
||||
labels:
|
||||
severity: page
|
||||
annotations:
|
||||
summary: "Oldest waiting job is older than 30 s"
|
||||
description: "Jobs wait for a worker. Check messenger_worker_busy/capacity, messenger_queue_depth and the worker logs. Runbook: runbooks/queue-lag.md"
|
||||
runbook: runbooks/queue-lag.md
|
||||
@@ -0,0 +1,14 @@
|
||||
global:
|
||||
scrape_interval: 15s
|
||||
evaluation_interval: 15s
|
||||
rule_files:
|
||||
- /etc/prometheus/alerts.yml
|
||||
scrape_configs:
|
||||
# Application metrics arrive by remote write from the Collector (push). Only the Collector's own health is scraped:
|
||||
# this is how telemetry LOSS is measured when a backend is down.
|
||||
- job_name: otel-collector
|
||||
static_configs:
|
||||
- targets: ["otel-collector:8888"]
|
||||
- job_name: prometheus
|
||||
static_configs:
|
||||
- targets: ["localhost:9090"]
|
||||
Reference in New Issue
Block a user