I'd like to add a kafka consumer lag input plugin to telegraf, and for that I need a Golang client that supports the ListConsumerGroupOffsets call.
But as best I can tell this isn't currently available in librdkafka's AdminClient implementation (and therefore unavailable in confluent-kafka-go).
So this ticket is to track adding it.
Note that I'm a total n00b to C, so I may be just misreading the librdkafka code and this call may already be there...
One design comment, since I just added this method to the kafka-python client:
ListConsumerGroupOffsets is a very chatty call because it will first lookup the group's coordinator. So it requires two network round trips.ListConsumerGroups to have an optional param of specifying a single broker and ListConsumerGroupOffsets to have an optional param of specifying a known group coordinator than you can leverage this to nearly halve the number of network calls required to fetch offsets for all consumer groups:ListConsumerGroups against each one.ListConsumerGroupOffsets, using the group coordinator identified above. Java doesn't currently support these overrides, but they were useful enough that we chose to include them in kafka-python, even though in general we try to follow the Java clients very closely: https://kafka-python.readthedocs.io/en/master/apidoc/KafkaAdminClient.html#kafka.admin.KafkaAdminClient.list_consumer_group_offsets
Similarly, I added optional support for specifying which partitions you want the offsets for. If omitted, then all known offsets are returned (requires KIP-88 which landed in brokers >= 0.10.2).
You can see how I then leveraged this when patching the Datadog check here:
https://github.com/DataDog/integrations-core/pull/2730/files#diff-deed983f73a04522ac621d7f6d0c8403R248
If no one else picks this up, I'll take a stab at this...
Hey Jeff!
The plan is to add the missing Admin API pieces early this year.
As for all-consumer-groups-in-cluster optimizations: that's an interesting problem.. and solution :)
Will look into it more and ping you when the time comes.
Hi @edenhill any plans to extend admin client with this API in upcoming releases? Possibility to query consumer offsets would enable new interesting scenarios like automation of scaling, monitoring of lag before maintenance actions like re-partition and etc.
Any updates?
Querying consumer offsets is a very useful feature! Please consider implementing without this workaround
Hi @edenhill, can you share what are the plans regarding this feature in terms of work planning? It would be really great to have feature parity with Java client in this area. Currently it is real pain because we need to develop dedicated app/microservice in Java just to be able to read consumer group offsets, and we are not a Java software house.
We'll be looking at catching up the Admin API in Q3
Is it still considered for Q3?
Most helpful comment
Hi @edenhill any plans to extend admin client with this API in upcoming releases? Possibility to query consumer offsets would enable new interesting scenarios like automation of scaling, monitoring of lag before maintenance actions like re-partition and etc.