Skip to content

fix: cpufreq collector enable #3318

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion collector/cpu_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ func (c *cpuCollector) updateInfo(ch chan<- prometheus.Metric) error {
cpuFreqEnabled, ok := collectorState["cpufreq"]
if !ok || cpuFreqEnabled == nil {
c.logger.Debug("cpufreq key missing or nil value in collectorState map")
} else if !*cpuFreqEnabled {
} else if *cpuFreqEnabled {
for _, cpu := range info {
ch <- prometheus.MustNewConstMetric(c.cpuFrequencyHz,
prometheus.GaugeValue,
Expand Down
10 changes: 10 additions & 0 deletions collector/fixtures/e2e-output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,16 @@ 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_frequency_hertz CPU frequency in hertz from /proc/cpuinfo.
# TYPE node_cpu_frequency_hertz gauge
node_cpu_frequency_hertz{core="0",cpu="0",package="0"} 7.99998e+08
node_cpu_frequency_hertz{core="0",cpu="4",package="0"} 7.99989e+08
node_cpu_frequency_hertz{core="1",cpu="1",package="0"} 8.00037e+08
node_cpu_frequency_hertz{core="1",cpu="5",package="0"} 8.00083e+08
node_cpu_frequency_hertz{core="2",cpu="2",package="0"} 8.0001e+08
node_cpu_frequency_hertz{core="2",cpu="6",package="0"} 8.00017e+08
node_cpu_frequency_hertz{core="3",cpu="3",package="0"} 8.00028e+08
node_cpu_frequency_hertz{core="3",cpu="7",package="0"} 8.0003e+08
# 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
Expand Down
Loading