From 7bc164fbe744c4258e6e5890c453acddd5cc2130 Mon Sep 17 00:00:00 2001 From: matt durham Date: Mon, 2 Oct 2023 15:51:27 -0400 Subject: [PATCH] Fix global ref --- collector/cpu_linux.go | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/collector/cpu_linux.go b/collector/cpu_linux.go index 7d4ea46a..9117149b 100644 --- a/collector/cpu_linux.go +++ b/collector/cpu_linux.go @@ -208,18 +208,13 @@ func (c *cpuCollector) updateInfo(ch chan<- prometheus.Metric) error { cpu.CacheSize) } - cpuFreqEnabled, ok := collectorState["cpufreq"] - if !ok || cpuFreqEnabled == nil { - level.Debug(c.logger).Log("cpufreq key missing or nil value in collectorState map", err) - } else if !*cpuFreqEnabled { - for _, cpu := range info { - ch <- prometheus.MustNewConstMetric(c.cpuFrequencyHz, - prometheus.GaugeValue, - cpu.CPUMHz*1e6, - cpu.PhysicalID, - cpu.CoreID, - strconv.Itoa(int(cpu.Processor))) - } + for _, cpu := range info { + ch <- prometheus.MustNewConstMetric(c.cpuFrequencyHz, + prometheus.GaugeValue, + cpu.CPUMHz*1e6, + cpu.PhysicalID, + cpu.CoreID, + strconv.Itoa(int(cpu.Processor))) } if len(info) != 0 {