dengziming commented on code in PR #12724:
URL: https://github.com/apache/kafka/pull/12724#discussion_r1032107975
##########
raft/src/main/java/org/apache/kafka/raft/internals/KafkaRaftMetrics.java:
##########
@@ -84,9 +84,9 @@ public KafkaRaftMetrics(Metrics metrics, String
metricGrpPrefix, QuorumState sta
this.currentLeaderIdMetricName = metrics.metricName("current-leader",
metricGroupName, "The current quorum leader's id; -1 indicates unknown");
metrics.addMetric(this.currentLeaderIdMetricName, (mConfig,
currentTimeMs) -> state.leaderId().orElse(-1));
- this.currentVotedIdMetricName = metrics.metricName("current-vote",
metricGroupName, "The current voted leader's id; -1 indicates not voted for
anyone");
+ this.currentVotedIdMetricName = metrics.metricName("current-vote",
metricGroupName, "The current voted leader's id; -1 indicates not under
election state or not voted for anyone");
metrics.addMetric(this.currentVotedIdMetricName, (mConfig,
currentTimeMs) -> {
- if (state.isLeader() || state.isCandidate()) {
+ if (state.isCandidate()) {
Review Comment:
Not sure is this change necessary, if a node is leader, we can also believe
it voted for itself.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]