diff --git a/agent/accumulator.go b/agent/accumulator.go index 1fa9b13ee9862becd53b42f099c4ccaacc88c394..51c213a8109eb9fc167508f51a43f27e82b433cf 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 e13446bac4cc07cd1fb9ebf2f5a423bb7a82d1dd..c3f552d9e7e5cb296cd7eb4d9df619afd92624e2 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 b1250cc9f5caf78553ff98b6aab2a4bfe4845868..5ca3de8824746f86d6cc91d20365e85c0fad45d8 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)