Add a copy of the input metric when adding to aggregator (#5266)

This commit is contained in:
Daniel Nelson
2019-01-08 11:56:44 -08:00
committed by GitHub
parent 361baaa4bb
commit 0fd08dd65a
2 changed files with 28 additions and 2 deletions

View File

@@ -109,11 +109,12 @@ func (r *RunningAggregator) metricDropped(metric telegraf.Metric) {
// Add a metric to the aggregator and return true if the original metric
// should be dropped.
func (r *RunningAggregator) Add(metric telegraf.Metric) bool {
if ok := r.Config.Filter.Select(metric); !ok {
return false
}
metric = metric.Copy()
r.Config.Filter.Modify(metric)
if len(metric.FieldList()) == 0 {
return r.Config.DropOriginal