Skip to content
Snippets Groups Projects
Commit a96f1738 authored by Kristian Klausen's avatar Kristian Klausen Committed by Ben Kochie
Browse files

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
parent 1527789f
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -59,7 +59,7 @@ func (c *netDevCollector) Update(ch chan<- prometheus.Metric) error {
desc, ok := c.metricDescs[key]
if !ok {
desc = prometheus.NewDesc(
prometheus.BuildFQName(namespace, c.subsystem, key),
prometheus.BuildFQName(namespace, c.subsystem, key + "_total"),
fmt.Sprintf("Network device statistic %s.", key),
[]string{"device"},
nil,
Loading
Loading
@@ -70,7 +70,7 @@ func (c *netDevCollector) Update(ch chan<- prometheus.Metric) error {
if err != nil {
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
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment