Practical Anomaly Detection using Prometheus
summary
Uses Prometheus recording rules and PromQL to flag anomalies by computing z-score over a week (~10k samples) from avg_over_time and stddev_over_time, applied at the service level by aggregating job+environment so anomalies remain attributable. Adds a seasonal predictor using offsets (166h) and a three-week quantile median to avoid holiday distortion (offset 166h seasonal prediction). Works in production on GitLab traffic (reliable at ~150 RPS and up), and routes signals to Slack as non-paging alerts.
AI-written summary · about
chapters (15)
- 0:00Introduction to anomaly detection
- 1:09Why anomaly detection matters
- 3:18Choosing the right aggregation level
- 5:06Quick stats recap on distributions
- 7:15Calculating Z-scores in Prometheus
- 9:21Visualizing anomaly boundaries
- 10:23Testing for normal distributions
- 12:04Leveraging seasonality in metrics
- 15:16Predicting seasonal values
- 17:28Combining multiple predictions
- 19:16Adapting Z-scores for seasonality
- 20:46Setting alert thresholds
- 21:28Presenting anomaly data in dashboards
- 22:31Key takeaways and conclusion
- 23:13Q&A session
