ahuang98 commented on code in PR #17139: URL: https://github.com/apache/kafka/pull/17139#discussion_r1889140772
########## clients/src/test/java/org/apache/kafka/clients/consumer/KafkaConsumerTest.java: ########## @@ -3098,31 +3098,53 @@ public void testPollIdleRatio(GroupProtocol groupProtocol) { assertEquals(Double.NaN, consumer.metrics().get(pollIdleRatio).metricValue()); // 1st poll - // Spend 50ms in poll so value = 1.0 + // Spend 50ms in poll. value=NaN because "the fraction of time spent inside poll" is undefined until the polling interval has an end point, + // which is only known once the second poll starts. + // This also means the metric will always exclude the latest poll, since we don't know how much time is spent outside poll for that interval + // until poll is called again Review Comment: wouldn't this not be an issue if we instead calculated (pollEnd - pollStart) / (pollEnd - lastPollEnd) -- 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