Description
From the Native histograms spec:
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.
If someone has a recording rule to record -histogram_test
where histogram_test
is a counter native histogram that has observations between sample, the resulting series would see a counter reset on each sample, creating a new chunk per every sample.
Some ways to deal with this:
- do nothing
- make the result a gauge
- mark the chunk as negative, but store the positive values to avoid resets
Related to #16576