From 4fa5b0c53d78e4bc3e832b9b4feb2c1353499b65 Mon Sep 17 00:00:00 2001 From: Manik Rana Date: Fri, 11 Oct 2024 22:07:47 +0530 Subject: [PATCH] refac: remove p.Metric usage Signed-off-by: Manik Rana --- model/textparse/openmetricsparse.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/model/textparse/openmetricsparse.go b/model/textparse/openmetricsparse.go index 13629e66dba..aa2bdf49cea 100644 --- a/model/textparse/openmetricsparse.go +++ b/model/textparse/openmetricsparse.go @@ -652,10 +652,9 @@ func (p *OpenMetricsParser) parseLVals(offsets []int, isExemplar bool) ([]int, e // isCreatedSeries returns true if the current series is a _created series. func (p *OpenMetricsParser) isCreatedSeries() bool { - var newLbs labels.Labels - p.Metric(&newLbs) - name := newLbs.Get(model.MetricNameLabel) - if typeRequiresCT(p.mtype) && strings.HasSuffix(name, "_created") { + s := string(p.series) + metricName := unreplace(s[p.offsets[0]-p.start : p.offsets[1]-p.start]) + if typeRequiresCT(p.mtype) && strings.HasSuffix(metricName, "_created") { return true } return false