Skip to content

Commit

Permalink
promql: fix incorrect "native histogram ignored in aggregation" annot…
Browse files Browse the repository at this point in the history
…ations (prometheus#15414)

Signed-off-by: Charles Korn <[email protected]>
  • Loading branch information
charleskorn authored Nov 19, 2024
1 parent 101b1c3 commit 45db236
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions promql/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -3059,7 +3059,7 @@ func (ev *evaluator) aggregation(e *parser.AggregateExpr, q float64, inputMatrix

case parser.MAX:
if h != nil {
annos.Add(annotations.NewHistogramIgnoredInAggregationInfo("min", e.Expr.PositionRange()))
annos.Add(annotations.NewHistogramIgnoredInAggregationInfo("max", e.Expr.PositionRange()))
continue
}
if group.floatValue < f || math.IsNaN(group.floatValue) {
Expand All @@ -3068,7 +3068,7 @@ func (ev *evaluator) aggregation(e *parser.AggregateExpr, q float64, inputMatrix

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

0 comments on commit 45db236

Please sign in to comment.