jeffkbkim commented on code in PR #14848: URL: https://github.com/apache/kafka/pull/14848#discussion_r1424175673
########## group-coordinator/src/main/java/org/apache/kafka/coordinator/group/metrics/GroupCoordinatorMetrics.java: ########## @@ -29,44 +28,75 @@ import java.util.Arrays; import java.util.Collections; -import java.util.HashMap; import java.util.Map; import java.util.Objects; -import java.util.concurrent.atomic.AtomicLong; +import java.util.concurrent.ConcurrentHashMap; /** * These are the metrics which are managed by the {@link org.apache.kafka.coordinator.group.GroupMetadataManager} class. * They generally pertain to aspects of group management, such as the number of groups in different states. */ public class GroupCoordinatorMetrics extends CoordinatorMetrics implements AutoCloseable { + + enum GenericGroupState { + ALL("all"), + PREPARING_REBALANCE("PreparingRebalance"), + COMPLETING_REBALANCE("CompletingRebalance"), + STABLE("Stable"), + DEAD("Dead"), + EMPTY("Empty"); + + private final String name; + + GenericGroupState(String name) { + this.name = name; + } + + @Override + public String toString() { + return name; + } + } + + enum ConsumerGroupState { + ALL("all"), + EMPTY("empty"), + ASSIGNING("assigning"), + RECONCILING("reconciling"), + STABLE("stable"), + DEAD("dead"); + + private final String name; + + ConsumerGroupState(String name) { + this.name = name; + } + + @Override + public String toString() { + return name; + } + } + public static final String METRICS_GROUP = "group-coordinator-metrics"; - public final static MetricName NUM_OFFSETS = getMetricName( + public final static com.yammer.metrics.core.MetricName NUM_OFFSETS = getMetricName( "GroupMetadataManager", "NumOffsets"); - public final static MetricName NUM_GENERIC_GROUPS = getMetricName( + public final static com.yammer.metrics.core.MetricName NUM_GENERIC_GROUPS = getMetricName( "GroupMetadataManager", "NumGroups"); - public final static MetricName NUM_GENERIC_GROUPS_PREPARING_REBALANCE = getMetricName( + public final static com.yammer.metrics.core.MetricName NUM_GENERIC_GROUPS_PREPARING_REBALANCE = getMetricName( "GroupMetadataManager", "NumGroupsPreparingRebalance"); - public final static MetricName NUM_GENERIC_GROUPS_COMPLETING_REBALANCE = getMetricName( + public final static com.yammer.metrics.core.MetricName NUM_GENERIC_GROUPS_COMPLETING_REBALANCE = getMetricName( "GroupMetadataManager", "NumGroupsCompletingRebalance"); - public final static MetricName NUM_GENERIC_GROUPS_STABLE = getMetricName( + public final static com.yammer.metrics.core.MetricName NUM_GENERIC_GROUPS_STABLE = getMetricName( "GroupMetadataManager", "NumGroupsStable"); - public final static MetricName NUM_GENERIC_GROUPS_DEAD = getMetricName( + public final static com.yammer.metrics.core.MetricName NUM_GENERIC_GROUPS_DEAD = getMetricName( "GroupMetadataManager", "NumGroupsDead"); - public final static MetricName NUM_GENERIC_GROUPS_EMPTY = getMetricName( + public final static com.yammer.metrics.core.MetricName NUM_GENERIC_GROUPS_EMPTY = getMetricName( "GroupMetadataManager", "NumGroupsEmpty"); - public final static MetricName NUM_CONSUMER_GROUPS = getMetricName( - "GroupMetadataManager", "NumConsumerGroups"); - public final static MetricName NUM_CONSUMER_GROUPS_EMPTY = getMetricName( - "GroupMetadataManager", "NumConsumerGroupsEmpty"); - public final static MetricName NUM_CONSUMER_GROUPS_ASSIGNING = getMetricName( - "GroupMetadataManager", "NumConsumerGroupsAssigning"); - public final static MetricName NUM_CONSUMER_GROUPS_RECONCILING = getMetricName( - "GroupMetadataManager", "NumConsumerGroupsReconciling"); - public final static MetricName NUM_CONSUMER_GROUPS_STABLE = getMetricName( - "GroupMetadataManager", "NumConsumerGroupsStable"); - public final static MetricName NUM_CONSUMER_GROUPS_DEAD = getMetricName( - "GroupMetadataManager", "NumConsumerGroupsDead"); + + public final static String NUM_CONSUMER_GROUPS_METRIC_NAME = "consumer-groups-size"; Review Comment: should we rename the variables? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org