Module: Datadog::Tracing::Contrib::Kafka::Events::Producer::DeliverMessages

Includes:
Datadog::Tracing::Contrib::Kafka::Event
Defined in:
lib/datadog/tracing/contrib/kafka/events/producer/deliver_messages.rb

Overview

Defines instrumentation for deliver_messages.producer.kafka event

Constant Summary collapse

EVENT_NAME =
'deliver_messages.producer.kafka'

Class Method Summary collapse

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

included

Class Method Details

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



20
21
22
23
24
25
26
27
28
29
# File 'lib/datadog/tracing/contrib/kafka/events/producer/deliver_messages.rb', line 20

def on_start(span, _event, _id, payload)
  super

  span.set_tag(Ext::TAG_ATTEMPTS, payload[:attempts]) if payload.key?(:attempts)
  span.set_tag(Ext::TAG_MESSAGE_COUNT, payload[:message_count]) if payload.key?(:message_count)
  if payload.key?(:delivered_message_count)
    span.set_tag(Ext::TAG_DELIVERED_MESSAGE_COUNT, payload[:delivered_message_count])
  end
  span.set_tag(Tracing::Metadata::Ext::TAG_KIND, Tracing::Metadata::Ext::SpanKind::TAG_PRODUCER)
end

.span_nameObject



31
32
33
# File 'lib/datadog/tracing/contrib/kafka/events/producer/deliver_messages.rb', line 31

def span_name
  Ext::SPAN_DELIVER_MESSAGES
end

.span_optionsObject



35
36
37
# File 'lib/datadog/tracing/contrib/kafka/events/producer/deliver_messages.rb', line 35

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