netdev: use counters instead of gauges.

pull/88/head
Siavash Safi 10 years ago
parent c651d7ccd9
commit 9b6843db60

@ -25,7 +25,7 @@ const (
type netDevCollector struct { type netDevCollector struct {
config Config config Config
metrics map[string]*prometheus.GaugeVec metrics map[string]*prometheus.CounterVec
} }
func init() { func init() {
@ -37,7 +37,7 @@ func init() {
func NewNetDevCollector(config Config) (Collector, error) { func NewNetDevCollector(config Config) (Collector, error) {
return &netDevCollector{ return &netDevCollector{
config: config, config: config,
metrics: map[string]*prometheus.GaugeVec{}, metrics: map[string]*prometheus.CounterVec{},
}, nil }, nil
} }
@ -51,8 +51,8 @@ func (c *netDevCollector) Update(ch chan<- prometheus.Metric) (err error) {
for t, value := range stats { for t, value := range stats {
key := direction + "_" + t key := direction + "_" + t
if _, ok := c.metrics[key]; !ok { if _, ok := c.metrics[key]; !ok {
c.metrics[key] = prometheus.NewGaugeVec( c.metrics[key] = prometheus.NewCounterVec(
prometheus.GaugeOpts{ prometheus.CounterOpts{
Namespace: Namespace, Namespace: Namespace,
Subsystem: netDevSubsystem, Subsystem: netDevSubsystem,
Name: key, Name: key,

Loading…
Cancel
Save