Module: Datadog::Tracing::Contrib::Kafka::Events::ConsumerGroup::Heartbeat

Extended by:
ConsumerEvent, ConsumerGroupEvent
Includes:
Datadog::Tracing::Contrib::Kafka::Event
Defined in:
lib/datadog/tracing/contrib/kafka/events/consumer_group/heartbeat.rb

Overview

Defines instrumentation for heartbeat.consumer.kafka event

Constant Summary collapse

EVENT_NAME =
'heartbeat.consumer.kafka'

Class Method Summary collapse

Methods included from Datadog::Tracing::Contrib::Kafka::Event

included

Class Method Details

.on_start(span, _event, _id, payload) ⇒ Object



24
25
26
27
28
29
30
31
32
# File 'lib/datadog/tracing/contrib/kafka/events/consumer_group/heartbeat.rb', line 24

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

.span_nameObject



34
35
36
# File 'lib/datadog/tracing/contrib/kafka/events/consumer_group/heartbeat.rb', line 34

def span_name
  Ext::SPAN_CONSUMER_HEARTBEAT
end

.span_optionsObject



38
39
40
# File 'lib/datadog/tracing/contrib/kafka/events/consumer_group/heartbeat.rb', line 38

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