From 68aa3f861b25abcd9cf5a2438d28da3f391678d7 Mon Sep 17 00:00:00 2001 From: Adi Muraru Date: Mon, 20 Sep 2021 12:59:39 +0300 Subject: [PATCH] Implemented review comments --- prometheus/collect_consumer_groups.go | 4 ++-- prometheus/exporter.go | 9 +++------ 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/prometheus/collect_consumer_groups.go b/prometheus/collect_consumer_groups.go index 46d0b3e..78dffd9 100644 --- a/prometheus/collect_consumer_groups.go +++ b/prometheus/collect_consumer_groups.go @@ -58,7 +58,7 @@ func (e *Exporter) collectConsumerGroups(ctx context.Context, ch chan<- promethe topicConsumers := make(map[string]int) topicPartitionsAssigned := make(map[string]int) membersWithEmptyAssignment := 0 - failedAssignmentsDecode := int64(0) + failedAssignmentsDecode := 0 for _, member := range group.Members { kassignment := kmsg.NewGroupMemberAssignment() if err := kassignment.ReadFrom(member.MemberAssignment); err != nil { @@ -84,7 +84,7 @@ func (e *Exporter) collectConsumerGroups(ctx context.Context, ch chan<- promethe e.logger.Error("failed to decode consumer group member assignment, internal kafka error", zap.Error(err), zap.String("group_id", group.Group), - zap.Int64("assignment_decode_failures", failedAssignmentsDecode), + zap.Int("assignment_decode_failures", failedAssignmentsDecode), ) } // number of members with no assignment in a stable consumer group diff --git a/prometheus/exporter.go b/prometheus/exporter.go index b1c19ee..b05fc84 100644 --- a/prometheus/exporter.go +++ b/prometheus/exporter.go @@ -153,24 +153,21 @@ func (e *Exporter) InitializeMetrics() { // Group Empty Memmbers e.consumerGroupMembersEmpty = prometheus.NewDesc( prometheus.BuildFQName(e.cfg.Namespace, "kafka", "consumer_group_empty_members"), - "Consumer Group Empty Members. "+ - "It will report the number of members in the consumer group with no partition assigned", + "It will report the number of members in the consumer group with no partition assigned", []string{"group_id"}, nil, ) // Group Topic Members e.consumerGroupTopicMembers = prometheus.NewDesc( prometheus.BuildFQName(e.cfg.Namespace, "kafka", "consumer_group_topic_members"), - "Consumer Group topic member count metrics. "+ - "It will report the number of members in the consumer group assigned on a given topic", + "It will report the number of members in the consumer group assigned on a given topic", []string{"group_id", "topic_name"}, nil, ) // Group Topic Assigned Partitions e.consumerGroupAssignedTopicPartitions = prometheus.NewDesc( prometheus.BuildFQName(e.cfg.Namespace, "kafka", "consumer_group_topic_assigned_partitions"), - "Consumer Group topic partitions count metrics. "+ - "It will report the number of partitions assigned in the consumer group for a given topic", + "It will report the number of partitions assigned in the consumer group for a given topic", []string{"group_id", "topic_name"}, nil, )