Skip to content

Commit

Permalink
Implemented review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
amuraru committed Sep 20, 2021
1 parent 249d16b commit 68aa3f8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
4 changes: 2 additions & 2 deletions prometheus/collect_consumer_groups.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
Expand Down
9 changes: 3 additions & 6 deletions prometheus/exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Expand Down

0 comments on commit 68aa3f8

Please sign in to comment.