Module: Datadog::Tracing::Contrib::Kafka::Events::Consumer::ProcessMessage

Extended by:
ConsumerEvent
Includes:
Datadog::Tracing::Contrib::Kafka::Event
Defined in:
lib/datadog/tracing/contrib/kafka/events/consumer/process_message.rb

Overview

Defines instrumentation for process_message.consumer.kafka event

Constant Summary collapse

EVENT_NAME =
'process_message.consumer.kafka'.freeze

Class Method Summary collapse

Methods included from ConsumerEvent

process

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

included

Class Method Details

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



18
19
20
21
22
23
24
25
26
27
28
# File 'lib/datadog/tracing/contrib/kafka/events/consumer/process_message.rb', line 18

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

  span.resource = payload[:topic]

  span.set_tag(Ext::TAG_TOPIC, payload[:topic]) if payload.key?(:topic)
  span.set_tag(Ext::TAG_MESSAGE_KEY, payload[:key]) if payload.key?(:key)
  span.set_tag(Ext::TAG_PARTITION, payload[:partition]) if payload.key?(:partition)
  span.set_tag(Ext::TAG_OFFSET, payload[:offset]) if payload.key?(:offset)
  span.set_tag(Ext::TAG_OFFSET_LAG, payload[:offset_lag]) if payload.key?(:offset_lag)
end

.span_nameObject



32
33
34
# File 'lib/datadog/tracing/contrib/kafka/events/consumer/process_message.rb', line 32

def span_name
  Ext::SPAN_PROCESS_MESSAGE
end

.span_optionsObject



36
37
38
# File 'lib/datadog/tracing/contrib/kafka/events/consumer/process_message.rb', line 36

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