skip nhcb conversion if there is native histogram of same name

Signed-off-by: Jeanette Tan <jeanette.tan@grafana.com>
This commit is contained in:
Jeanette Tan 2024-07-03 17:56:48 +08:00 committed by György Krajcsovits
parent 0e5072b873
commit cbd5488cd3

View file

@ -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)