From a4cbed24eda706c689a29971920cd04062158bd8 Mon Sep 17 00:00:00 2001 From: Michal Padula Date: Mon, 4 Apr 2022 17:22:03 +0200 Subject: [PATCH] Increase membersWithEmptyAssignment when MemberAssignment is empty Signed-off-by: Michal Padula --- prometheus/collect_consumer_groups.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/prometheus/collect_consumer_groups.go b/prometheus/collect_consumer_groups.go index 5fdde4d..438dae6 100644 --- a/prometheus/collect_consumer_groups.go +++ b/prometheus/collect_consumer_groups.go @@ -68,6 +68,11 @@ func (e *Exporter) collectConsumerGroups(ctx context.Context, ch chan<- promethe membersWithEmptyAssignment := 0 failedAssignmentsDecode := 0 for _, member := range group.Members { + if len(member.MemberAssignment) == 0 { + membersWithEmptyAssignment++ + continue + } + kassignment, err := decodeMemberAssignments(group.ProtocolType, member) if err != nil { e.logger.Debug("failed to decode consumer group member assignment, internal kafka error",