Choose histogram bucket boundaries for a service with a 300 ms latency SLO.
AdvancedScenarioPrometheus and PromQL at Scale
Answer
Situation read → histogram_quantile interpolates inside a bucket, so accuracy depends on bucket layout. Default buckets (0.005 to 10) waste resolution near your SLO.
What I'd do →
- Put a bucket exactly at 0.3 so the SLO ratio is exact:
rate(..._bucket{le="0.3"}) / rate(..._count). - Add dense buckets around the target:
0.05, 0.1, 0.2, 0.25, 0.3, 0.35, 0.4, 0.5, 0.75, 1, 2.5, 5. - Keep the number of buckets modest (10–15), since each is a series multiplied by label combinations.
- Consider native histograms (Prometheus 3.x) which remove manual bucket choices.
Why → SLO compliance should come from exact bucket counts, not interpolation guesses.
Interview tip → Mention that changing bucket boundaries later breaks aggregation across old and new series.
More on Prometheus and PromQL at Scale
Prometheus memory has grown to 60 GB and keeps climbing. How do you find the cause?IntermediateA developer added `user_id` as a metric label. What is the problem and what do you advise?BeginnerYour dashboard shows the average of per-pod p99 latencies. Why is it wrong, and how do you compute a correct fleet-wide p99?IntermediateYou have 500 short-lived batch jobs that finish before Prometheus can scrape them. How do you capture their metrics?IntermediateYour EC2 fleet autoscales constantly. How do you keep Prometheus targets up to date?IntermediateYou run 3 Kubernetes clusters. Compare federation, remote_write and Thanos sidecar for a global view.Advanced