karafka / rdkafka-ruby

Modern and performant Kafka client library for Ruby based on librdkafka
https://karafka.io
Other
354 stars 120 forks source link

Customizing producer name for librdkafka statistics/metrics #217

Closed trickleup closed 2 years ago

trickleup commented 2 years ago

Hi, thanks for all your work on the library.

I'm tapping librdkafka metrics via the statistics callback, which works well.

Is there a way to customize the name of the producer, that is then returned from librdkafka to the stats_callback? By default, the metrics report rdkafka#producer-1, rdkafka#producer-2, and so on, so I wonder if it's currently possible to explicitly name these to something more meaningful, so that the metrics become more useful.

Thanks!

mensfeld commented 2 years ago

as far as I recall you can just use client.id: https://github.com/karafka/waterdrop/blob/master/lib/waterdrop/config.rb#L12

thijsc commented 2 years ago

That should indeed work