promql: fix incorrect "native histogram ignored in aggregation" annotations (#15414)

Signed-off-by: Charles Korn <charles.korn@grafana.com>
This commit is contained in:
Charles Korn 2024-11-19 18:17:49 +11:00 committed by GitHub
parent 101b1c307f
commit 45db23617a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -3059,7 +3059,7 @@ func (ev *evaluator) aggregation(e *parser.AggregateExpr, q float64, inputMatrix
case parser.MAX: case parser.MAX:
if h != nil { if h != nil {
annos.Add(annotations.NewHistogramIgnoredInAggregationInfo("min", e.Expr.PositionRange())) annos.Add(annotations.NewHistogramIgnoredInAggregationInfo("max", e.Expr.PositionRange()))
continue continue
} }
if group.floatValue < f || math.IsNaN(group.floatValue) { if group.floatValue < f || math.IsNaN(group.floatValue) {
@ -3068,7 +3068,7 @@ func (ev *evaluator) aggregation(e *parser.AggregateExpr, q float64, inputMatrix
case parser.MIN: case parser.MIN:
if h != nil { if h != nil {
annos.Add(annotations.NewHistogramIgnoredInAggregationInfo("max", e.Expr.PositionRange())) annos.Add(annotations.NewHistogramIgnoredInAggregationInfo("min", e.Expr.PositionRange()))
continue continue
} }
if group.floatValue > f || math.IsNaN(group.floatValue) { if group.floatValue > f || math.IsNaN(group.floatValue) {
@ -3084,6 +3084,7 @@ func (ev *evaluator) aggregation(e *parser.AggregateExpr, q float64, inputMatrix
delta := f - group.floatMean delta := f - group.floatMean
group.floatMean += delta / group.groupCount group.floatMean += delta / group.groupCount
group.floatValue += delta * (f - group.floatMean) group.floatValue += delta * (f - group.floatMean)
} else {
if op == parser.STDVAR { if op == parser.STDVAR {
annos.Add(annotations.NewHistogramIgnoredInAggregationInfo("stdvar", e.Expr.PositionRange())) annos.Add(annotations.NewHistogramIgnoredInAggregationInfo("stdvar", e.Expr.PositionRange()))
} else { } else {