mirror of https://github.com/prometheus/prometheus
histograms: Fix parsing float histograms without zero bucket
If a float histogram has a zero bucket with a threshold of zero _and_ an empty zero bucket, it wasn't identified as a native histogram because the `isNativeHistogram` helper function only looked at integer buckets. Signed-off-by: beorn7 <beorn@grafana.com>pull/12577/head
parent
2ea8df4734
commit
071f4bbea4
|
@ -105,7 +105,7 @@ func (p *ProtobufParser) Series() ([]byte, *int64, float64) {
|
||||||
v = float64(s.GetSampleCount())
|
v = float64(s.GetSampleCount())
|
||||||
case -1:
|
case -1:
|
||||||
v = s.GetSampleSum()
|
v = s.GetSampleSum()
|
||||||
// Need to detect a summaries without quantile here.
|
// Need to detect summaries without quantile here.
|
||||||
if len(s.GetQuantile()) == 0 {
|
if len(s.GetQuantile()) == 0 {
|
||||||
p.fieldsDone = true
|
p.fieldsDone = true
|
||||||
}
|
}
|
||||||
|
@ -564,8 +564,10 @@ func formatOpenMetricsFloat(f float64) string {
|
||||||
// deciding if a histogram should be ingested as a conventional one or a native
|
// deciding if a histogram should be ingested as a conventional one or a native
|
||||||
// one.
|
// one.
|
||||||
func isNativeHistogram(h *dto.Histogram) bool {
|
func isNativeHistogram(h *dto.Histogram) bool {
|
||||||
return len(h.GetNegativeDelta()) > 0 ||
|
return h.GetZeroThreshold() > 0 ||
|
||||||
len(h.GetPositiveDelta()) > 0 ||
|
|
||||||
h.GetZeroCount() > 0 ||
|
h.GetZeroCount() > 0 ||
|
||||||
h.GetZeroThreshold() > 0
|
len(h.GetNegativeDelta()) > 0 ||
|
||||||
|
len(h.GetPositiveDelta()) > 0 ||
|
||||||
|
len(h.GetNegativeCount()) > 0 ||
|
||||||
|
len(h.GetPositiveCount()) > 0
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue