compact/downsample: support native histogram custom buckets downsampling#8706
Open
Br1an67 wants to merge 3 commits intothanos-io:mainfrom
Open
compact/downsample: support native histogram custom buckets downsampling#8706Br1an67 wants to merge 3 commits intothanos-io:mainfrom
Br1an67 wants to merge 3 commits intothanos-io:mainfrom
Conversation
Custom bucket histograms (schema < 0) cannot be reduced in resolution using CopyToSchema. Skip schema reduction for custom buckets and use them as-is during downsampling to prevent panic. Signed-off-by: root <root@C20251020184286.local> Signed-off-by: Br1an67 <932039080@qq.com>
866aa3d to
1d42c23
Compare
Custom bucket histograms (schema < 0) cannot be subtracted using the Sub operation. When downsampling custom bucket histograms, treat them like counter resets and add the full value to the counter instead of computing a delta. This prevents panics when processing custom bucket histograms during downsampling. Fixes panic in histogramAggregator.add() when trying to subtract custom bucket histograms. Signed-off-by: Br1an67 <932039080@qq.com>
When downsampling histograms, if the schema type changes between custom bucket histograms (schema < 0) and exponential bucket histograms (schema >= 0), the Add operation would fail because these histogram types cannot be added together. This fix checks for incompatible schemas before attempting to add histograms. When incompatible schemas are detected, the aggregation is reset to the new histogram, similar to how counter resets are handled. Fixes panic when mixing custom bucket and exponential bucket histograms during downsampling. Signed-off-by: Br1an67 <932039080@qq.com>
GiedriusS
requested changes
Mar 11, 2026
Member
GiedriusS
left a comment
There was a problem hiding this comment.
What's the difference between https://github.com/thanos-io/thanos/pull/8699/changes and this? Maybe you could collaborate? Could you add a test case?
1fe5228 to
35a41c4
Compare
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #8698
Changes
minSchemafunction to skip custom bucket schemas (schema < 0) when finding the minimum schema for downsampling. Custom bucket histograms cannot be reduced in resolution usingCopyToSchema.histogramAggregator.addmethod to skip the schema reduction step for custom bucket histograms (schema < 0), allowing them to be used as-is during downsampling.Verification
The fix addresses the panic
cannot reduce resolution to custom buckets schemathat occurred when the compactor tried to downsample native histograms with custom buckets. The changes ensure that:CopyToSchemacall is skipped since it doesn't support custom bucket schemas