How would you alert on latency in a way that maps to an SLO?
IntermediateProductionAlerting Strategy, SLOs & Runbooks
Answer
Turn latency into a ratio: "fraction of requests slower than the threshold". With a histogram that has a bucket at the threshold:
1 - (
sum(rate(http_request_duration_seconds_bucket{job="api",le="0.3"}[5m]))
/
sum(rate(http_request_duration_seconds_count{job="api"}[5m]))
)
That is the bad-event ratio, which plugs straight into burn-rate alerts. Alerting on "p99 > 300ms" instead is noisier and cannot be summed into a budget. Make sure a bucket boundary sits exactly on the SLO threshold.
More on Alerting Strategy, SLOs & Runbooks
What is the single most important rule for deciding whether an alert should page a human?BeginnerWhat severity levels do you define, and where does each one go?BeginnerWhy do mature teams alert on SLO burn rate instead of raw error rate thresholds?IntermediateIn a multi-window burn-rate alert, what is the short window for?AdvancedHow do you generate SLO alert rules without hand-writing dozens of burn-rate expressions?IntermediateHow do you pick an SLO target for a service that has never had one?Beginner