Merge pull request #1834 from prometheus/fix-cpu-spelling

Fix capitalization of CPU acronym throughout
This commit is contained in:
Ben Kochie 2020-09-04 11:15:53 +02:00 committed by GitHub
commit d8a1585f59
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 38 additions and 38 deletions

View file

@ -26,7 +26,7 @@ const (
var (
nodeCPUSecondsDesc = prometheus.NewDesc(
prometheus.BuildFQName(namespace, cpuCollectorSubsystem, "seconds_total"),
"Seconds the cpus spent in each mode.",
"Seconds the CPUs spent in each mode.",
[]string{"cpu", "mode"}, nil,
)
)

View file

@ -93,7 +93,7 @@ func NewStatCollector(logger log.Logger) (Collector, error) {
}
func getDragonFlyCPUTimes() ([]float64, error) {
// We want time spent per-cpu per CPUSTATE.
// We want time spent per-CPU per CPUSTATE.
// CPUSTATES (number of CPUSTATES) is defined as 5U.
// States: CP_USER | CP_NICE | CP_SYS | CP_IDLE | CP_INTR
//

View file

@ -82,17 +82,17 @@ func NewCPUCollector(logger log.Logger) (Collector, error) {
),
cpuGuest: prometheus.NewDesc(
prometheus.BuildFQName(namespace, cpuCollectorSubsystem, "guest_seconds_total"),
"Seconds the cpus spent in guests (VMs) for each mode.",
"Seconds the CPUs spent in guests (VMs) for each mode.",
[]string{"cpu", "mode"}, nil,
),
cpuCoreThrottle: prometheus.NewDesc(
prometheus.BuildFQName(namespace, cpuCollectorSubsystem, "core_throttles_total"),
"Number of times this cpu core has been throttled.",
"Number of times this CPU core has been throttled.",
[]string{"package", "core"}, nil,
),
cpuPackageThrottle: prometheus.NewDesc(
prometheus.BuildFQName(namespace, cpuCollectorSubsystem, "package_throttles_total"),
"Number of times this cpu package has been throttled.",
"Number of times this CPU package has been throttled.",
[]string{"package"}, nil,
),
logger: logger,
@ -224,7 +224,7 @@ func (c *cpuCollector) updateThermalThrottle(ch chan<- prometheus.Metric) error
// metric node_cpu_core_throttles_total
//
// We process this metric before the package throttles as there
// are cpu+kernel combinations that only present core throttles
// are CPU+kernel combinations that only present core throttles
// but no package throttles.
// Seen e.g. on an Intel Xeon E5472 system with RHEL 6.9 kernel.
if _, present := packageCoreThrottles[physicalPackageID]; !present {
@ -269,7 +269,7 @@ func (c *cpuCollector) updateThermalThrottle(ch chan<- prometheus.Metric) error
return nil
}
// updateStat reads /proc/stat through procfs and exports cpu related metrics.
// updateStat reads /proc/stat through procfs and exports CPU-related metrics.
func (c *cpuCollector) updateStat(ch chan<- prometheus.Metric) error {
stats, err := c.fs.Stat()
if err != nil {

View file

@ -64,17 +64,17 @@ func NewCPUFreqCollector(logger log.Logger) (Collector, error) {
),
scalingFreq: prometheus.NewDesc(
prometheus.BuildFQName(namespace, cpuCollectorSubsystem, "scaling_frequency_hertz"),
"Current scaled cpu thread frequency in hertz.",
"Current scaled CPU thread frequency in hertz.",
[]string{"cpu"}, nil,
),
scalingFreqMin: prometheus.NewDesc(
prometheus.BuildFQName(namespace, cpuCollectorSubsystem, "scaling_frequency_min_hertz"),
"Minimum scaled cpu thread frequency in hertz.",
"Minimum scaled CPU thread frequency in hertz.",
[]string{"cpu"}, nil,
),
scalingFreqMax: prometheus.NewDesc(
prometheus.BuildFQName(namespace, cpuCollectorSubsystem, "scaling_frequency_max_hertz"),
"Maximum scaled cpu thread frequency in hertz.",
"Maximum scaled CPU thread frequency in hertz.",
[]string{"cpu"}, nil,
),
logger: logger,

View file

@ -42,12 +42,12 @@ func NewCpuFreqCollector(logger log.Logger) (Collector, error) {
return &cpuFreqCollector{
cpuFreq: prometheus.NewDesc(
prometheus.BuildFQName(namespace, cpuCollectorSubsystem, "frequency_hertz"),
"Current cpu thread frequency in hertz.",
"Current CPU thread frequency in hertz.",
[]string{"cpu"}, nil,
),
cpuFreqMax: prometheus.NewDesc(
prometheus.BuildFQName(namespace, cpuCollectorSubsystem, "frequency_max_hertz"),
"Maximum cpu thread frequency in hertz.",
"Maximum CPU thread frequency in hertz.",
[]string{"cpu"}, nil,
),
logger: logger,

View file

@ -190,7 +190,7 @@ node_cpu_bug_info{bug="cpu_meltdown"} 1
node_cpu_bug_info{bug="mds"} 1
node_cpu_bug_info{bug="spectre_v1"} 1
node_cpu_bug_info{bug="spectre_v2"} 1
# HELP node_cpu_core_throttles_total Number of times this cpu core has been throttled.
# HELP node_cpu_core_throttles_total Number of times this CPU core has been throttled.
# TYPE node_cpu_core_throttles_total counter
node_cpu_core_throttles_total{core="0",package="0"} 5
node_cpu_core_throttles_total{core="0",package="1"} 0
@ -202,7 +202,7 @@ node_cpu_flag_info{flag="aes"} 1
node_cpu_flag_info{flag="avx"} 1
node_cpu_flag_info{flag="avx2"} 1
node_cpu_flag_info{flag="constant_tsc"} 1
# HELP node_cpu_guest_seconds_total Seconds the cpus spent in guests (VMs) for each mode.
# HELP node_cpu_guest_seconds_total Seconds the CPUs spent in guests (VMs) for each mode.
# TYPE node_cpu_guest_seconds_total counter
node_cpu_guest_seconds_total{cpu="0",mode="nice"} 0.01
node_cpu_guest_seconds_total{cpu="0",mode="user"} 0.02
@ -230,29 +230,29 @@ node_cpu_info{cachesize="8192 KB",core="2",cpu="2",family="6",microcode="0xb4",m
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",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",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
node_cpu_package_throttles_total{package="0"} 30
node_cpu_package_throttles_total{package="1"} 6
# HELP node_cpu_scaling_frequency_hertz Current scaled cpu thread frequency in hertz.
# HELP node_cpu_scaling_frequency_hertz Current scaled CPU thread frequency in hertz.
# TYPE node_cpu_scaling_frequency_hertz gauge
node_cpu_scaling_frequency_hertz{cpu="0"} 1.699981e+09
node_cpu_scaling_frequency_hertz{cpu="1"} 1.699981e+09
node_cpu_scaling_frequency_hertz{cpu="2"} 8e+06
node_cpu_scaling_frequency_hertz{cpu="3"} 8e+06
# HELP node_cpu_scaling_frequency_max_hertz Maximum scaled cpu thread frequency in hertz.
# HELP node_cpu_scaling_frequency_max_hertz Maximum scaled CPU thread frequency in hertz.
# TYPE node_cpu_scaling_frequency_max_hertz gauge
node_cpu_scaling_frequency_max_hertz{cpu="0"} 3.7e+09
node_cpu_scaling_frequency_max_hertz{cpu="1"} 3.7e+09
node_cpu_scaling_frequency_max_hertz{cpu="2"} 4.2e+09
node_cpu_scaling_frequency_max_hertz{cpu="3"} 4.2e+09
# HELP node_cpu_scaling_frequency_min_hertz Minimum scaled cpu thread frequency in hertz.
# HELP node_cpu_scaling_frequency_min_hertz Minimum scaled CPU thread frequency in hertz.
# TYPE node_cpu_scaling_frequency_min_hertz gauge
node_cpu_scaling_frequency_min_hertz{cpu="0"} 8e+08
node_cpu_scaling_frequency_min_hertz{cpu="1"} 8e+08
node_cpu_scaling_frequency_min_hertz{cpu="2"} 1e+06
node_cpu_scaling_frequency_min_hertz{cpu="3"} 1e+06
# HELP node_cpu_seconds_total Seconds the cpus spent in each mode.
# HELP node_cpu_seconds_total Seconds the CPUs spent in each mode.
# TYPE node_cpu_seconds_total counter
node_cpu_seconds_total{cpu="0",mode="idle"} 10870.69
node_cpu_seconds_total{cpu="0",mode="iowait"} 2.2

View file

@ -253,7 +253,7 @@ node_cpu_bug_info{bug="cpu_meltdown"} 1
node_cpu_bug_info{bug="mds"} 1
node_cpu_bug_info{bug="spectre_v1"} 1
node_cpu_bug_info{bug="spectre_v2"} 1
# HELP node_cpu_core_throttles_total Number of times this cpu core has been throttled.
# HELP node_cpu_core_throttles_total Number of times this CPU core has been throttled.
# TYPE node_cpu_core_throttles_total counter
node_cpu_core_throttles_total{core="0",package="0"} 5
node_cpu_core_throttles_total{core="0",package="1"} 0
@ -265,7 +265,7 @@ node_cpu_flag_info{flag="aes"} 1
node_cpu_flag_info{flag="avx"} 1
node_cpu_flag_info{flag="avx2"} 1
node_cpu_flag_info{flag="constant_tsc"} 1
# HELP node_cpu_guest_seconds_total Seconds the cpus spent in guests (VMs) for each mode.
# HELP node_cpu_guest_seconds_total Seconds the CPUs spent in guests (VMs) for each mode.
# TYPE node_cpu_guest_seconds_total counter
node_cpu_guest_seconds_total{cpu="0",mode="nice"} 0.01
node_cpu_guest_seconds_total{cpu="0",mode="user"} 0.02
@ -293,29 +293,29 @@ node_cpu_info{cachesize="8192 KB",core="2",cpu="2",family="6",microcode="0xb4",m
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",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",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
node_cpu_package_throttles_total{package="0"} 30
node_cpu_package_throttles_total{package="1"} 6
# HELP node_cpu_scaling_frequency_hertz Current scaled cpu thread frequency in hertz.
# HELP node_cpu_scaling_frequency_hertz Current scaled CPU thread frequency in hertz.
# TYPE node_cpu_scaling_frequency_hertz gauge
node_cpu_scaling_frequency_hertz{cpu="0"} 1.699981e+09
node_cpu_scaling_frequency_hertz{cpu="1"} 1.699981e+09
node_cpu_scaling_frequency_hertz{cpu="2"} 8e+06
node_cpu_scaling_frequency_hertz{cpu="3"} 8e+06
# HELP node_cpu_scaling_frequency_max_hertz Maximum scaled cpu thread frequency in hertz.
# HELP node_cpu_scaling_frequency_max_hertz Maximum scaled CPU thread frequency in hertz.
# TYPE node_cpu_scaling_frequency_max_hertz gauge
node_cpu_scaling_frequency_max_hertz{cpu="0"} 3.7e+09
node_cpu_scaling_frequency_max_hertz{cpu="1"} 3.7e+09
node_cpu_scaling_frequency_max_hertz{cpu="2"} 4.2e+09
node_cpu_scaling_frequency_max_hertz{cpu="3"} 4.2e+09
# HELP node_cpu_scaling_frequency_min_hertz Minimum scaled cpu thread frequency in hertz.
# HELP node_cpu_scaling_frequency_min_hertz Minimum scaled CPU thread frequency in hertz.
# TYPE node_cpu_scaling_frequency_min_hertz gauge
node_cpu_scaling_frequency_min_hertz{cpu="0"} 8e+08
node_cpu_scaling_frequency_min_hertz{cpu="1"} 8e+08
node_cpu_scaling_frequency_min_hertz{cpu="2"} 1e+06
node_cpu_scaling_frequency_min_hertz{cpu="3"} 1e+06
# HELP node_cpu_seconds_total Seconds the cpus spent in each mode.
# HELP node_cpu_seconds_total Seconds the CPUs spent in each mode.
# TYPE node_cpu_seconds_total counter
node_cpu_seconds_total{cpu="0",mode="idle"} 10870.69
node_cpu_seconds_total{cpu="0",mode="iowait"} 2.2

View file

@ -67,29 +67,29 @@ func TestPerfCollectorStride(t *testing.T) {
tests := []struct {
name string
flag string
exCpus []int
exCPUs []int
}{
{
name: "valid single cpu",
name: "valid single CPU",
flag: "1",
exCpus: []int{1},
exCPUs: []int{1},
},
{
name: "valid range cpus",
name: "valid range CPUs",
flag: "1-5",
exCpus: []int{1, 2, 3, 4, 5},
exCPUs: []int{1, 2, 3, 4, 5},
},
{
name: "valid stride",
flag: "1-8:2",
exCpus: []int{1, 3, 5, 7},
exCPUs: []int{1, 3, 5, 7},
},
}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
ncpu := runtime.NumCPU()
for _, cpu := range test.exCpus {
for _, cpu := range test.exCPUs {
if cpu > ncpu {
t.Skipf("Skipping test because runtime.NumCPU < %d", cpu)
}
@ -101,7 +101,7 @@ func TestPerfCollectorStride(t *testing.T) {
}
c := collector.(*perfCollector)
for _, cpu := range test.exCpus {
for _, cpu := range test.exCPUs {
if _, ok := c.perfHwProfilers[cpu]; !ok {
t.Fatalf("Expected CPU %v in hardware profilers", cpu)
}
@ -124,12 +124,12 @@ func TestPerfCPUFlagToCPUs(t *testing.T) {
errStr string
}{
{
name: "valid single cpu",
name: "valid single CPU",
flag: "1",
exCpus: []int{1},
},
{
name: "valid range cpus",
name: "valid range CPUs",
flag: "1-5",
exCpus: []int{1, 2, 3, 4, 5},
},
@ -171,7 +171,7 @@ func TestPerfCPUFlagToCPUs(t *testing.T) {
}
if len(cpus) != len(test.exCpus) {
t.Fatalf(
"expected cpus %v, got %v",
"expected CPUs %v, got %v",
test.exCpus,
cpus,
)
@ -179,7 +179,7 @@ func TestPerfCPUFlagToCPUs(t *testing.T) {
for i := range cpus {
if test.exCpus[i] != cpus[i] {
t.Fatalf(
"expected cpus %v, got %v",
"expected CPUs %v, got %v",
test.exCpus[i],
cpus[i],
)