prometheus/tsdb/chunkenc
George Krajcsovits 00ab05c3b9
Native histograms: fix spurios counter reset when merging recoded chunk to normal chunk (#14513)
* chunkenc: allow missing empty buckets on histogram append

Allow appending to chunks when the histogram to be added is missing
some buckets, but the missing buckets are empty in the chunk.
For example bucket at index 5 is present in the chunk, but its value
is 0 and the new histogram doesn't have a bucket at index 5.

This fixes an issue of merging chunks where one chunk was recoded to
retroactively have some empty buckets in all the histograms and we are
merging in a histogram that doesn't have the empty bucket (because it
was not recoded yet).

The operation alters the histogram that is being added, however this has
already been the case when appending gauge histograms. Thus the test
TestHistogramSeriesToChunks in storage package is changed to explicitly
test what happened to the appended histogram - Compact(0) call is removed.

The new expandIntSpansAndBuckets and expandFloatSpansAndBuckets functions
are a merge of expandSpansForward and counterResetInAnyBucket and
counterResetInAnyFloatBucket.

Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
2024-08-01 09:22:32 +02:00
..
bstream.go tsdb/chunkenc.Pool: Refactor Get and Put 2024-05-08 13:37:25 +02:00
bstream_test.go tsdb/chunkenc.Pool: Refactor Get and Put 2024-05-08 13:37:25 +02:00
chunk.go tsdb/chunkenc.Pool: Refactor Get and Put 2024-05-08 13:37:25 +02:00
chunk_test.go tsdb/chunkenc.Pool: Refactor Get and Put 2024-05-08 13:37:25 +02:00
float_histogram.go Native histograms: fix spurios counter reset when merging recoded chunk to normal chunk (#14513) 2024-08-01 09:22:32 +02:00
float_histogram_test.go Native histograms: fix spurios counter reset when merging recoded chunk to normal chunk (#14513) 2024-08-01 09:22:32 +02:00
histogram.go Native histograms: fix spurios counter reset when merging recoded chunk to normal chunk (#14513) 2024-08-01 09:22:32 +02:00
histogram_meta.go Native histograms: fix spurios counter reset when merging recoded chunk to normal chunk (#14513) 2024-08-01 09:22:32 +02:00
histogram_meta_test.go [nhcb branch] Use single bit to differentiate between optimized bounds and floats (#13828) 2024-03-27 18:40:59 +01:00
histogram_test.go Native histograms: fix spurios counter reset when merging recoded chunk to normal chunk (#14513) 2024-08-01 09:22:32 +02:00
varbit.go Fix language in docs and comments (#14041) 2024-05-08 17:57:09 +02:00
varbit_test.go Use more varbit in histogram chunks 2021-10-13 20:03:35 +02:00
xor.go Fix a couple of comments 2024-07-05 15:25:42 +02:00
xor_test.go chunkenc: Slightly optimize xorWrite/xoRead (#11476) 2022-10-20 15:08:01 +05:30