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'

Class Method Summary collapse

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

included

Class Method Details

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



22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/datadog/tracing/contrib/kafka/events/consumer/process_batch.rb', line 22

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



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

def span_name
  Ext::SPAN_PROCESS_BATCH
end

.span_optionsObject



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

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