Make metrics better follow guidelines (#787)

* Improve stat linux metric names.

cpu is no longer used.

* node_cpu -> node_cpu_seconds_total for Linux

* Improve filesystem metric names with units

* Improve units and names of linux disk stats

Remove sector metrics, the bytes metrics cover those already.

* Infiniband counters should end in _total

* Improve timex metric names, convert to more normal units.

See
3c073991eb/kernel/time/ntp.c (L909)
for what stabil means, looks like a moving average of some form.

* Update test fixture

* For meminfo metrics that had "kB" units, add _bytes

* Interrupts counter should have _total
This commit is contained in:
Brian Brazil 2018-01-17 16:55:55 +00:00 committed by Ben Kochie
commit a98067a294
12 changed files with 547 additions and 604 deletions

View file

@ -24,7 +24,6 @@ import (
)
type statCollector struct {
cpu *prometheus.Desc
intr *prometheus.Desc
ctxt *prometheus.Desc
forks *prometheus.Desc
@ -40,28 +39,23 @@ func init() {
// NewStatCollector returns a new Collector exposing kernel/system statistics.
func NewStatCollector() (Collector, error) {
return &statCollector{
cpu: prometheus.NewDesc(
prometheus.BuildFQName(namespace, "", "cpu"),
"Seconds the cpus spent in each mode.",
[]string{"cpu", "mode"}, nil,
),
intr: prometheus.NewDesc(
prometheus.BuildFQName(namespace, "", "intr"),
prometheus.BuildFQName(namespace, "", "intr_total"),
"Total number of interrupts serviced.",
nil, nil,
),
ctxt: prometheus.NewDesc(
prometheus.BuildFQName(namespace, "", "context_switches"),
prometheus.BuildFQName(namespace, "", "context_switches_total"),
"Total number of context switches.",
nil, nil,
),
forks: prometheus.NewDesc(
prometheus.BuildFQName(namespace, "", "forks"),
prometheus.BuildFQName(namespace, "", "forks_total"),
"Total number of forks.",
nil, nil,
),
btime: prometheus.NewDesc(
prometheus.BuildFQName(namespace, "", "boot_time"),
prometheus.BuildFQName(namespace, "", "boot_time_seconds"),
"Node boot time, in unixtime.",
nil, nil,
),