Do not treat explicit counter resets special in OOO

Cleared them like any other reset.

Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
This commit is contained in:
György Krajcsovits 2024-10-29 18:34:01 +01:00
parent ee6f442168
commit 0ea261b33d
3 changed files with 4 additions and 4 deletions

View file

@ -4803,7 +4803,7 @@ func TestOOOHistogramCounterResetHeaders(t *testing.T) {
numSamples: 1,
},
expOOOMmappedChunks{
header: chunkenc.CounterReset,
header: chunkenc.UnknownCounterReset,
mint: 210,
maxt: 210,
numSamples: 1,

View file

@ -137,7 +137,7 @@ func (o *OOOChunk) ToEncodedChunks(mint, maxt int64) (chks []memChunk, err error
if newChunk != nil { // A new chunk was allocated.
if !recoded {
hc := newChunk.(*chunkenc.HistogramChunk)
if s.h.CounterResetHint != histogram.CounterReset && hc.GetCounterResetHeader() == chunkenc.CounterReset {
if hc.GetCounterResetHeader() == chunkenc.CounterReset {
// Clear the detected counter reset in the chunk as we cannot trust
// it in OOO.
hc.ClearCounterReset()
@ -158,7 +158,7 @@ func (o *OOOChunk) ToEncodedChunks(mint, maxt int64) (chks []memChunk, err error
if newChunk != nil { // A new chunk was allocated.
if !recoded {
hc := newChunk.(*chunkenc.FloatHistogramChunk)
if s.fh.CounterResetHint != histogram.CounterReset && hc.GetCounterResetHeader() == chunkenc.CounterReset {
if hc.GetCounterResetHeader() == chunkenc.CounterReset {
// Clear the detected counter reset in the chunk as we cannot trust
// it in OOO.
hc.ClearCounterReset()

View file

@ -217,7 +217,7 @@ func TestOOOChunks_ToEncodedChunks(t *testing.T) {
{t: 1000, h: h1},
{t: 1100, h: h2explicit},
},
expectedCounterResets: []histogram.CounterResetHint{histogram.UnknownCounterReset, histogram.CounterReset},
expectedCounterResets: []histogram.CounterResetHint{histogram.UnknownCounterReset, histogram.UnknownCounterReset},
expectedChunks: []chunkVerify{
{encoding: chunkenc.EncHistogram, minTime: 1000, maxTime: 1000},
{encoding: chunkenc.EncHistogram, minTime: 1100, maxTime: 1100},