diff --git a/agent/accumulator.go b/agent/accumulator.go index 1fa9b13ee..51c213a81 100644 --- a/agent/accumulator.go +++ b/agent/accumulator.go @@ -26,7 +26,7 @@ type MetricMaker interface { func NewAccumulator( maker MetricMaker, metrics chan telegraf.Metric, -) *accumulator { +) telegraf.Accumulator { acc := accumulator{ maker: maker, metrics: metrics, diff --git a/agent/accumulator_test.go b/agent/accumulator_test.go index e13446bac..c3f552d9e 100644 --- a/agent/accumulator_test.go +++ b/agent/accumulator_test.go @@ -115,15 +115,15 @@ func TestAddNoIntervalWithPrecision(t *testing.T) { map[string]interface{}{"value": float64(101)}, map[string]string{"acc": "test"}, now) - testm := <-a.metrics + testm := <-metrics actual := testm.String() assert.Contains(t, actual, "acctest value=101") - testm = <-a.metrics + testm = <-metrics actual = testm.String() assert.Contains(t, actual, "acctest,acc=test value=101") - testm = <-a.metrics + testm = <-metrics actual = testm.String() assert.Equal(t, fmt.Sprintf("acctest,acc=test value=101 %d\n", int64(1139572800000000000)), @@ -147,15 +147,15 @@ func TestAddDisablePrecision(t *testing.T) { map[string]interface{}{"value": float64(101)}, map[string]string{"acc": "test"}, now) - testm := <-a.metrics + testm := <-metrics actual := testm.String() assert.Contains(t, actual, "acctest value=101") - testm = <-a.metrics + testm = <-metrics actual = testm.String() assert.Contains(t, actual, "acctest,acc=test value=101") - testm = <-a.metrics + testm = <-metrics actual = testm.String() assert.Equal(t, fmt.Sprintf("acctest,acc=test value=101 %d\n", int64(1139572800082912748)), @@ -179,15 +179,15 @@ func TestAddNoPrecisionWithInterval(t *testing.T) { map[string]interface{}{"value": float64(101)}, map[string]string{"acc": "test"}, now) - testm := <-a.metrics + testm := <-metrics actual := testm.String() assert.Contains(t, actual, "acctest value=101") - testm = <-a.metrics + testm = <-metrics actual = testm.String() assert.Contains(t, actual, "acctest,acc=test value=101") - testm = <-a.metrics + testm = <-metrics actual = testm.String() assert.Equal(t, fmt.Sprintf("acctest,acc=test value=101 %d\n", int64(1139572800000000000)), @@ -204,7 +204,7 @@ func TestDifferentPrecisions(t *testing.T) { a.AddFields("acctest", map[string]interface{}{"value": float64(101)}, map[string]string{"acc": "test"}, now) - testm := <-a.metrics + testm := <-metrics actual := testm.String() assert.Equal(t, fmt.Sprintf("acctest,acc=test value=101 %d\n", int64(1139572800000000000)), @@ -214,7 +214,7 @@ func TestDifferentPrecisions(t *testing.T) { a.AddFields("acctest", map[string]interface{}{"value": float64(101)}, map[string]string{"acc": "test"}, now) - testm = <-a.metrics + testm = <-metrics actual = testm.String() assert.Equal(t, fmt.Sprintf("acctest,acc=test value=101 %d\n", int64(1139572800083000000)), @@ -224,7 +224,7 @@ func TestDifferentPrecisions(t *testing.T) { a.AddFields("acctest", map[string]interface{}{"value": float64(101)}, map[string]string{"acc": "test"}, now) - testm = <-a.metrics + testm = <-metrics actual = testm.String() assert.Equal(t, fmt.Sprintf("acctest,acc=test value=101 %d\n", int64(1139572800082913000)), @@ -234,7 +234,7 @@ func TestDifferentPrecisions(t *testing.T) { a.AddFields("acctest", map[string]interface{}{"value": float64(101)}, map[string]string{"acc": "test"}, now) - testm = <-a.metrics + testm = <-metrics actual = testm.String() assert.Equal(t, fmt.Sprintf("acctest,acc=test value=101 %d\n", int64(1139572800082912748)), diff --git a/agent/agent.go b/agent/agent.go index b1250cc9f..5ca3de882 100644 --- a/agent/agent.go +++ b/agent/agent.go @@ -143,7 +143,7 @@ func (a *Agent) gatherer( func gatherWithTimeout( shutdown chan struct{}, input *models.RunningInput, - acc *accumulator, + acc telegraf.Accumulator, timeout time.Duration, ) { ticker := time.NewTicker(timeout)