Sha256: 36fe23ceead835b1b52f58978216af3b8f588578278204b741be1272a4b280d9

Contents?: true

Size: 1.14 KB

Versions: 1

Compression:

Stored size: 1.14 KB

Contents

# This file is distributed under New Relic's license terms.
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
# frozen_string_literal: true

module NewRelic::Agent::Instrumentation
  module RubyKafkaProducer
    module Prepend
      include NewRelic::Agent::Instrumentation::RubyKafka

      def produce(value, **kwargs)
        produce_with_new_relic(value, **kwargs) do |headers|
          kwargs[:headers] = headers
          super
        end
      end
    end
  end

  module RubyKafkaConsumer
    module Prepend
      include NewRelic::Agent::Instrumentation::RubyKafka

      def each_message(*args)
        super do |message|
          each_message_with_new_relic(message) do
            yield(message)
          end
        end
      end
    end
  end

  module RubyKafkaClient
    module Prepend
      include NewRelic::Agent::Instrumentation::RubyKafkaConfig

      def producer(**kwargs)
        super.tap do |producer|
          set_nr_config(producer)
        end
      end

      def consumer(**kwargs)
        super.tap do |consumer|
          set_nr_config(consumer)
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
newrelic_rpm-9.14.0 lib/new_relic/agent/instrumentation/ruby_kafka/prepend.rb