mirror of
https://github.com/prometheus/prometheus.git
synced 2025-02-02 08:31:11 -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:
|
case parser.SUM:
|
||||||
if s.H != nil {
|
if s.H != nil {
|
||||||
group.hasHistogram = true
|
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 {
|
} else {
|
||||||
group.hasFloat = true
|
group.hasFloat = true
|
||||||
group.value += s.V
|
group.value += s.V
|
||||||
|
|
Loading…
Reference in a new issue