lib/storage: do not deduplicate blocks with less than 32 samples during merge

This should improve deduplication accuracy for blocks with higher number of samples.
This commit is contained in:
Aliaksandr Valialkin 2020-02-04 18:40:58 +02:00
parent ccd3aa4f15
commit 56d6b8ed0a

View File

@ -57,6 +57,11 @@ func deduplicateSamplesDuringMerge(srcTimestamps []int64, srcValues []int64) ([]
if *minScrapeInterval <= 0 {
return srcTimestamps, srcValues
}
if len(srcTimestamps) < 32 {
// Do not de-duplicate small number of samples during merge
// in order to improve deduplication accuracy on later stages.
return srcTimestamps, srcValues
}
minDelta := getMinDelta()
if !needsDedup(srcTimestamps, minDelta) {
// Fast path - nothing to deduplicate