Preserve metric type when using filters in output plugins (#4481)

This commit is contained in:
Shanshi Shi 2018-08-02 06:39:54 +08:00 committed by Greg
parent 4fff507ad6
commit e538433959
1 changed files with 2 additions and 1 deletions

View File

@ -105,12 +105,13 @@ func (ro *RunningOutput) AddMetric(m telegraf.Metric) {
tags := m.Tags()
fields := m.Fields()
t := m.Time()
tp := m.Type()
if ok := ro.Config.Filter.Apply(name, fields, tags); !ok {
ro.MetricsFiltered.Incr(1)
return
}
// 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)