Fix global ref

This commit is contained in:
matt durham 2023-10-02 15:51:27 -04:00
parent d9683215e7
commit 7bc164fbe7
No known key found for this signature in database
GPG key ID: A62E920AE398897B

View file

@ -208,18 +208,13 @@ func (c *cpuCollector) updateInfo(ch chan<- prometheus.Metric) error {
cpu.CacheSize) cpu.CacheSize)
} }
cpuFreqEnabled, ok := collectorState["cpufreq"] for _, cpu := range info {
if !ok || cpuFreqEnabled == nil { ch <- prometheus.MustNewConstMetric(c.cpuFrequencyHz,
level.Debug(c.logger).Log("cpufreq key missing or nil value in collectorState map", err) prometheus.GaugeValue,
} else if !*cpuFreqEnabled { cpu.CPUMHz*1e6,
for _, cpu := range info { cpu.PhysicalID,
ch <- prometheus.MustNewConstMetric(c.cpuFrequencyHz, cpu.CoreID,
prometheus.GaugeValue, strconv.Itoa(int(cpu.Processor)))
cpu.CPUMHz*1e6,
cpu.PhysicalID,
cpu.CoreID,
strconv.Itoa(int(cpu.Processor)))
}
} }
if len(info) != 0 { if len(info) != 0 {