From 223ebbd50c00178e5bc1652d4664178c79744e76 Mon Sep 17 00:00:00 2001 From: John Kordich Date: Thu, 17 Aug 2023 18:49:41 -0700 Subject: [PATCH] Add CPU MHz as the value for "node_cpu_info" metric For CPUs which don't have an available (or insertable) cpufreq driver, the /proc/cpuinfo file can sometimes have accurate CPU core frequency measurements. This change replaces the constant value of "1" for the "node_cpu_info" metric with the parsed CPU MHz value from /proc/cpuinfo for each core. Signed-off-by: John Kordich --- collector/cpu_linux.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/collector/cpu_linux.go b/collector/cpu_linux.go index 69e0a175..95efdcb1 100644 --- a/collector/cpu_linux.go +++ b/collector/cpu_linux.go @@ -184,7 +184,7 @@ func (c *cpuCollector) updateInfo(ch chan<- prometheus.Metric) error { for _, cpu := range info { ch <- prometheus.MustNewConstMetric(c.cpuInfo, prometheus.GaugeValue, - 1, + cpu.CPUMHz, cpu.PhysicalID, cpu.CoreID, strconv.Itoa(int(cpu.Processor)),