Browse Source

Add model_name and stepping to node_cpu_info metric

The `node_cpu_info` metric contains some information like the `model`
(which is an integer), but not the human readable model name. Also the
stepping of the processor might be interesting, since different stepping
of a processor might behave differently.

Signed-off-by: Benjamin Drung <benjamin.drung@cloud.ionos.com>
pull/1644/head
Benjamin Drung 5 years ago committed by Johannes 'fish' Ziemke
parent
commit
34d50e15d5
  1. 2
      CHANGELOG.md
  2. 4
      collector/cpu_linux.go
  3. 16
      collector/fixtures/e2e-64k-page-output.txt
  4. 16
      collector/fixtures/e2e-output.txt

2
CHANGELOG.md

@ -2,7 +2,7 @@
* [CHANGE] * [CHANGE]
* [FEATURE] * [FEATURE]
* [ENHANCEMENT] * [ENHANCEMENT] Add model_name and stepping to node_cpu_info metric #1617
* [BUGFIX] * [BUGFIX]
## 1.0.0-rc.0 / 2020-02-20 ## 1.0.0-rc.0 / 2020-02-20

4
collector/cpu_linux.go

@ -57,7 +57,7 @@ func NewCPUCollector(logger log.Logger) (Collector, error) {
cpuInfo: prometheus.NewDesc( cpuInfo: prometheus.NewDesc(
prometheus.BuildFQName(namespace, cpuCollectorSubsystem, "info"), prometheus.BuildFQName(namespace, cpuCollectorSubsystem, "info"),
"CPU information from /proc/cpuinfo.", "CPU information from /proc/cpuinfo.",
[]string{"package", "core", "cpu", "vendor", "family", "model", "microcode", "cachesize"}, nil, []string{"package", "core", "cpu", "vendor", "family", "model", "model_name", "microcode", "stepping", "cachesize"}, nil,
), ),
cpuGuest: prometheus.NewDesc( cpuGuest: prometheus.NewDesc(
prometheus.BuildFQName(namespace, cpuCollectorSubsystem, "guest_seconds_total"), prometheus.BuildFQName(namespace, cpuCollectorSubsystem, "guest_seconds_total"),
@ -110,7 +110,9 @@ func (c *cpuCollector) updateInfo(ch chan<- prometheus.Metric) error {
cpu.VendorID, cpu.VendorID,
cpu.CPUFamily, cpu.CPUFamily,
cpu.Model, cpu.Model,
cpu.ModelName,
cpu.Microcode, cpu.Microcode,
cpu.Stepping,
cpu.CacheSize) cpu.CacheSize)
} }
return nil return nil

16
collector/fixtures/e2e-64k-page-output.txt

@ -210,14 +210,14 @@ node_cpu_guest_seconds_total{cpu="7",mode="nice"} 0.08
node_cpu_guest_seconds_total{cpu="7",mode="user"} 0.09 node_cpu_guest_seconds_total{cpu="7",mode="user"} 0.09
# HELP node_cpu_info CPU information from /proc/cpuinfo. # HELP node_cpu_info CPU information from /proc/cpuinfo.
# TYPE node_cpu_info gauge # TYPE node_cpu_info gauge
node_cpu_info{cachesize="8192 KB",core="0",cpu="0",family="6",microcode="0xb4",model="142",package="0",vendor="GenuineIntel"} 1 node_cpu_info{cachesize="8192 KB",core="0",cpu="0",family="6",microcode="0xb4",model="142",model_name="Intel(R) Core(TM) i7-8650U CPU @ 1.90GHz",package="0",stepping="10",vendor="GenuineIntel"} 1
node_cpu_info{cachesize="8192 KB",core="0",cpu="4",family="6",microcode="0xb4",model="142",package="0",vendor="GenuineIntel"} 1 node_cpu_info{cachesize="8192 KB",core="0",cpu="4",family="6",microcode="0xb4",model="142",model_name="Intel(R) Core(TM) i7-8650U CPU @ 1.90GHz",package="0",stepping="10",vendor="GenuineIntel"} 1
node_cpu_info{cachesize="8192 KB",core="1",cpu="1",family="6",microcode="0xb4",model="142",package="0",vendor="GenuineIntel"} 1 node_cpu_info{cachesize="8192 KB",core="1",cpu="1",family="6",microcode="0xb4",model="142",model_name="Intel(R) Core(TM) i7-8650U CPU @ 1.90GHz",package="0",stepping="10",vendor="GenuineIntel"} 1
node_cpu_info{cachesize="8192 KB",core="1",cpu="5",family="6",microcode="0xb4",model="142",package="0",vendor="GenuineIntel"} 1 node_cpu_info{cachesize="8192 KB",core="1",cpu="5",family="6",microcode="0xb4",model="142",model_name="Intel(R) Core(TM) i7-8650U CPU @ 1.90GHz",package="0",stepping="10",vendor="GenuineIntel"} 1
node_cpu_info{cachesize="8192 KB",core="2",cpu="2",family="6",microcode="0xb4",model="142",package="0",vendor="GenuineIntel"} 1 node_cpu_info{cachesize="8192 KB",core="2",cpu="2",family="6",microcode="0xb4",model="142",model_name="Intel(R) Core(TM) i7-8650U CPU @ 1.90GHz",package="0",stepping="10",vendor="GenuineIntel"} 1
node_cpu_info{cachesize="8192 KB",core="2",cpu="6",family="6",microcode="0xb4",model="142",package="0",vendor="GenuineIntel"} 1 node_cpu_info{cachesize="8192 KB",core="2",cpu="6",family="6",microcode="0xb4",model="142",model_name="Intel(R) Core(TM) i7-8650U CPU @ 1.90GHz",package="0",stepping="10",vendor="GenuineIntel"} 1
node_cpu_info{cachesize="8192 KB",core="3",cpu="3",family="6",microcode="0xb4",model="142",package="0",vendor="GenuineIntel"} 1 node_cpu_info{cachesize="8192 KB",core="3",cpu="3",family="6",microcode="0xb4",model="142",model_name="Intel(R) Core(TM) i7-8650U CPU @ 1.90GHz",package="0",stepping="10",vendor="GenuineIntel"} 1
node_cpu_info{cachesize="8192 KB",core="3",cpu="7",family="6",microcode="0xb4",model="142",package="0",vendor="GenuineIntel"} 1 node_cpu_info{cachesize="8192 KB",core="3",cpu="7",family="6",microcode="0xb4",model="142",model_name="Intel(R) Core(TM) i7-8650U CPU @ 1.90GHz",package="0",stepping="10",vendor="GenuineIntel"} 1
# HELP node_cpu_package_throttles_total Number of times this cpu package has been throttled. # HELP node_cpu_package_throttles_total Number of times this cpu package has been throttled.
# TYPE node_cpu_package_throttles_total counter # TYPE node_cpu_package_throttles_total counter
node_cpu_package_throttles_total{package="0"} 30 node_cpu_package_throttles_total{package="0"} 30

