Sha256: a8451050ce1bcdd6dda1b8c9d795b539234bde031bfc9866b1d9174173810d55

Contents?: true

Size: 1.27 KB

Versions: 6

Compression:

Stored size: 1.27 KB

Contents

# frozen_string_literal: true

require_relative '../../ext'
require_relative '../../event'
require_relative '../../consumer_event'
require_relative '../../consumer_group_event'

module Datadog
  module Tracing
    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'

              module_function

              def on_start(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

              def span_name
                Ext::SPAN_CONSUMER_HEARTBEAT
              end

              def span_options
                super.merge({ tags: { Tracing::Metadata::Ext::TAG_OPERATION => Ext::TAG_OPERATION_CONSUMER_HEARTBEAT } })
              end
            end
          end
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
datadog-2.7.0 lib/datadog/tracing/contrib/kafka/events/consumer_group/heartbeat.rb
datadog-2.6.0 lib/datadog/tracing/contrib/kafka/events/consumer_group/heartbeat.rb
datadog-2.5.0 lib/datadog/tracing/contrib/kafka/events/consumer_group/heartbeat.rb
datadog-2.4.0 lib/datadog/tracing/contrib/kafka/events/consumer_group/heartbeat.rb
datadog-2.3.0 lib/datadog/tracing/contrib/kafka/events/consumer_group/heartbeat.rb
datadog-2.2.0 lib/datadog/tracing/contrib/kafka/events/consumer_group/heartbeat.rb