Merge pull request #195 from martinlindhe/totals-as-gauges-help-string

Fix wrong metric types in system collector, improve help-strings
This commit is contained in:
Calle Pettersson
2018-04-30 09:29:00 +02:00
committed by GitHub

View File

@@ -30,37 +30,37 @@ func NewSystemCollector() (Collector, error) {
return &SystemCollector{ return &SystemCollector{
ContextSwitchesTotal: prometheus.NewDesc( ContextSwitchesTotal: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "context_switches_total"), prometheus.BuildFQName(Namespace, subsystem, "context_switches_total"),
"PerfOS_System.ContextSwitchesPersec", "Total number of context switches (WMI source: PerfOS_System.ContextSwitchesPersec)",
nil, nil,
nil, nil,
), ),
ExceptionDispatchesTotal: prometheus.NewDesc( ExceptionDispatchesTotal: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "exception_dispatches_total"), prometheus.BuildFQName(Namespace, subsystem, "exception_dispatches_total"),
"PerfOS_System.ExceptionDispatchesPersec", "Total number of exceptions dispatched (WMI source: PerfOS_System.ExceptionDispatchesPersec)",
nil, nil,
nil, nil,
), ),
ProcessorQueueLength: prometheus.NewDesc( ProcessorQueueLength: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "processor_queue_length"), prometheus.BuildFQName(Namespace, subsystem, "processor_queue_length"),
"PerfOS_System.ProcessorQueueLength", "Length of processor queue (WMI source: PerfOS_System.ProcessorQueueLength)",
nil, nil,
nil, nil,
), ),
SystemCallsTotal: prometheus.NewDesc( SystemCallsTotal: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "system_calls_total"), prometheus.BuildFQName(Namespace, subsystem, "system_calls_total"),
"PerfOS_System.SystemCallsPersec", "Total number of system calls (WMI source: PerfOS_System.SystemCallsPersec)",
nil, nil,
nil, nil,
), ),
SystemUpTime: prometheus.NewDesc( SystemUpTime: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "system_up_time"), prometheus.BuildFQName(Namespace, subsystem, "system_up_time"),
"SystemUpTime/Frequency_Object", "System boot time (WMI source: PerfOS_System.SystemUpTime)",
nil, nil,
nil, nil,
), ),
Threads: prometheus.NewDesc( Threads: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "threads"), prometheus.BuildFQName(Namespace, subsystem, "threads"),
"PerfOS_System.Threads", "Current number of threads (WMI source: PerfOS_System.Threads)",
nil, nil,
nil, nil,
), ),
@@ -96,12 +96,12 @@ func (c *SystemCollector) collect(ch chan<- prometheus.Metric) (*prometheus.Desc
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.ContextSwitchesTotal, c.ContextSwitchesTotal,
prometheus.GaugeValue, prometheus.CounterValue,
float64(dst[0].ContextSwitchesPersec), float64(dst[0].ContextSwitchesPersec),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.ExceptionDispatchesTotal, c.ExceptionDispatchesTotal,
prometheus.GaugeValue, prometheus.CounterValue,
float64(dst[0].ExceptionDispatchesPersec), float64(dst[0].ExceptionDispatchesPersec),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
@@ -111,7 +111,7 @@ func (c *SystemCollector) collect(ch chan<- prometheus.Metric) (*prometheus.Desc
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(
c.SystemCallsTotal, c.SystemCallsTotal,
prometheus.GaugeValue, prometheus.CounterValue,
float64(dst[0].SystemCallsPersec), float64(dst[0].SystemCallsPersec),
) )
ch <- prometheus.MustNewConstMetric( ch <- prometheus.MustNewConstMetric(