1
0
mirror of https://github.com/prometheus/docs.git synced 2026-02-05 15:45:27 +01:00

Merge pull request #2706 from prometheus/beorn7/histogram

native histogram spec: Update section about unary minus
This commit is contained in:
Björn Rabenstein
2025-08-13 17:29:57 +02:00
committed by GitHub

View File

@@ -1746,11 +1746,15 @@ be found [below](#functions).
The unary minus can be used on native histograms. It returns a histogram where
all bucket populations and the count and the sum of observations have their
sign inverted. Everything else stays the same, including the counter reset
hint. Note, however, that explicit counter reset detection will be thrown off
by the inverted signs. (TODO: Maybe we should mark all negative histograms as
gauges?) Negative histograms do not really make sense on their own and are only
supposed to act as intermediate results inside other expressions.
sign inverted. The counter reset hint is set to `GaugeType` in any case.
Everything else stays the same. Enforcing `GaugeType` is needed because
explicit counter reset detection will be thrown off by the inverted sign.
Generally, histograms with negative bucket populations or a negative count of
observations do not really make sense on their own and are only supposed to act
as intermediate results inside other expressions. They are always considered
gauge histograms within PromQL and when stored as the result of a recording
rule.
### Binary operators