-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
can't calculate offset lag if consuming with KafkaConsumer #509
Comments
I was able to reproduce this with one modification: I had to try to consume with the group_id before producing. Other than that I get the same issue: bin/kafka-consumer-offset-checker.sh works when consuming with either SimpleConsumer or KafkaConsumer. But the in-code method (per @dribler code) only works with SimpleConsumer. Anything else I can try to help debug this? |
Couple thoughts -- first, the I believe the broker throws Also, please note that the 'Simple' interfaces -- Client / Consumer / Producer -- are being deprecated. I'll put some thought into where lag monitoring fits. I believe the java client includes it as part of the metrics system? |
Re new apis: I expect we'll follow KAFKA-2076 when it is finalized. |
So is there any way to do lag monitoring now with v1 storage? I get exception when calling send_offset_fetch_request_kafka() from SimpleClient:
|
@dpkp I realize lag monitoring will have to wait until KAFKA-2076. But is there any way to get lag with v1 storage in the new client? We really want to upgrade to 0.9 and the new client but not being able to monitor log is the final hurdle. |
at the lowest level you would do this:
That's a little messy -- you have to manage keeping track of coordinator, dealing with api error codes, and parsing partition info. And the protocol classes aren't fully documented or even finalized (they should be easier to use). In any event, I'll try to get something added to KafkaConsumer soon. |
I've added highwater() method to KafkaConsumer. From a consumer instance you can calculate a lag value for any partition by ( highwater - position ). You will not be able to use this approach out of process because it depends on the consumer actually fetching messages. But it may be useful as a start. |
Is there any way to use this to fetch the lag without actually fetching the message? Actually, looks like what I'm really looking for is this: #633 (comment) |
@ saluker do you resolve the problem ? |
@FizLBQ I was waiting for KAFKA-2076 and KIP-79 and then for it to be implemented in kafka-python to retest. Looks like KAFKA-2076 and KIP-79 are done as of a few months ago. @dpkp is that in kafka-python? If so happy to help test! |
The way I typically calculate lag is with the
|
See #1036 re: KIP-79 support, which would allow accessing the highwater offset for a partition without having the partition assigned / during consumer loop. |
Also relevant is #950 / KIP-88 |
See also #1643 which adds |
Hi, faced with strange issue trying to calculate consumer offset lag. This is on kafka 0.9.0.0.
How to reproduce:
Creating topic like this:
Then produce some messages:
On other side half messages were consumed with:
Now we see correct total lag - 5:
i'm trying to get same value with following code:
but getting UnknownTopicOrPartitionError: UnknownTopicOrPartitionError - 3 - This request is for a topic or partition that does not exist on this broker.
if i do same: create, produce, but consume with:
i'm getting correct lag with my code, and it is same as see with kafka-consumer-offset-checker
A bit confusing issue, probably i'm doing something wrong, so let me know if it is.
The text was updated successfully, but these errors were encountered: