vvcephei commented on a change in pull request #10137:
URL: https://github.com/apache/kafka/pull/10137#discussion_r580416395



##########
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:
       Thanks @ijuma, I considered it, but decided on the current API because:
   1. This is a very quick, local in-memory lookup, so there's no reason to 
batch multiple requests in one
   2. It complicates the return type. We'd have to return either a `Map<TP, 
Long>`, with mappings missing for unknown lags (which creates unfortunate null 
semantics for users), or a `Map<TP, OptionalLong>` which creates a 
complex-to-understand two hop lookup (`lag:=result.get(tp).get()`). Or else, we 
could return a more complex domain object object like @chia7712 proposed in the 
mailing list. All these complications seem like unnecessary complexity in the 
case of this particular API, given the first point.
   
   WDYT?




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


Reply via email to