confluent-kafka-javascript icon indicating copy to clipboard operation
confluent-kafka-javascript copied to clipboard

any way to get the librdkafka statistics from a promisified api?

Open sakari opened this issue 9 months ago • 4 comments

stats_cb does not seem to be supported. Is there a particular reason for this or just simple matter of coding?

Other than implementing that is there any other way to get the statistics? I'm mostly interested in queue sizes, transmitted messages and errors per topic. KIP-714 which I think can be configured for librdkafka, on a quick read, does not seem to include these, but maybe I'm mistaken. Having locally exported metrics would also allow adding custom/pod specific labels to the metrics

sakari avatar Mar 23 '25 07:03 sakari

I had a little lookaround and it seems that we can add a stats_cb configuration option and hook that to event.stats event emitted by .internalClient. Would not have to touch the librdkafka bindings even.

Would that be an acceptable way to support this use case.

sakari avatar Apr 14 '25 15:04 sakari

@sakari I would argue that it's a critical part that's missing. about your listed findings - if I understand correctly, that's a code modification to this library, correct? I'm looking for an immediate workaround

nitzan-blink avatar Apr 22 '25 07:04 nitzan-blink

We are migrating from KafkaJs and facing the same issue, we have some events and hooks to get metrics from KafkaJs library, but can't use stats_cb of librdkafka in this library.

After code review, this callback glue with the Js world is coded in the C++ part of the client library. in src/config.cc

Is this feature on the roadmap?

I will check how project node-librdkafka address this issue.

mlois-efimob avatar Nov 03 '25 18:11 mlois-efimob

similarly trying to use promisified API similar to KafkaJs instrumentation events:

consumer.on(EVENT, callback)

but this doesn't appear to be supported at the time being

nadirBenSaid avatar Nov 04 '25 10:11 nadirBenSaid