From a96f1738b3dd4c97af3a8094aac53303314d82ff Mon Sep 17 00:00:00 2001 From: Kristian Klausen Date: Wed, 6 Dec 2017 13:58:35 +0100 Subject: [PATCH] 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 --- collector/netdev_common.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/collector/netdev_common.go b/collector/netdev_common.go index dee69e13..f7bb5c2f 100644 --- a/collector/netdev_common.go +++ b/collector/netdev_common.go @@ -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, @@ -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