How do you test burn-rate alert rules before deploying them?
AdvancedConceptError Budgets & Burn-Rate Alerting
Answer
With promtool test rules and synthetic input series:
rule_files: [checkout-slo.rules.yaml]
evaluation_interval: 1m
tests:
- interval: 1m
input_series:
- series: 'http_requests_total{job="checkout",code="200"}'
values: '0+600x120'
- series: 'http_requests_total{job="checkout",code="503"}'
values: '0+120x120'
alert_rule_test:
- eval_time: 60m
alertname: CheckoutErrorBudgetBurnFast
exp_alerts:
- exp_labels: {severity: page, slo: checkout-availability}
Add a negative case (0.05% errors) that must produce exp_alerts: []. Run it in CI next to promtool check rules.
More on Error Budgets & Burn-Rate Alerting
What is an error budget and how do you calculate it?BeginnerWhat is an error-budget policy?BeginnerWhat happens when the error budget is exhausted? Is it a punishment?IntermediateWhat should you do if the error budget is never spent?IntermediateWhat is burn rate?IntermediateHow much budget does an alert at burn rate B over window W consume?Advanced