Fixup some code based on feedback from @dgnorton

This commit is contained in:
Cameron Sparr
2016-10-07 16:43:44 +01:00
parent 9540a6532f
commit 03b2984ac2
7 changed files with 38 additions and 44 deletions

View File

@@ -19,6 +19,7 @@ import (
// applyFilter: if false, the above filter is not applied to each metric.
// This is used by Aggregators, because aggregators use filters
// on incoming metrics instead of on created metrics.
// TODO refactor this to not have such a huge func signature.
func makemetric(
measurement string,
fields map[string]interface{},

View File

@@ -109,13 +109,6 @@ func (r *RunningAggregator) Run(
acc telegraf.Accumulator,
shutdown chan struct{},
) {
if r.Config.Delay == 0 {
r.Config.Delay = time.Millisecond * 100
}
if r.Config.Period == 0 {
r.Config.Period = time.Second * 30
}
time.Sleep(r.Config.Delay)
periodT := time.NewTicker(r.Config.Period)
defer periodT.Stop()

View File

@@ -20,6 +20,7 @@ func TestAdd(t *testing.T) {
Filter: Filter{
NamePass: []string{"*"},
},
Period: time.Millisecond * 500,
})
assert.NoError(t, ra.Config.Filter.Compile())
acc := testutil.Accumulator{}