Sha256: ec2ad6935417662e5a6645407aa24c71fd94dc9eefdd9e18ab6a8ca3bff2b3bb

Contents?: true

Size: 1.13 KB

Versions: 4

Compression:

Stored size: 1.13 KB

Contents

# typed: true

require 'datadog/tracing/contrib/kafka/ext'
require 'datadog/tracing/contrib/kafka/event'

module Datadog
  module Tracing
    module Contrib
      module Kafka
        module Events
          module Connection
            # Defines instrumentation for request.connection.kafka event
            module Request
              include Kafka::Event

              EVENT_NAME = 'request.connection.kafka'.freeze

              def self.process(span, _event, _id, payload)
                super

                span.resource = payload[:api]

                span.set_tag(Ext::TAG_REQUEST_SIZE, payload[:request_size]) if payload.key?(:request_size)
                span.set_tag(Ext::TAG_RESPONSE_SIZE, payload[:response_size]) if payload.key?(:response_size)
              end

              module_function

              def span_name
                Ext::SPAN_CONNECTION_REQUEST
              end

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ddtrace-1.2.0 lib/datadog/tracing/contrib/kafka/events/connection/request.rb
ddtrace-1.1.0 lib/datadog/tracing/contrib/kafka/events/connection/request.rb
ddtrace-1.0.0 lib/datadog/tracing/contrib/kafka/events/connection/request.rb
ddtrace-1.0.0.beta2 lib/datadog/tracing/contrib/kafka/events/connection/request.rb