Merge pull request #331 from nbellowe/bug-cpu-counter-not-gauge

Counter metrics should be exposed as counter rather than gauge
This commit is contained in:
Calle Pettersson 2019-04-11 21:18:15 +02:00 committed by GitHub
commit afc3655a41
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -148,50 +148,50 @@ func (c *CPUCollector) collect(ch chan<- prometheus.Metric) (*prometheus.Desc, e
ch <- prometheus.MustNewConstMetric(
c.CStateSecondsTotal,
prometheus.GaugeValue,
prometheus.CounterValue,
float64(data.PercentC1Time)*ticksToSecondsScaleFactor,
core, "c1",
)
ch <- prometheus.MustNewConstMetric(
c.CStateSecondsTotal,
prometheus.GaugeValue,
prometheus.CounterValue,
float64(data.PercentC2Time)*ticksToSecondsScaleFactor,
core, "c2",
)
ch <- prometheus.MustNewConstMetric(
c.CStateSecondsTotal,
prometheus.GaugeValue,
prometheus.CounterValue,
float64(data.PercentC3Time)*ticksToSecondsScaleFactor,
core, "c3",
)
ch <- prometheus.MustNewConstMetric(
c.TimeTotal,
prometheus.GaugeValue,
prometheus.CounterValue,
float64(data.PercentIdleTime)*ticksToSecondsScaleFactor,
core, "idle",
)
ch <- prometheus.MustNewConstMetric(
c.TimeTotal,
prometheus.GaugeValue,
prometheus.CounterValue,
float64(data.PercentInterruptTime)*ticksToSecondsScaleFactor,
core, "interrupt",
)
ch <- prometheus.MustNewConstMetric(
c.TimeTotal,
prometheus.GaugeValue,
prometheus.CounterValue,
float64(data.PercentDPCTime)*ticksToSecondsScaleFactor,
core, "dpc",
)
ch <- prometheus.MustNewConstMetric(
c.TimeTotal,
prometheus.GaugeValue,
prometheus.CounterValue,
float64(data.PercentPrivilegedTime)*ticksToSecondsScaleFactor,
core, "privileged",
)
ch <- prometheus.MustNewConstMetric(
c.TimeTotal,
prometheus.GaugeValue,
prometheus.CounterValue,
float64(data.PercentUserTime)*ticksToSecondsScaleFactor,
core, "user",
)