Skip to content

Commit

Permalink
collector/cpu: s/cpu_ticks*/cpu_nsec* for solaris
Browse files Browse the repository at this point in the history
Replace all cpu_ticks_* with cpu_nsec_*, since the former was off my a
magnitude of 10e6, and showed incorrect values for
node_cpu_seconds_total.

Fixes: #1837

Signed-off-by: Pranshu Srivastava <rexagod@gmail.com>
  • Loading branch information
rexagod committed May 12, 2024
1 parent 32ac7f4 commit 9245efd
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions collector/cpu_solaris.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,17 +60,17 @@ func (c *cpuCollector) Update(ch chan<- prometheus.Metric) error {
}

for k, v := range map[string]string{
"idle": "cpu_ticks_idle",
"kernel": "cpu_ticks_kernel",
"user": "cpu_ticks_user",
"wait": "cpu_ticks_wait",
"idle": "cpu_nsec_idle",
"kernel": "cpu_nsec_kernel",
"user": "cpu_nsec_user",
"wait": "cpu_nsec_wait",
} {
kstatValue, err := ksCPU.GetNamed(v)
if err != nil {
return err
}

ch <- c.cpu.mustNewConstMetric(float64(kstatValue.UintVal), strconv.Itoa(cpu), k)
ch <- c.cpu.mustNewConstMetric(float64(kstatValue.UintVal)/1e9, strconv.Itoa(cpu), k)
}
}
return nil
Expand Down

0 comments on commit 9245efd

Please sign in to comment.