mirror of
https://github.com/prometheus/prometheus.git
synced 2024-11-10 07:34:04 -08:00
Merge pull request #10025 from prometheus/beorn7/histogram-sum
promql: Add a guard against a nil histogram in sum aggregation
This commit is contained in:
commit
7e2fa88a1d
|
@ -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…
Reference in a new issue