Sha256: 74d669d2a16b9c4dc6887f0ae984067a8648d5eaf38b5f409a75d2d3a18aac01

Contents?: true

Size: 1.19 KB

Versions: 4

Compression:

Stored size: 1.19 KB

Contents

# frozen_string_literal: true

require_relative '../../ext'
require_relative '../../event'

module Datadog
  module Tracing
    module Contrib
      module Kafka
        module Events
          module ProduceOperation
            # Defines instrumentation for send_messages.producer.kafka event
            module SendMessages
              include Kafka::Event

              EVENT_NAME = 'send_messages.producer.kafka'

              def self.process(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

              module_function

              def span_name
                Ext::SPAN_SEND_MESSAGES
              end

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
datadog-2.1.0 lib/datadog/tracing/contrib/kafka/events/produce_operation/send_messages.rb
datadog-2.0.0 lib/datadog/tracing/contrib/kafka/events/produce_operation/send_messages.rb
datadog-2.0.0.beta2 lib/datadog/tracing/contrib/kafka/events/produce_operation/send_messages.rb
datadog-2.0.0.beta1 lib/datadog/tracing/contrib/kafka/events/produce_operation/send_messages.rb