16
collector/fixtures/e2e-output.txt

@ -258,14 +258,14 @@ node_cpu_guest_seconds_total{cpu="7",mode="nice"} 0.08
node_cpu_guest_seconds_total{cpu="7",mode="user"} 0.09 node_cpu_guest_seconds_total{cpu="7",mode="user"} 0.09
# HELP node_cpu_info CPU information from /proc/cpuinfo. # HELP node_cpu_info CPU information from /proc/cpuinfo.
# TYPE node_cpu_info gauge # TYPE node_cpu_info gauge
node_cpu_info{cachesize="8192 KB",core="0",cpu="0",family="6",microcode="0xb4",model="142",package="0",vendor="GenuineIntel"} 1 node_cpu_info{cachesize="8192 KB",core="0",cpu="0",family="6",microcode="0xb4",model="142",model_name="Intel(R) Core(TM) i7-8650U CPU @ 1.90GHz",package="0",stepping="10",vendor="GenuineIntel"} 1
node_cpu_info{cachesize="8192 KB",core="0",cpu="4",family="6",microcode="0xb4",model="142",package="0",vendor="GenuineIntel"} 1 node_cpu_info{cachesize="8192 KB",core="0",cpu="4",family="6",microcode="0xb4",model="142",model_name="Intel(R) Core(TM) i7-8650U CPU @ 1.90GHz",package="0",stepping="10",vendor="GenuineIntel"} 1
node_cpu_info{cachesize="8192 KB",core="1",cpu="1",family="6",microcode="0xb4",model="142",package="0",vendor="GenuineIntel"} 1 node_cpu_info{cachesize="8192 KB",core="1",cpu="1",family="6",microcode="0xb4",model="142",model_name="Intel(R) Core(TM) i7-8650U CPU @ 1.90GHz",package="0",stepping="10",vendor="GenuineIntel"} 1
node_cpu_info{cachesize="8192 KB",core="1",cpu="5",family="6",microcode="0xb4",model="142",package="0",vendor="GenuineIntel"} 1 node_cpu_info{cachesize="8192 KB",core="1",cpu="5",family="6",microcode="0xb4",model="142",model_name="Intel(R) Core(TM) i7-8650U CPU @ 1.90GHz",package="0",stepping="10",vendor="GenuineIntel"} 1
node_cpu_info{cachesize="8192 KB",core="2",cpu="2",family="6",microcode="0xb4",model="142",package="0",vendor="GenuineIntel"} 1 node_cpu_info{cachesize="8192 KB",core="2",cpu="2",family="6",microcode="0xb4",model="142",model_name="Intel(R) Core(TM) i7-8650U CPU @ 1.90GHz",package="0",stepping="10",vendor="GenuineIntel"} 1
node_cpu_info{cachesize="8192 KB",core="2",cpu="6",family="6",microcode="0xb4",model="142",package="0",vendor="GenuineIntel"} 1 node_cpu_info{cachesize="8192 KB",core="2",cpu="6",family="6",microcode="0xb4",model="142",model_name="Intel(R) Core(TM) i7-8650U CPU @ 1.90GHz",package="0",stepping="10",vendor="GenuineIntel"} 1
node_cpu_info{cachesize="8192 KB",core="3",cpu="3",family="6",microcode="0xb4",model="142",package="0",vendor="GenuineIntel"} 1 node_cpu_info{cachesize="8192 KB",core="3",cpu="3",family="6",microcode="0xb4",model="142",model_name="Intel(R) Core(TM) i7-8650U CPU @ 1.90GHz",package="0",stepping="10",vendor="GenuineIntel"} 1
node_cpu_info{cachesize="8192 KB",core="3",cpu="7",family="6",microcode="0xb4",model="142",package="0",vendor="GenuineIntel"} 1 node_cpu_info{cachesize="8192 KB",core="3",cpu="7",family="6",microcode="0xb4",model="142",model_name="Intel(R) Core(TM) i7-8650U CPU @ 1.90GHz",package="0",stepping="10",vendor="GenuineIntel"} 1
# HELP node_cpu_package_throttles_total Number of times this cpu package has been throttled. # HELP node_cpu_package_throttles_total Number of times this cpu package has been throttled.
# TYPE node_cpu_package_throttles_total counter # TYPE node_cpu_package_throttles_total counter
node_cpu_package_throttles_total{package="0"} 30 node_cpu_package_throttles_total{package="0"} 30

Loading…
Cancel
Save