Skip to content

Commit

Permalink
netdev: Change valueType to CounterValue (prometheus#749)
Browse files Browse the repository at this point in the history
All the metric only goes up, so the type should be counter.
This also add _total to all the metric name.

Fix: prometheus#747
  • Loading branch information
klausenbusk authored and oblitorum committed Apr 9, 2024
1 parent c874fc4 commit e1a7e93
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions collector/netdev_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
Expand Down

0 comments on commit e1a7e93

Please sign in to comment.