Skip to content

Commit

Permalink
Fix --const-label option (prometheus-community#113)
Browse files Browse the repository at this point in the history
Signed-off-by: tamareyal <[email protected]>
Co-authored-by: tamareyal <[email protected]>
Signed-off-by: Prateek <[email protected]>
  • Loading branch information
2 people authored and Prateek committed Jan 15, 2025
1 parent 779e85e commit 1f4e13d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion metrics/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -514,12 +514,12 @@ func (c *Collector) Run() error {
labelValues = append(labelValues, split[1])
}

c.labelKeys = labelKeys
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)
Expand Down

0 comments on commit 1f4e13d

Please sign in to comment.