Apply topic filter to partitions metrics in burrow input (#6070)
This commit is contained in:
parent
370d54b023
commit
04937d0498
|
@ -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{}{
|
||||||
|
|
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue