Description
Description:
Hi Confluent team! 👋
First, thank you for maintaining the confluent-kafka-go
library—it’s been incredibly helpful. I’m writing to inquire about a feature present in the Java Kafka client that’s currently missing in the Go implementation: consumer partition lag tracking.
In the Java client, KafkaConsumer
provides method
org.apache.kafka.clients.consumer.internals.SubscriptionState#partitionLag
or org.apache.kafka.clients.consumer.internals.AsyncKafkaConsumer#currentLag
In confluent-kafka-go
there’s no built-in way to directly retrieve partition lag. This requires developers to manually calculate lag, which can be error-prone. Especially if the topic contains transaction control records that cannot be consumed but increase the offset of the topic.
Questions:
- Is there a plan to add a convenience method (e.g.,
GetPartitionLag()
) or expose consumer metrics likerecords-lag
in the Go library? - If this is not on the roadmap, could you recommend a best practice for calculating partition lag with the current API (e.g., combining
QueryWatermarkOffsets
andPosition
)? - Are there any limitations or caveats to be aware of when calculating lag manually in Go?
Example Use Case:
// consume entire topic
while(partitionConsumer.currentLag > 0 ){
// keep consuming
}
// end of topic reached
Java Reference:
Thank you for your time and insights! 🙏