Align aggregator period with internal ticker to avoid skipping metrics (#3693)

By the time the aggregator.run() was called about 600ms already passed since setting now which was skewing up the aggregation intervals and skipping metrics.
This commit is contained in:
Piotr Popieluch
2018-01-19 02:37:53 +01:00
committed by Daniel Nelson
parent 0f55d9eba2
commit 601dc99606
3 changed files with 5 additions and 7 deletions

View File

@@ -364,8 +364,6 @@ func (a *Agent) Run(shutdown chan struct{}) error {
metricC := make(chan telegraf.Metric, 100)
aggC := make(chan telegraf.Metric, 100)
now := time.Now()
// Start all ServicePlugins
for _, input := range a.Config.Inputs {
input.SetDefaultTags(a.Config.Tags)
@@ -406,7 +404,7 @@ func (a *Agent) Run(shutdown chan struct{}) error {
acc := NewAccumulator(agg, aggC)
acc.SetPrecision(a.Config.Agent.Precision.Duration,
a.Config.Agent.Interval.Duration)
agg.Run(acc, now, shutdown)
agg.Run(acc, shutdown)
}(aggregator)
}