Preserve metric type when using filters in output plugins (#4481)
This commit is contained in:
parent
4fff507ad6
commit
e538433959
|
@ -105,12 +105,13 @@ func (ro *RunningOutput) AddMetric(m telegraf.Metric) {
|
||||||
tags := m.Tags()
|
tags := m.Tags()
|
||||||
fields := m.Fields()
|
fields := m.Fields()
|
||||||
t := m.Time()
|
t := m.Time()
|
||||||
|
tp := m.Type()
|
||||||
if ok := ro.Config.Filter.Apply(name, fields, tags); !ok {
|
if ok := ro.Config.Filter.Apply(name, fields, tags); !ok {
|
||||||
ro.MetricsFiltered.Incr(1)
|
ro.MetricsFiltered.Incr(1)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// error is not possible if creating from another metric, so ignore.
|
// error is not possible if creating from another metric, so ignore.
|
||||||
m, _ = metric.New(name, tags, fields, t)
|
m, _ = metric.New(name, tags, fields, t, tp)
|
||||||
}
|
}
|
||||||
|
|
||||||
ro.metrics.Add(m)
|
ro.metrics.Add(m)
|
||||||
|
|
Loading…
Reference in New Issue