Meaning
Computes an approximate percentile from a histogram metric by interpolating between bucket boundaries. Used in PromQL to derive latency or duration SLA indicators from histogram observations.
Primary Function
Metric analysis / Quantile estimation
Communicative Purpose
Derive a percentile value (e.g., 95th latency) from histogram data for monitoring and alerting.
Pattern
histogram_quantile(quantile, binned_metric)
Core Structure
histogram_quantile(..., ...)
Função primária
Metric analysis / Quantile estimation
Propósito comunicativo
Derive a percentile value (e.g., 95th latency) from histogram data for monitoring and alerting.
Situações de gatilho
When you need to calculate service latency percentiles from a histogram metric; when alerting on SLO burn rates; when summarizing distribution of observed durations.
Contextos
Prometheus monitoring systems, Grafana dashboards, alerting rules, service-level objective (SLO) calculations.
Padrão
histogram_quantile(quantile, binned_metric)
Estrutura central
histogram_quantile(..., ...)
Slots de substituição
quantile: float between 0 and 1 inclusive; binned_metric: instant vector of histogram bucket samples, typically an expression like rate(metric_bucket[5m]) or sum by (le)(metric_bucket).
Colocados típicos
- rate
- sum
- avg_over_time
- histogram
- bucket label (le)
- alert expression.
Substituições comuns
- Using quantile_over_time on raw observations when raw samples are available
- using approx_quantile sketch in other systems.
Erros comuns
Applying histogram_quantile directly to a counter without rate, leading to increasing values; forgetting to aggregate across instances before quantile; using a summary metric instead of histogram.
Similar / contraste
quantile_over_time (works on raw series, not histogram); avg_over_time (average); histogram_fraction (fraction of observations <= threshold).
Interferências
Coming from SQL: thinking histogram_quantile behaves like percentile_approx; note it requires histogram buckets and works on instantaneous vectors.
Família do chunk
- histogram_fraction
- histogram_quantile
- quantile_over_time
- avg_over_time
Nuance
Result is approximate; accuracy depends on bucket resolution; requires histogram metric type; not suitable for summary metrics; must ensure time window alignment.
Efeito pragmático
Enables precise latency percentile monitoring and SLO measurement without storing raw observations.
Dica de memória
Think ‘histogram quantile slices buckets to estimate percentile’.
Nota
Ensure the bucket metric uses the 'le' label and that the time range of rate() matches the desired observation window to avoid skewed quantile estimates.
Upgrade path
Using histogram_quantile with multiple labels for multi-dimensional slicing, e.g., histogram_quantile(0.95, rate(http_requests_duration_seconds_bucket[5m]) by (le, handler)).
Log in to save chunks.