From f3c8ed2947f66b5c4e2441939fb5a0487688d64c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gy=C3=B6rgy=20Krajcsovits?= Date: Wed, 9 Oct 2024 11:45:31 +0200 Subject: [PATCH] minor fixes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix lint errors. No need to pre-allocate exemplars. Signed-off-by: György Krajcsovits --- model/textparse/nhcbparse.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/model/textparse/nhcbparse.go b/model/textparse/nhcbparse.go index f78d95e7e..bf69ba600 100644 --- a/model/textparse/nhcbparse.go +++ b/model/textparse/nhcbparse.go @@ -28,7 +28,7 @@ import ( "github.com/prometheus/prometheus/util/convertnhcb" ) -var labelsMismatchError = errors.New("labels mismatch") +var errLabelsMismatch = errors.New("labels mismatch") type NHCBParser struct { // The parser we're wrapping. @@ -82,7 +82,6 @@ func NewNHCBParser(p Parser, keepClassicHistograms bool) Parser { parser: p, keepClassicHistograms: keepClassicHistograms, tempNHCB: convertnhcb.NewTempHistogram(), - tempExemplars: make([]exemplar.Exemplar, 0, 1), } } @@ -212,7 +211,7 @@ func (p *NHCBParser) compareLabels() bool { } else { p.lastBaseHistLabels = labels.EmptyLabels() } - return labelsMismatchError + return errLabelsMismatch } case l.Value != p.lastBaseHistLabels.Get(l.Name): // Different label value. @@ -221,11 +220,11 @@ func (p *NHCBParser) compareLabels() bool { } else { p.lastBaseHistLabels = labels.EmptyLabels() } - return labelsMismatchError + return errLabelsMismatch } return nil }) - return err == labelsMismatchError + return errors.Is(err, errLabelsMismatch) } // Save the label set of the classic histogram without suffix and bucket `le` label.