srdo commented on code in PR #17139:
URL: https://github.com/apache/kafka/pull/17139#discussion_r1889212838


##########
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:
   Will add some, though I'll likely move these updates into recordPollEnd 
along with changing the polling interval to be based on the end timestamps 
instead of the start timestamps.
   
   The poll(0ms) case you're thinking of I assume is regarding division by 0 
here? 



-- 
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

Reply via email to