Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions metricbeat/helper/prometheus/metric.go
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,10 @@ func (o opMultiplyBuckets) Process(field string, value interface{}, labels commo
if !ok {
return field, value, labels
}
sum, ok := histogram["sum"].(float64)
if !ok {
return field, value, labels
}
multiplied := common.MapStr{}
for k, v := range bucket {
if f, err := strconv.ParseFloat(k, 64); err == nil {
Expand All @@ -299,5 +303,6 @@ func (o opMultiplyBuckets) Process(field string, value interface{}, labels commo
}
}
histogram["bucket"] = multiplied
histogram["sum"] = sum * o.multiplier
return field, histogram, labels
}
2 changes: 1 addition & 1 deletion metricbeat/helper/prometheus/prometheus_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ func TestPrometheus(t *testing.T) {
"1000": uint64(3),
"+Inf": uint64(5),
},
"sum": 4.31,
"sum": 4310.0,
},
},
},
Expand Down