prometheus/docs/querying
Michael Hoffmann d6d9f97bac
promql: histogram_fraction for bucket histograms (#16095)
* promql: histogram_fraction for bucket histograms

This PR extends the histogram_fraction function to also work with classic bucket histograms. This is beneficial because it allows expressions like sum(increase(my_bucket{le="0.5"}[10m]))/sum(increase(my_total[10m])) to be written without knowing the actual values of the "le" label, easing the transition to native histograms later on.
It also feels natural since histogram_quantile also can deal with classic histograms.

Signed-off-by: Michael Hoffmann <mhoffmann@cloudflare.com>

* promql: histogram_fraction for bucket histograms

* Add documentation and reduce code duplication
* Fix a bug in linear interpolation between bucket boundaries
* Add more PromQL tests

Signed-off-by: Michael Hoffmann <mhoffmann@cloudflare.com>

* Update docs/querying/functions.md

Co-authored-by: Björn Rabenstein <github@rabenste.in>
Signed-off-by: Michael Hoffmann <mhoffm@posteo.de>

---------

Signed-off-by: Michael Hoffmann <mhoffmann@cloudflare.com>
Signed-off-by: Michael Hoffmann <mhoffm@posteo.de>
Co-authored-by: Björn Rabenstein <github@rabenste.in>
2025-04-23 00:28:31 +02:00
..
api.md Fix typos (#16076) 2025-02-28 11:24:25 +11:00
basics.md docs: Update PromQL documentation to match the native histogram spec 2025-02-07 22:47:59 +01:00
examples.md docs: add regex section in querying basics 2024-11-24 22:03:04 +01:00
functions.md promql: histogram_fraction for bucket histograms (#16095) 2025-04-23 00:28:31 +02:00
index.md Import querying documentation from prometheus/docs 2017-10-26 22:36:47 +02:00
operators.md Clarify sorting behaviour of topk and bottomk. 2025-02-11 14:55:39 +11:00
remote_read_api.md storage: require selectors to always return matching results 2024-10-04 12:10:16 +02:00