Avoid loop creation in second processor pass (#3656)

This commit is contained in:
Daniel Nelson 2018-01-22 11:16:07 -08:00 committed by GitHub
parent 91fc2765b1
commit 5270aa451c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 1 deletions

View File

@ -308,7 +308,13 @@ func (a *Agent) flusher(shutdown chan struct{}, metricC chan telegraf.Metric, ag
metrics = processor.Apply(metrics...) metrics = processor.Apply(metrics...)
} }
for _, m := range metrics { for _, m := range metrics {
outMetricC <- m for i, o := range a.Config.Outputs {
if i == len(a.Config.Outputs)-1 {
o.AddMetric(m)
} else {
o.AddMetric(m.Copy())
}
}
} }
} }
} }