forked from mtusi2026/mtusi2026lab7
lab 7 openbao
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,15 @@
|
||||
global:
|
||||
scrape_interval: 15s
|
||||
evaluation_interval: 15s
|
||||
rule_files:
|
||||
- /etc/prometheus/alerts.yml
|
||||
scrape_configs:
|
||||
# App metrics arrive by remote write (push, mTLS). Only the Collector self-metrics (plain, internal) and Prometheus itself (TLS) are scraped.
|
||||
- job_name: otel-collector
|
||||
static_configs:
|
||||
- targets: ["otel-collector:8888"]
|
||||
- job_name: prometheus
|
||||
scheme: https
|
||||
tls_config: {ca_file: /pki/ca.crt, cert_file: /pki/tls.crt, key_file: /pki/tls.key, server_name: prometheus}
|
||||
static_configs:
|
||||
- targets: ["prometheus:9090"]
|
||||
@@ -0,0 +1,7 @@
|
||||
# Prometheus web TLS: mTLS - only clients with a certificate from our CA (collector remote-write, grafana, self-scrape).
|
||||
tls_server_config:
|
||||
cert_file: /pki/tls.crt
|
||||
key_file: /pki/tls.key
|
||||
client_ca_file: /pki/ca.crt
|
||||
client_auth_type: RequireAndVerifyClientCert
|
||||
min_version: TLS12
|
||||
Reference in New Issue
Block a user