Module: Datadog::Tracing::Contrib::Kafka::Events::ProduceOperation::SendMessages

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

Overview

Defines instrumentation for send_messages.producer.kafka event

Constant Summary collapse

EVENT_NAME =
'send_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
# File 'lib/datadog/tracing/contrib/kafka/events/produce_operation/send_messages.rb', line 20

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

  span.set_tag(Ext::TAG_MESSAGE_COUNT, payload[:message_count]) if payload.key?(:message_count)
  span.set_tag(Ext::TAG_SENT_MESSAGE_COUNT, payload[:sent_message_count]) if payload.key?(:sent_message_count)
  span.set_tag(Tracing::Metadata::Ext::TAG_KIND, Tracing::Metadata::Ext::SpanKind::TAG_PRODUCER)
end

.span_nameObject



28
29
30
# File 'lib/datadog/tracing/contrib/kafka/events/produce_operation/send_messages.rb', line 28

def span_name
  Ext::SPAN_SEND_MESSAGES
end

.span_optionsObject



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

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