Apply topic filter to partitions metrics in burrow input (#6070)

This commit is contained in:
Alvaro Olmedo Rodriguez 2019-07-05 21:03:52 +02:00 committed by Daniel Nelson
parent 370d54b023
commit 04937d0498
2 changed files with 4 additions and 1 deletions

View File

@ -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) { func (b *burrow) genGroupLagMetrics(r *apiResponse, cluster, group string, acc telegraf.Accumulator) {
for _, partition := range r.Status.Partitions { for _, partition := range r.Status.Partitions {
if !b.filterTopics.Match(partition.Topic) {
continue
}
acc.AddFields( acc.AddFields(
"burrow_partition", "burrow_partition",
map[string]interface{}{ map[string]interface{}{

View File

@ -262,7 +262,7 @@ func TestFilterGroups(t *testing.T) {
acc := &testutil.Accumulator{} acc := &testutil.Accumulator{}
plugin.Gather(acc) plugin.Gather(acc)
require.Exactly(t, 4, len(acc.Metrics)) require.Exactly(t, 1, len(acc.Metrics))
require.Empty(t, acc.Errors) require.Empty(t, acc.Errors)
} }