Merge pull request #10025 from prometheus/beorn7/histogram-sum

promql: Add a guard against a nil histogram in sum aggregation
pull/10026/head
Björn Rabenstein 3 years ago committed by GitHub
commit 7e2fa88a1d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -2321,7 +2321,12 @@ func (ev *evaluator) aggregation(op parser.ItemType, grouping []string, without
case parser.SUM:
if s.H != nil {
group.hasHistogram = true
group.histogramValue.Add(s.H)
if group.histogramValue != nil {
group.histogramValue.Add(s.H)
}
// Otherwise the aggregation contained floats
// previously and will be invalid anyway. No
// point in copying the histogram in that case.
} else {
group.hasFloat = true
group.value += s.V

Loading…
Cancel
Save