Module: OpenTelemetry::Instrumentation::RubyKafka::Patches::AsyncProducer

Defined in:
lib/opentelemetry/instrumentation/ruby_kafka/patches/async_producer.rb

Overview

The AsyncProducer module contains the instrumentation patch the AsyncProducer#produce method

Instance Method Summary collapse

Instance Method Details

#__otel_merge_options!(**options) ⇒ Object



14
15
16
17
18
19
20
21
# File 'lib/opentelemetry/instrumentation/ruby_kafka/patches/async_producer.rb', line 14

def __otel_merge_options!(**options)
  options ||= { headers: {} }
  # The propagator mutates the carrier (first positional argument), so we need to set headers to empty hash so
  # that there's something to mutate
  options[:headers] = {} unless options[:headers]
  OpenTelemetry.propagation.inject(options[:headers])
  options
end

#produce(value, topic:, **options) ⇒ Object



9
10
11
12
# File 'lib/opentelemetry/instrumentation/ruby_kafka/patches/async_producer.rb', line 9

def produce(value, topic:, **options)
  options = __otel_merge_options!(**options)
  super
end