fix: handle NaN in scraper (#23944)
* fix: handle NaN values in scraper * chore: a converted int will never be NaNpull/23676/head^2
parent
ade21ad9a1
commit
ffd069a8a5
|
@ -93,12 +93,20 @@ func (p *prometheusScraper) parse(r io.Reader, header http.Header, target influx
|
|||
// summary metric
|
||||
fields = makeQuantiles(m)
|
||||
fields["count"] = float64(m.GetSummary().GetSampleCount())
|
||||
fields["sum"] = float64(m.GetSummary().GetSampleSum())
|
||||
|
||||
ss := float64(m.GetSummary().GetSampleSum())
|
||||
if !math.IsNaN(ss) {
|
||||
fields["sum"] = ss
|
||||
}
|
||||
case dto.MetricType_HISTOGRAM:
|
||||
// histogram metric
|
||||
fields = makeBuckets(m)
|
||||
fields["count"] = float64(m.GetHistogram().GetSampleCount())
|
||||
fields["sum"] = float64(m.GetHistogram().GetSampleSum())
|
||||
|
||||
ss := float64(m.GetHistogram().GetSampleSum())
|
||||
if !math.IsNaN(ss) {
|
||||
fields["sum"] = ss
|
||||
}
|
||||
default:
|
||||
// standard metric
|
||||
fields = getNameAndValue(m)
|
||||
|
|
Loading…
Reference in New Issue