mirror of
https://github.com/prometheus/node_exporter.git
synced 2025-03-05 21:00:12 -08:00
Fix global ref
This commit is contained in:
parent
d9683215e7
commit
7bc164fbe7
|
@ -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 {
|
||||||
|
|
Loading…
Reference in a new issue