jsancio commented on code in PR #15859: URL: https://github.com/apache/kafka/pull/15859#discussion_r1599163932
########## raft/src/main/java/org/apache/kafka/raft/internals/KafkaRaftMetrics.java: ########## @@ -87,17 +89,34 @@ 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 id; -1 indicates not voted for anyone"); metrics.addMetric(this.currentVotedIdMetricName, (mConfig, currentTimeMs) -> { if (state.isLeader() || state.isCandidate()) { return state.localIdOrThrow(); - } else if (state.isVoted()) { - return state.votedStateOrThrow().votedId(); } else { - return -1; + return (double) state.maybeVotedState() Review Comment: I am not 100% of the issue. Maybe Java 8 doen't do implicit casting if the value is not a number literal. But yes. The error was a runtime casting error from `Integer` to `Double`. -- 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