Sha256: ab0c37da8cf089e1a6dc7fa937d7ae06928af4c9a69e73a9e159c31a9ca532fb

Contents?: true

Size: 1.04 KB

Versions: 5

Compression:

Stored size: 1.04 KB

Contents

# typed: true
require 'ddtrace/contrib/kafka/ext'
require 'ddtrace/contrib/kafka/event'
require 'ddtrace/contrib/kafka/consumer_event'
require 'ddtrace/contrib/kafka/consumer_group_event'

module Datadog
  module Contrib
    module Kafka
      module Events
        module ConsumerGroup
          # Defines instrumentation for heartbeat.consumer.kafka event
          module Heartbeat
            include Kafka::Event
            extend Kafka::ConsumerEvent
            extend Kafka::ConsumerGroupEvent

            EVENT_NAME = 'heartbeat.consumer.kafka'.freeze

            def self.process(span, _event, _id, payload)
              super

              if payload.key?(:topic_partitions)
                payload[:topic_partitions].each do |topic, partitions|
                  span.set_tag("#{Ext::TAG_TOPIC_PARTITIONS}.#{topic}", partitions)
                end
              end
            end

            module_function

            def span_name
              Ext::SPAN_CONSUMER_HEARTBEAT
            end
          end
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ddtrace-0.54.2 lib/ddtrace/contrib/kafka/events/consumer_group/heartbeat.rb
ddtrace-0.54.1 lib/ddtrace/contrib/kafka/events/consumer_group/heartbeat.rb
ddtrace-0.54.0 lib/ddtrace/contrib/kafka/events/consumer_group/heartbeat.rb
ddtrace-0.53.0 lib/ddtrace/contrib/kafka/events/consumer_group/heartbeat.rb
ddtrace-0.52.0 lib/ddtrace/contrib/kafka/events/consumer_group/heartbeat.rb