From 18d2eaab29bd9d6a3e15d471d8f7339816ab5905 Mon Sep 17 00:00:00 2001 From: tamareyal Date: Thu, 26 Dec 2024 18:21:10 +0200 Subject: [PATCH] Fix --const-label option Signed-off-by: tamareyal --- metrics/serve.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/metrics/serve.go b/metrics/serve.go index 6f3a3d6..c75e2d4 100644 --- a/metrics/serve.go +++ b/metrics/serve.go @@ -514,11 +514,12 @@ func (c *Collector) Run() error { labelValues = append(labelValues, split[1]) } - mutableState := &metricState{seriesCount: c.cfg.SeriesCount} + mutableState := &metricState{seriesCount: c.cfg.SeriesCount, labelValues: labelValues} // unsafe means you need to lock c.mu to use it. unsafeReadOnlyGetState := func() metricState { return *mutableState } c.mu.Lock() // Just to make race detector happy, not really needed in practice. + c.labelKeys = labelKeys c.gauges = make([]*prometheus.GaugeVec, c.cfg.GaugeMetricCount) c.counters = make([]*prometheus.CounterVec, c.cfg.CounterMetricCount) c.histograms = make([]*prometheus.HistogramVec, c.cfg.HistogramMetricCount)