Merge pull request #15169 from jhesketh/jhesketh/clamp

Clamp functions should ignore native histograms
pull/14638/merge
Björn Rabenstein 2 weeks ago committed by GitHub
commit b4c0a5b394
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -14,6 +14,7 @@
* [BUGFIX] PromQL: Fix stddev+stdvar aggregations to always ignore native histograms. #14941 * [BUGFIX] PromQL: Fix stddev+stdvar aggregations to always ignore native histograms. #14941
* [BUGFIX] PromQL: Fix stddev+stdvar aggregations to treat Infinity consistently. #14941 * [BUGFIX] PromQL: Fix stddev+stdvar aggregations to treat Infinity consistently. #14941
* [BUGFIX] OTLP receiver: Preserve colons when generating metric names in suffix adding mode (this mode is always enabled, unless one uses Prometheus as a library). #15251 * [BUGFIX] OTLP receiver: Preserve colons when generating metric names in suffix adding mode (this mode is always enabled, unless one uses Prometheus as a library). #15251
* [BUGFIX] Clamp functions: Ignore any points with native histograms. #15169
## 3.0.0-beta.1 / 2024-10-09 ## 3.0.0-beta.1 / 2024-10-09

@ -474,6 +474,10 @@ func funcClamp(vals []parser.Value, args parser.Expressions, enh *EvalNodeHelper
return enh.Out, nil return enh.Out, nil
} }
for _, el := range vec { for _, el := range vec {
if el.H != nil {
// Process only float samples.
continue
}
if !enh.enableDelayedNameRemoval { if !enh.enableDelayedNameRemoval {
el.Metric = el.Metric.DropMetricName() el.Metric = el.Metric.DropMetricName()
} }
@ -491,6 +495,10 @@ func funcClampMax(vals []parser.Value, args parser.Expressions, enh *EvalNodeHel
vec := vals[0].(Vector) vec := vals[0].(Vector)
maxVal := vals[1].(Vector)[0].F maxVal := vals[1].(Vector)[0].F
for _, el := range vec { for _, el := range vec {
if el.H != nil {
// Process only float samples.
continue
}
if !enh.enableDelayedNameRemoval { if !enh.enableDelayedNameRemoval {
el.Metric = el.Metric.DropMetricName() el.Metric = el.Metric.DropMetricName()
} }
@ -508,6 +516,10 @@ func funcClampMin(vals []parser.Value, args parser.Expressions, enh *EvalNodeHel
vec := vals[0].(Vector) vec := vals[0].(Vector)
minVal := vals[1].(Vector)[0].F minVal := vals[1].(Vector)[0].F
for _, el := range vec { for _, el := range vec {
if el.H != nil {
// Process only float samples.
continue
}
if !enh.enableDelayedNameRemoval { if !enh.enableDelayedNameRemoval {
el.Metric = el.Metric.DropMetricName() el.Metric = el.Metric.DropMetricName()
} }

@ -452,6 +452,21 @@ eval instant at 0m clamp(test_clamp, NaN, 0)
eval instant at 0m clamp(test_clamp, 5, -5) eval instant at 0m clamp(test_clamp, 5, -5)
clear
load 1m
mixed_metric {{schema:0 sum:5 count:4 buckets:[1 2 1]}} 1 2 3 {{schema:0 sum:5 count:4 buckets:[1 2 1]}} {{schema:0 sum:8 count:6 buckets:[1 4 1]}}
# clamp ignores any histograms
eval range from 0 to 5m step 1m clamp(mixed_metric, 2, 5)
{} _ 2 2 3
eval range from 0 to 5m step 1m clamp_min(mixed_metric, 2)
{} _ 2 2 3
eval range from 0 to 5m step 1m clamp_max(mixed_metric, 2)
{} _ 1 2 2
# Test cases for sgn. # Test cases for sgn.
clear clear
load 5m load 5m

Loading…
Cancel
Save