racecar icon indicating copy to clipboard operation
racecar copied to clipboard

Unable to configure producer partitioner_name

Open mollyegibson opened this issue 2 years ago • 1 comments

I am using racecar version 2.8.2, rdkafka 0.12.0, and kafka 3.2.1. I am producing messages to the same topic as a Java service, and I need to set the producer partitioner_name to murmur2 so that they hash the partition keys in the same way and events with the same partition key are sent to the same partition. I have set my config in racecar.yaml to include the partitioner like this:

# These config values will be shared by all environments but can be overridden.
common: &common
  client_id: "my-client-id"
  producer:
    - partitioner=murmur2

Racecar is then pulling that partitioner value into a hash and configuring an rdkafka producer: https://github.com/zendesk/racecar/blob/58b83d1ba09bc61abe207744e43bd57b2bb46542/lib/racecar/config.rb#L243-L245

however, when rdkafka is configuring the consumer, it expects the partitioner configuration to be a symbol rather than a String: https://github.com/appsignal/rdkafka-ruby/blob/c02f217a189b71e3e253fe4ad59286b5fc9d4034/lib/rdkafka/config.rb#L184

I am not familiar enough with the code to know if there is somewhere else that's requiring the producer config to be strings, but I'm wondering if we can just make the producer config a hash with symbol keys rather than strings. I'm open to other suggestions as well :) I can't find a way to configure it on my end with partitioner as a symbol rather than a string.

Thank you!!

mollyegibson avatar Aug 25 '22 01:08 mollyegibson

Could you try writing a PR to that effect?

Alternatively, you could try to make setting the partitioner config a first class config key in Racecar; I think that would be even better.

dasch avatar Oct 03 '22 11:10 dasch

I believe this was fixed in rdkafka-ruby in https://github.com/appsignal/rdkafka-ruby/pull/213

deepredsky avatar Mar 28 '23 13:03 deepredsky