Fix seconds reported by schedstat (#1426)
Upstream bugfix: https://github.com/prometheus/procfs/pull/191 Signed-off-by: Phil Frost <phil@postmates.com>
This commit is contained in:
parent
75462bf4fe
commit
26d4fbdf07
10 changed files with 509 additions and 40 deletions
|
|
@ -20,6 +20,8 @@ import (
|
|||
"github.com/prometheus/procfs"
|
||||
)
|
||||
|
||||
const nsPerSec = 1e9
|
||||
|
||||
var (
|
||||
runningSecondsTotal = prometheus.NewDesc(
|
||||
prometheus.BuildFQName(namespace, "schedstat", "running_seconds_total"),
|
||||
|
|
@ -71,14 +73,14 @@ func (c *schedstatCollector) Update(ch chan<- prometheus.Metric) error {
|
|||
ch <- prometheus.MustNewConstMetric(
|
||||
runningSecondsTotal,
|
||||
prometheus.CounterValue,
|
||||
cpu.RunningSeconds(),
|
||||
float64(cpu.RunningNanoseconds)/nsPerSec,
|
||||
cpu.CPUNum,
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
waitingSecondsTotal,
|
||||
prometheus.CounterValue,
|
||||
cpu.WaitingSeconds(),
|
||||
float64(cpu.WaitingNanoseconds)/nsPerSec,
|
||||
cpu.CPUNum,
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue