cmccabe commented on code in PR #16284: URL: https://github.com/apache/kafka/pull/16284#discussion_r1635402522
########## metadata/src/main/java/org/apache/kafka/controller/PartitionChangeBuilder.java: ########## @@ -286,6 +290,8 @@ private ElectionResult electAnyLeader() { .filter(replica -> isAcceptableLeader.test(replica)) .findFirst(); if (uncleanLeader.isPresent()) { + // update "UncleanLeaderElectionsPerSec" metric + metrics.ifPresent(QuorumControllerMetrics::updateUncleanLeaderElection); Review Comment: The metrics for unclean leader elections should be in `ControllerMetadataMetrics`, not here. We can tell if a leader election was unclean if the leader wasn't part of the ISR previously. We cannot put the metrics here because this will not work on standby controllers (the code only gets executed on the active controller). -- 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