ahuang98 commented on code in PR #17139: URL: https://github.com/apache/kafka/pull/17139#discussion_r1889133115
########## clients/src/main/java/org/apache/kafka/clients/consumer/internals/metrics/KafkaConsumerMetrics.java: ########## @@ -91,16 +92,20 @@ public KafkaConsumerMetrics(Metrics metrics, String metricGrpPrefix) { } public void recordPollStart(long pollStartMs) { + if (this.pollEndMs != 0) { + long pollIntervalMs = pollStartMs - this.pollStartMs; + long pollTimeMs = this.pollEndMs - this.pollStartMs; + double pollIdleRatio = pollTimeMs * 1.0 / pollIntervalMs; + this.pollIdleSensor.record(pollIdleRatio); + } Review Comment: this method would benefit from some comments -- 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