From e5384339599161e48b8d32770cbb32a2c8e9df9a Mon Sep 17 00:00:00 2001 From: Shanshi Shi Date: Thu, 2 Aug 2018 06:39:54 +0800 Subject: [PATCH] Preserve metric type when using filters in output plugins (#4481) --- internal/models/running_output.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/models/running_output.go b/internal/models/running_output.go index 713c28cce..a0d1f6b03 100644 --- a/internal/models/running_output.go +++ b/internal/models/running_output.go @@ -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)