Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
* [BUGFIX] MQE: Fix an issue where series were joined in binary operations using the wrong labels when `group_left()`/`group_right()` were used in combination with `ignoring()`. This bug manifested as valid queries returning an error `grouping labels must ensure unique matches`. #16387
* [BUGFIX] MQE: Fix queries and rules containing a subquery whose range is shorter than its step (e.g. `foo[10m:3d]`) failing with `last bucket must not be before first bucket`. #16442
* [BUGFIX] MQE: Fix `sum_over_time()` over native histograms losing precision when experimental range vector splitting is enabled. The Kahan compensation of each split range was discarded instead of being carried over to the other split ranges. #16455
* [BUGFIX] MQE: Never skip decoding histogram buckets for `histogram_stddev` and `histogram_stdvar`, as this could return wrong results when these functions are nested in other functions that skip decoding histogram buckets like `histogram_sum`, `histogram_count` or `histogram_avg`. #16486
* [BUGFIX] Upgrade Go to 1.26 latest with fixes for [CVE-2026-33818](https://pkg.go.dev/vuln/GO-2026-5972), [CVE-2026-39821](https://pkg.go.dev/vuln/GO-2026-5026), [CVE-2026-46600](https://pkg.go.dev/vuln/GO-2026-5942), [CVE-2026-56853](https://pkg.go.dev/vuln/GO-2026-6089), [CVE-2026-56858](https://pkg.go.dev/vuln/GO-2026-6091), [CVE-2026-56859](https://pkg.go.dev/vuln/GO-2026-6088), [CVE-2026-56860](https://pkg.go.dev/vuln/GO-2026-6218), and [CVE-2026-56862](https://pkg.go.dev/vuln/GO-2026-6090). #16408 #16430
* [BUGFIX] Store-gateway: Drain the chunks range reader before closing it so HTTP object storage connections can be reused. #16338
* [BUGFIX] Block-builder-scheduler: Fail startup instead of silently switching to normal operation without assigning any jobs when probing the initial consumption offsets fails. #16028
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func (s *SkipHistogramDecodingOptimizationPass) applyToNode(node planning.Node,
switch f.Function {
case functions.FUNCTION_HISTOGRAM_COUNT, functions.FUNCTION_HISTOGRAM_SUM, functions.FUNCTION_HISTOGRAM_AVG:
skipHistogramBuckets = true
case functions.FUNCTION_HISTOGRAM_FRACTION, functions.FUNCTION_HISTOGRAM_QUANTILE, functions.FUNCTION_HISTOGRAM_QUANTILES:
case functions.FUNCTION_HISTOGRAM_FRACTION, functions.FUNCTION_HISTOGRAM_QUANTILE, functions.FUNCTION_HISTOGRAM_QUANTILES, functions.FUNCTION_HISTOGRAM_STDDEV, functions.FUNCTION_HISTOGRAM_STDVAR:
skipHistogramBuckets = false
default:
// Nothing to do.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,22 @@ func TestSkipHistogramDecodingOptimizationPass(t *testing.T) {
- param 2: VectorSelector: {__name__="some_metric"}
`,
},
"single vector selector with histogram_stddev": {
expr: `histogram_stddev(some_metric)`,
expectedPlan: `
- DeduplicateAndMerge
- FunctionCall: histogram_stddev(...)
- VectorSelector: {__name__="some_metric"}
`,
},
"single vector selector with histogram_stdvar": {
expr: `histogram_stdvar(some_metric)`,
expectedPlan: `
- DeduplicateAndMerge
- FunctionCall: histogram_stdvar(...)
- VectorSelector: {__name__="some_metric"}
`,
},
"vector selector eligible for skipping decoding in binary expression": {
expr: `2 * histogram_sum(some_metric)`,
expectedPlan: `
Expand Down Expand Up @@ -126,6 +142,30 @@ func TestSkipHistogramDecodingOptimizationPass(t *testing.T) {
- param 1: VectorSelector: {__name__="some_other_metric"}
`,
},
"inner vector selector not eligible for skipping decoding due to nesting inside histogram_stddev": {
expr: `histogram_sum(some_metric * histogram_stddev(some_other_metric))`,
expectedPlan: `
- DeduplicateAndMerge
- FunctionCall: histogram_sum(...)
- BinaryExpression: LHS * RHS
- LHS: VectorSelector: {__name__="some_metric"}, skip histogram buckets
- RHS: DeduplicateAndMerge
- FunctionCall: histogram_stddev(...)
- VectorSelector: {__name__="some_other_metric"}
`,
},
"inner vector selector not eligible for skipping decoding due to nesting inside histogram_stdvar": {
expr: `histogram_sum(some_metric * histogram_stdvar(some_other_metric))`,
expectedPlan: `
- DeduplicateAndMerge
- FunctionCall: histogram_sum(...)
- BinaryExpression: LHS * RHS
- LHS: VectorSelector: {__name__="some_metric"}, skip histogram buckets
- RHS: DeduplicateAndMerge
- FunctionCall: histogram_stdvar(...)
- VectorSelector: {__name__="some_other_metric"}
`,
},
"both vector selectors eligible for skipping decoding despite nesting": {
expr: `histogram_sum(some_metric * histogram_count(some_other_metric))`,
expectedPlan: `
Expand Down
10 changes: 10 additions & 0 deletions pkg/streamingpromql/testdata/ours/native_histograms.test
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,16 @@ eval range from 0 to 5m step 1m histogram_stdvar(single_histogram)
eval range from 0 to 5m step 1m histogram_sum(single_histogram)
{} 5 5 5 5 5 20

# histogram_stddev/histogram_stdvar operate on the buckets, so their input's buckets must never be skipped,
# even when nested under histogram_sum/histogram_count/histogram_avg (which would otherwise enable skipping via
# the "skip decoding histogram buckets" optimization). If the buckets were skipped, histogram_stddev/histogram_stdvar
# would see an empty bucket set and return 0, making the surrounding histogram_sum 0 as well.
eval instant at 5m histogram_sum(single_histogram * histogram_stddev(single_histogram))
{} 59.72564428477802

eval instant at 5m histogram_sum(single_histogram * histogram_stdvar(single_histogram))
{} 178.35762926159188

clear

# Test metric with mixed floats and histograms
Expand Down
Loading