Fix counter and gauge metric types. (#3232)
(cherry picked from commit fa1982323a
)
This commit is contained in:
parent
7ec194a482
commit
a727d5d1f0
|
@ -251,14 +251,14 @@ func (s *Statsd) Gather(acc telegraf.Accumulator) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, metric := range s.gauges {
|
for _, metric := range s.gauges {
|
||||||
acc.AddFields(metric.name, metric.fields, metric.tags, now)
|
acc.AddGauge(metric.name, metric.fields, metric.tags, now)
|
||||||
}
|
}
|
||||||
if s.DeleteGauges {
|
if s.DeleteGauges {
|
||||||
s.gauges = make(map[string]cachedgauge)
|
s.gauges = make(map[string]cachedgauge)
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, metric := range s.counters {
|
for _, metric := range s.counters {
|
||||||
acc.AddFields(metric.name, metric.fields, metric.tags, now)
|
acc.AddCounter(metric.name, metric.fields, metric.tags, now)
|
||||||
}
|
}
|
||||||
if s.DeleteCounters {
|
if s.DeleteCounters {
|
||||||
s.counters = make(map[string]cachedcounter)
|
s.counters = make(map[string]cachedcounter)
|
||||||
|
|
Loading…
Reference in New Issue