-
Notifications
You must be signed in to change notification settings - Fork 814
Expose the calculated lag to Readers configured with a GroupID #346
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Thanks for the pull request @wekb! The reason why we did not report this value when the reader is configured to join a consumer group is that the value was inaccurate. With a consumer group the reader may be handling multiple partitions and therefore just a single lag value is not representative and hard to make sense of if only 1 out of N partitions owned by a reader is lagging. Is there something special about your setup that makes it possible to use this value for lag? (for example, do you have as many consumers as partitions?) |
Our use case in this scenario is guaranteed to have one partition—we need strict ordering, and the overall throughput requirements are modest. In a hypothetical multiple-partition case, if the single lag value was always the highest lag value for a given partition, it would still be useful in our case. Otherwise yeah, at best it's misleading. We also noticed the recent ConsumerGroups work, but I haven't had a chance yet to see if it exposes the lag (or at least the most recent offset from the topic, which I'd be happy to calculate separately). Thanks for the feedback! |
Does ConsumerGroups provide more granular lag reporting, or would this change be useful with a documented caveat? |
Revert "Change package for this branch so it can be imported" This reverts commit 0e4740b.
The Does that sound like it would address your use case? |
Yes. The forked version of kafka-go that we use has this PR applied and it's been working well. Obviously being able to grab the topic lag on a per-partition basis is useful, but for single-partition use cases like ours, lag for the single partition is enough. |
@wekb How does it report lag for you? for me it reports
|
Kafka-go doesn't provide a native way to check Lag when using consumerGroup. we've to remove hardcoded return -1 from segmentio/kafka-go reader.go This patch will only work for `1 partition` segmentio/kafka-go#346
We have a use case where seeing the lag for a given topic/partition is almost critical. kafka-go already tracks this internally, and it would be good to be able to read this value in the context of a Consumer Group. This change works fine here, but I'd rather not continue using a fork.
Worst-case, if there are fatal flaws with exposing this, or perhaps non-fatal caveats, they could be added to the README to good effect.
Thanks!