From c26891043f0c24516294ab28ad2356dec6d25e54 Mon Sep 17 00:00:00 2001 From: beorn7 Date: Tue, 10 Jan 2023 16:25:23 +0100 Subject: [PATCH] textparse: Set CounterResetHint If a (float or integer) histogram is a gauge histogram, set the CounterResetHint accordingly. (The default value is fine for the normal counter histograms.) Signed-off-by: beorn7 --- model/textparse/protobufparse.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/model/textparse/protobufparse.go b/model/textparse/protobufparse.go index 003f88456e..eca145955e 100644 --- a/model/textparse/protobufparse.go +++ b/model/textparse/protobufparse.go @@ -170,6 +170,9 @@ func (p *ProtobufParser) Histogram() ([]byte, *int64, *histogram.Histogram, *his fh.NegativeSpans[i].Offset = span.GetOffset() fh.NegativeSpans[i].Length = span.GetLength() } + if p.mf.GetType() == dto.MetricType_GAUGE_HISTOGRAM { + fh.CounterResetHint = histogram.GaugeType + } fh.Compact(0) if ts != 0 { return p.metricBytes.Bytes(), &ts, nil, &fh @@ -199,6 +202,9 @@ func (p *ProtobufParser) Histogram() ([]byte, *int64, *histogram.Histogram, *his sh.NegativeSpans[i].Offset = span.GetOffset() sh.NegativeSpans[i].Length = span.GetLength() } + if p.mf.GetType() == dto.MetricType_GAUGE_HISTOGRAM { + sh.CounterResetHint = histogram.GaugeType + } sh.Compact(0) if ts != 0 { return p.metricBytes.Bytes(), &ts, &sh, nil