Công Cụ Tính Ngân Sách Lỗi & Tốc Độ Tiêu Hao SLO
Mô phỏng tốc độ tiêu hao ngân sách lỗi (Error Budget) theo chuẩn Google SRE. Tính toán downtime cho phép và xuất mã cấu hình cảnh báo Prometheus & Grafana PromQL chuẩn production.
SLO Parameters
~1296.0M total requests in 30 days
Google SRE Multi-Window Multi-Burn-Rate Matrix
Eliminates alert fatigue by requiring both short and long rolling windows to exceed the burn rate threshold.
| Alert Severity | Burn Multiplier | Long Window | Short Window | Budget Impact |
|---|---|---|---|---|
| Critical (Page) | 14.4x | 1h | 5m | 2% budget in 1 hour |
| High (Page) | 6x | 6h | 30m | 5% budget in 6 hours |
| Medium (Ticket) | 3x | 1d | 2h | 10% budget in 3 days |
| Low (Log) | 1x | 3d | 6h | 10% budget in 3 days |
groups:
- name: checkout-api-slo-burn-rate-alerts
rules:
# Critical Page (Fast Burn) (2% budget in 1 hour)
- alert: checkout_api_SLOBurnRate_14_4x
expr: |
(
rate(http_requests_total{status=~"5.."}[1h])
/
rate(http_requests_total[1h])
) > (14.4 * 0.00100)
and
(
rate(http_requests_total{status=~"5.."}[5m])
/
rate(http_requests_total[5m])
) > (14.4 * 0.00100)
for: 2m
labels:
severity: critical
slo_target: "99.9%"
service: "checkout-api"
annotations:
summary: "High error budget burn rate (14.4x) for checkout-api"
description: "Service checkout-api is burning its 30-day error budget at 14.4x (threshold: >0.01440). Consuming 2% budget in 1 hour."
# High Severity Page (Moderate Burn) (5% budget in 6 hours)
- alert: checkout_api_SLOBurnRate_6x
expr: |
(
rate(http_requests_total{status=~"5.."}[6h])
/
rate(http_requests_total[6h])
) > (6 * 0.00100)
and
(
rate(http_requests_total{status=~"5.."}[30m])
/
rate(http_requests_total[30m])
) > (6 * 0.00100)
for: 2m
labels:
severity: critical
slo_target: "99.9%"
service: "checkout-api"
annotations:
summary: "High error budget burn rate (6x) for checkout-api"
description: "Service checkout-api is burning its 30-day error budget at 6x (threshold: >0.00600). Consuming 5% budget in 6 hours."
# Medium Ticket (Slow Burn) (10% budget in 3 days)
- alert: checkout_api_SLOBurnRate_3x
expr: |
(
rate(http_requests_total{status=~"5.."}[1d])
/
rate(http_requests_total[1d])
) > (3 * 0.00100)
and
(
rate(http_requests_total{status=~"5.."}[2h])
/
rate(http_requests_total[2h])
) > (3 * 0.00100)
for: 2m
labels:
severity: warning
slo_target: "99.9%"
service: "checkout-api"
annotations:
summary: "High error budget burn rate (3x) for checkout-api"
description: "Service checkout-api is burning its 30-day error budget at 3x (threshold: >0.00300). Consuming 10% budget in 3 days."
# Low Warning (Drift) (10% budget in 3 days)
- alert: checkout_api_SLOBurnRate_1x
expr: |
(
rate(http_requests_total{status=~"5.."}[3d])
/
rate(http_requests_total[3d])
) > (1 * 0.00100)
and
(
rate(http_requests_total{status=~"5.."}[6h])
/
rate(http_requests_total[6h])
) > (1 * 0.00100)
for: 2m
labels:
severity: warning
slo_target: "99.9%"
service: "checkout-api"
annotations:
summary: "High error budget burn rate (1x) for checkout-api"
description: "Service checkout-api is burning its 30-day error budget at 1x (threshold: >0.00100). Consuming 10% budget in 3 days."
Why Single-Window Burn Rate Alerts Fail in Production
Traditional alerts check a single rolling window (e.g. 5 minutes). If a brief traffic spike causes 50 errors in 1 minute, a 5-minute alert fires and wakes up the engineer, even if the system has already recovered. Conversely, a 30-day alert takes days to notice a severe 5% regression.
Google SRE’s Multi-Window Multi-Burn-Rate methodology requires that both a short window (e.g. 5 minutes) and a long window (e.g. 1 hour) simultaneously breach the burn rate threshold. This guarantees near-zero alert reset latency while completely eliminating false positives from ephemeral network blips.
Hướng dẫn sử dụng
- Bước 1: Chọn mục tiêu Service Level Objective (SLO, ví dụ 99.9% hoặc 99.95%) và chu kỳ đo lường (ví dụ 30 ngày).
- Bước 2: Nhập lưu lượng truy cập trung bình (RPS) để tính số lượng request lỗi tối đa cho phép.
- Bước 3: Mô phỏng tỷ lệ lỗi hiện tại để xem hệ số Burn Rate Multiplier và thời gian cạn kiệt ngân sách.
- Bước 4: Sao chép cấu hình Prometheus Alertmanager YAML hoặc truy vấn PromQL để tích hợp vào hạ tầng giám sát.
Câu hỏi thường gặp
Cảnh báo Multiwindow Multi-Burn-Rate là gì?
Hệ số Burn Rate Multiplier được tính như thế nào?
Thời gian downtime cho phép của SLO 99.9% so với 99.99% là bao nhiêu?
Tại sao nên cảnh báo theo Burn Rate thay vì số lượng lỗi 500 hay CPU thô?
The Senior Full-Stack Production Kit (2026)
Checklists, Docker recipes, and SSR error fixes in one dense PDF.
Bài viết liên quan
- High-Volume Distributed Tracing with OpenTelemetry, Kafka & ClickHouse
- The OpenTelemetry LGTM Stack: Loki, Grafana, Tempo & Mimir Production Guide
- Kubernetes Gateway API in Production: Migrating from Ingress-Nginx with Envoy
- Argo Rollouts & Prometheus: Automated Progressive Delivery & Analysis Templates