2.0 KiB
2.0 KiB
098 — No histogram_quantile()-style percentile query
Summary
The PromQL layer's histogram() op buckets raw sample values by a
fixed width and returns per-bucket counts — it's unrelated to
Prometheus's classic histogram bucket/quantile model, and there's no
way to ask for p50/p95/p99 out of a metric today.
Where
src/engine/promql.rs:9-16—AggOp::Histogramis one of the six supported ops.src/engine/snapshot/mod.rs:1002onward —Histogramevaluation: buckets values bybucket_widthinto counts, grouped byby_labels. This answers "how many samples fell in each bucket", not "what value is the Nth percentile".- No
histogram_quantile()function or equivalent exists anywhere inpromql.rs's parser (parse_query,:261-324recognizes onlysum,avg,count,rate,histogram,gauge). - Depends on ticket 097 (gauge/counter semantics) for the broader question of whether a metric needs a declared "this holds raw observations for quantile purposes" flag, but quantile computation itself doesn't strictly require that — it can operate on whatever raw values are already stored in a metric's buckets.
Scope
- Decide the quantile computation model: interpolate over the raw stored sample values in a bucket/window (simplest, exact for the data actually retained) vs. building a genuine bucketed-histogram representation with configurable bucket boundaries (closer to Prometheus's classic histograms, more work, needed only if retained raw values are later dropped in favor of pre-aggregated buckets).
- Add a
histogram_quantile(p, metric[range])-shaped PromQL construct (or extendhistogram()with a quantile argument) topromql.rs's parser andAggOp, plus an evaluator insnapshot/mod.rsalongside the existingHistogramhandling. - Add dashboard/panel UI support for selecting a quantile once the
query-language side exists (
webapp/src/components/Dashboards.tsxor wherever panel query construction lives).