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

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

Overview

Defines instrumentation for process_batch.consumer.kafka event

Constant Summary collapse

EVENT_NAME =
'process_batch.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
29
30
# File 'lib/datadog/tracing/contrib/kafka/events/consumer/process_batch.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_COUNT, payload[:message_count]) if payload.key?(:message_count)
  span.set_tag(Ext::TAG_PARTITION, payload[:partition]) if payload.key?(:partition)
  if payload.key?(:highwater_mark_offset)
    span.set_tag(Ext::TAG_HIGHWATER_MARK_OFFSET, payload[:highwater_mark_offset])
  end
  span.set_tag(Ext::TAG_OFFSET_LAG, payload[:offset_lag]) if payload.key?(:offset_lag)
end

.span_nameObject



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

def span_name
  Ext::SPAN_PROCESS_BATCH
end

.span_optionsObject



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

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