Sha256: 0fe1ce18b6dc06d4fa47aa8f5962d4406601c2923d9e74a4c1ba47589c3fa5de

Contents?: true

Size: 1.19 KB

Versions: 9

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'

              module_function

              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

              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

9 entries across 9 versions & 1 rubygems

Version Path
datadog-2.9.0 lib/datadog/tracing/contrib/kafka/events/produce_operation/send_messages.rb
datadog-2.8.0 lib/datadog/tracing/contrib/kafka/events/produce_operation/send_messages.rb
datadog-2.7.1 lib/datadog/tracing/contrib/kafka/events/produce_operation/send_messages.rb
datadog-2.7.0 lib/datadog/tracing/contrib/kafka/events/produce_operation/send_messages.rb
datadog-2.6.0 lib/datadog/tracing/contrib/kafka/events/produce_operation/send_messages.rb
datadog-2.5.0 lib/datadog/tracing/contrib/kafka/events/produce_operation/send_messages.rb
datadog-2.4.0 lib/datadog/tracing/contrib/kafka/events/produce_operation/send_messages.rb
datadog-2.3.0 lib/datadog/tracing/contrib/kafka/events/produce_operation/send_messages.rb
datadog-2.2.0 lib/datadog/tracing/contrib/kafka/events/produce_operation/send_messages.rb