Module: Datadog::Tracing::Contrib::Kafka::Patcher

Includes:
Patcher
Defined in:
lib/datadog/tracing/contrib/kafka/patcher.rb

Overview

Patcher enables patching of ‘kafka’ module.

Class Method Summary collapse

Methods included from Patcher

included

Class Method Details

.patchObject



21
22
23
24
25
26
27
28
# File 'lib/datadog/tracing/contrib/kafka/patcher.rb', line 21

def patch
  # Subscribe to Kafka events
  Events.subscribe!

  # Apply monkey patches for additional instrumentation (e.g., DSM)
  patch_producer if defined?(::Kafka::Producer)
  patch_consumer if defined?(::Kafka::Consumer)
end

.patch_consumerObject



35
36
37
38
# File 'lib/datadog/tracing/contrib/kafka/patcher.rb', line 35

def patch_consumer
  require_relative 'instrumentation/consumer'
  ::Kafka::Consumer.prepend(Instrumentation::Consumer)
end

.patch_producerObject



30
31
32
33
# File 'lib/datadog/tracing/contrib/kafka/patcher.rb', line 30

def patch_producer
  require_relative 'instrumentation/producer'
  ::Kafka::Producer.prepend(Instrumentation::Producer)
end

.target_versionObject



17
18
19
# File 'lib/datadog/tracing/contrib/kafka/patcher.rb', line 17

def target_version
  Integration.version
end