mirror of
https://github.com/prometheus/node_exporter.git
synced 2025-03-05 21:00:12 -08:00
netdev: Change valueType to CounterValue (#749)
All the metric only goes up, so the type should be counter. This also add _total to all the metric name. Fix: #747
This commit is contained in:
parent
1527789f76
commit
a96f1738b3
|
@ -59,7 +59,7 @@ func (c *netDevCollector) Update(ch chan<- prometheus.Metric) error {
|
||||||
desc, ok := c.metricDescs[key]
|
desc, ok := c.metricDescs[key]
|
||||||
if !ok {
|
if !ok {
|
||||||
desc = prometheus.NewDesc(
|
desc = prometheus.NewDesc(
|
||||||
prometheus.BuildFQName(namespace, c.subsystem, key),
|
prometheus.BuildFQName(namespace, c.subsystem, key + "_total"),
|
||||||
fmt.Sprintf("Network device statistic %s.", key),
|
fmt.Sprintf("Network device statistic %s.", key),
|
||||||
[]string{"device"},
|
[]string{"device"},
|
||||||
nil,
|
nil,
|
||||||
|
@ -70,7 +70,7 @@ func (c *netDevCollector) Update(ch chan<- prometheus.Metric) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("invalid value %s in netstats: %s", value, err)
|
return fmt.Errorf("invalid value %s in netstats: %s", value, err)
|
||||||
}
|
}
|
||||||
ch <- prometheus.MustNewConstMetric(desc, prometheus.GaugeValue, v, dev)
|
ch <- prometheus.MustNewConstMetric(desc, prometheus.CounterValue, v, dev)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|
Loading…
Reference in a new issue