-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Lag is incorrectly calculated in 0.11.5 #1911
Comments
for context, the associated PR is #1878 (with relevant discussion). yes, it does appear as though calculations are now incorrect in the case of special offsets. thanks for reporting. |
So there are two different issues here:
2 is straight forward. |
The high watermark offset is the next offset of the partition, i.e., latest message offset + 1. |
Fixed on master |
Description
We're using Confluent Kafka driver for .NET and after we upgraded to 0.11.5, we started to get incorrect statistics. Since it comes from librdkafka, I opened the issue here. The problem is that lag is now calculated incorrectly, if some of the offsets are set to negative values, here is the example (look at the last two entries):
As far as I can see, the issue comes from d41b086. Lag is now calculated as
hi_offset - max(app_offset, commit_offset)
. The math should take into account situations where partitions are not consumed or messages are not committed and bothapp_offset
/commit_offset
are negative. Probably in this casemax(lo_offset, 0)
should be used for lag calculation.Also it's not clear for the case
AppOffset: 45, CommittedOffset: 44, HighestOffset: 45, Lag: 0
why lag is 0. Shouldn't it be 1? Docs say that app offset is "Offset of last message passed to application + 1", so it means that application has already processed offset 44, but not yet processed offset 45.How to reproduce
Start consuming any topic with autocommit off.
Checklist
debug=..
as necessary) from librdkafkaThe text was updated successfully, but these errors were encountered: