mirror of
https://github.com/prometheus/prometheus.git
synced 2025-03-05 20:59:13 -08:00
histograms: Fix counter reset header during merging
See detailed discussion: https://github.com/prometheus/prometheus/pull/11864#issuecomment-1403963451 Signed-off-by: beorn7 <beorn@grafana.com>
This commit is contained in:
parent
1cfc8f65a3
commit
49c5b1fae4
|
@ -533,8 +533,12 @@ func (c *chainSampleIterator) AtFloatHistogram() (int64, *histogram.FloatHistogr
|
||||||
}
|
}
|
||||||
t, fh := c.curr.AtFloatHistogram()
|
t, fh := c.curr.AtFloatHistogram()
|
||||||
// If the current sample is not consecutive with the previous one, we
|
// If the current sample is not consecutive with the previous one, we
|
||||||
// cannot be sure anymore that there was no counter reset.
|
// cannot be sure anymore about counter resets for counter histograms.
|
||||||
if !c.consecutive && fh.CounterResetHint == histogram.NotCounterReset {
|
// TODO(beorn7): If a `NotCounterReset` sample is followed by a
|
||||||
|
// non-consecutive `CounterReset` sample, we could keep the hint as
|
||||||
|
// `CounterReset`. But then we needed to track the previous sample
|
||||||
|
// in more detail, which might not be worth it.
|
||||||
|
if !c.consecutive && fh.CounterResetHint != histogram.GaugeType {
|
||||||
fh.CounterResetHint = histogram.UnknownCounterReset
|
fh.CounterResetHint = histogram.UnknownCounterReset
|
||||||
}
|
}
|
||||||
return t, fh
|
return t, fh
|
||||||
|
|
Loading…
Reference in a new issue