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 <jkordich@gmail.com>
This commit is contained in:
John Kordich 2023-08-17 18:49:41 -07:00 committed by Johannes 'fish' Ziemke
parent 6225435677
commit 223ebbd50c

View file

@ -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)),