Hi! I might be missing something here, so wanted to check before assuming this is a bug.
docs/GettingStarted.md says:
The WaterDrop integration provides tracing of the waterdrop gem (a dependency of karafka, but also can be used standalone). This integration activates automatically with the Karafka framework.
I was debugging why Data Streams Monitoring wasn't showing a producer node for our Kafka topic, even with c.tracing.instrument :karafka enabled and DD_DATA_STREAMS_ENABLED=true set. Digging into lib/datadog/tracing/contrib/karafka/patcher.rb, the only WaterDrop-related thing it does is:
if Contrib::WaterDrop::Integration.compatible?
::Karafka.monitor.subscribe('app.initialized') do |event|
...
Contrib::WaterDrop::Patcher.add_middleware(::Karafka.producer)
end
end
That calls add_middleware directly, but never calls Contrib::WaterDrop::Patcher.patch — which is the method that does ::WaterDrop::Producer.prepend(Producer) and subscribes to 'producer.configured' (the thing that eventually attaches the message.acknowledged → track_kafka_produce listener DSM needs).
I wrote a small repro to check rather than just read the source:
require 'datadog'
require 'karafka'
require 'waterdrop'
Datadog.configure do |c|
c.tracing.instrument :karafka, service_name: 'test-karafka'
# no :waterdrop instrument call here
end
registry = Datadog::Tracing::Contrib::REGISTRY
puts registry[:waterdrop].patcher.patched? # => false
puts registry[:karafka].patcher.patched? # => true
On version 2.34.0, that prints false / true. Adding c.tracing.instrument :waterdrop, **options alongside :karafka flips it to true, and a freshly-created WaterDrop::Producer then actually has a message.acknowledged listener attached (confirmed via producer.monitor introspection).
So: is c.tracing.instrument :waterdrop supposed to be required separately even when using Karafka, and the docs just need updating? Or is there a different/newer activation path I'm not hitting (e.g. via Karafka::App.setup's own producer config, or some auto-instrument setting) that I'm missing in my repro? Happy to be wrong here — just didn't want to file a "docs are broken" issue without checking first.
Repro gem versions: datadog 2.34.0, karafka 2.5.8, waterdrop 2.8.16, Ruby 3.4.10.
Hi! I might be missing something here, so wanted to check before assuming this is a bug.
docs/GettingStarted.mdsays:I was debugging why Data Streams Monitoring wasn't showing a producer node for our Kafka topic, even with
c.tracing.instrument :karafkaenabled andDD_DATA_STREAMS_ENABLED=trueset. Digging intolib/datadog/tracing/contrib/karafka/patcher.rb, the only WaterDrop-related thing it does is:That calls
add_middlewaredirectly, but never callsContrib::WaterDrop::Patcher.patch— which is the method that does::WaterDrop::Producer.prepend(Producer)and subscribes to'producer.configured'(the thing that eventually attaches themessage.acknowledged→track_kafka_producelistener DSM needs).I wrote a small repro to check rather than just read the source:
On version
2.34.0, that printsfalse/true. Addingc.tracing.instrument :waterdrop, **optionsalongside:karafkaflips it totrue, and a freshly-createdWaterDrop::Producerthen actually has amessage.acknowledgedlistener attached (confirmed viaproducer.monitorintrospection).So: is
c.tracing.instrument :waterdropsupposed to be required separately even when using Karafka, and the docs just need updating? Or is there a different/newer activation path I'm not hitting (e.g. viaKarafka::App.setup's own producer config, or some auto-instrument setting) that I'm missing in my repro? Happy to be wrong here — just didn't want to file a "docs are broken" issue without checking first.Repro gem versions:
datadog2.34.0,karafka2.5.8,waterdrop2.8.16, Ruby 3.4.10.