From cbd5488cd3f2226ecde4532cff48b0b08f5a815e Mon Sep 17 00:00:00 2001 From: Jeanette Tan Date: Wed, 3 Jul 2024 17:56:48 +0800 Subject: [PATCH] skip nhcb conversion if there is native histogram of same name Signed-off-by: Jeanette Tan --- model/textparse/nhcbparse.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/model/textparse/nhcbparse.go b/model/textparse/nhcbparse.go index 165fd272f..a15dee277 100644 --- a/model/textparse/nhcbparse.go +++ b/model/textparse/nhcbparse.go @@ -45,6 +45,8 @@ type NhcbParser struct { lsetNhcb labels.Labels tempNhcb convertnhcb.TempHistogram + + lastNativeHistName string } func NewNhcbParser(p Parser, keepClassicHistograms bool) Parser { @@ -111,12 +113,16 @@ func (p *NhcbParser) Next() (Entry, error) { case EntryHistogram: p.bytes, p.ts, p.h, p.fh = p.parser.Histogram() p.metricString = p.parser.Metric(&p.lset) + p.lastNativeHistName = p.lset.Get(labels.MetricName) } return et, err } func (p *NhcbParser) handleClassicHistogramSeries(lset labels.Labels) bool { mName := lset.Get(labels.MetricName) + if convertnhcb.GetHistogramMetricBaseName(mName) == p.lastNativeHistName { + return false + } switch { case strings.HasSuffix(mName, "_bucket") && lset.Has(labels.BucketLabel): le, err := strconv.ParseFloat(lset.Get(labels.BucketLabel), 64)