Start first aggregator period at startup time (#3050)

Fixes issue where metrics collected immediately after startup would not
be aggregated.
This commit is contained in:
Daniel Nelson
2017-07-24 18:25:05 -07:00
committed by GitHub
parent ab5205f8c3
commit 573bd4aa32
3 changed files with 7 additions and 5 deletions

View File

@@ -364,6 +364,8 @@ 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)
@@ -404,7 +406,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, shutdown)
agg.Run(acc, now, shutdown)
}(aggregator)
}