vvcephei commented on a change in pull request #10137: URL: https://github.com/apache/kafka/pull/10137#discussion_r581156179
########## File path: clients/src/main/java/org/apache/kafka/clients/consumer/Consumer.java ########## @@ -243,6 +244,11 @@ */ Map<TopicPartition, Long> endOffsets(Collection<TopicPartition> partitions, Duration timeout); + /** + * @see KafkaConsumer#currentLag(TopicPartition) + */ + OptionalLong currentLag(TopicPartition topicPartition); Review comment: That's a good point, @guozhangwang. Entering the synchronized block will have some overhead each time it's called. I think we can just reason about the use cases here. My guess is that people would either tend to spot-check specific lags, as we are doing here, or they would tend to periodically check all lags. In the former case, I'd hazard that the current API is fine. In the latter case, we'd face more overhead. I'm sure this is motivated reasoning, but perhaps we can lump the latter case in with @chia7712 's suggestion to expose more metadata and defer it to the future. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org