From 04937d04988457c73cf14f4254da8cc57c8465d1 Mon Sep 17 00:00:00 2001 From: Alvaro Olmedo Rodriguez Date: Fri, 5 Jul 2019 21:03:52 +0200 Subject: [PATCH] Apply topic filter to partitions metrics in burrow input (#6070) --- plugins/inputs/burrow/burrow.go | 3 +++ plugins/inputs/burrow/burrow_test.go | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/plugins/inputs/burrow/burrow.go b/plugins/inputs/burrow/burrow.go index 9c532e3be..f08563dbd 100644 --- a/plugins/inputs/burrow/burrow.go +++ b/plugins/inputs/burrow/burrow.go @@ -432,6 +432,9 @@ func (b *burrow) genGroupStatusMetrics(r *apiResponse, cluster, group string, ac func (b *burrow) genGroupLagMetrics(r *apiResponse, cluster, group string, acc telegraf.Accumulator) { for _, partition := range r.Status.Partitions { + if !b.filterTopics.Match(partition.Topic) { + continue + } acc.AddFields( "burrow_partition", map[string]interface{}{ diff --git a/plugins/inputs/burrow/burrow_test.go b/plugins/inputs/burrow/burrow_test.go index 3847a5d7c..cafbcb940 100644 --- a/plugins/inputs/burrow/burrow_test.go +++ b/plugins/inputs/burrow/burrow_test.go @@ -262,7 +262,7 @@ func TestFilterGroups(t *testing.T) { acc := &testutil.Accumulator{} plugin.Gather(acc) - require.Exactly(t, 4, len(acc.Metrics)) + require.Exactly(t, 1, len(acc.Metrics)) require.Empty(t, acc.Errors) }