FrankYang0529 commented on code in PR #17199: URL: https://github.com/apache/kafka/pull/17199#discussion_r1850051456
########## clients/src/main/java/org/apache/kafka/clients/consumer/internals/NetworkClientDelegate.java: ########## @@ -173,6 +178,7 @@ private void trySend(final long currentTimeMs) { unsent.timer.update(currentTimeMs); if (unsent.timer.isExpired()) { iterator.remove(); + kafkaConsumerMetrics.ifPresent(metrics -> metrics.recordUnsentRequestsQueueTime(this.time.milliseconds() - unsent.enqueuedMs())); Review Comment: Hi @lianetm, we may need to keep `time.milliseconds()` here. The `currentTimeMs` is set when `runOnce` starts. However, the `enqueueTimeMs` (original `enqueuedMs`) is set when the request is added to the `unsentRequests`. It's after `currentTimeMs`. We will get negative result if using `currentTimeMs` 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