Module: Datadog::Tracing::Contrib::Kafka::Event::ClassMethods

Defined in:
lib/datadog/tracing/contrib/kafka/event.rb

Overview

Class methods for Kafka events.

Instance Method Summary collapse

Instance Method Details

#configurationObject



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

def configuration
  Datadog.configuration.tracing[:kafka]
end

#event_nameObject



20
21
22
# File 'lib/datadog/tracing/contrib/kafka/event.rb', line 20

def event_name
  self::EVENT_NAME
end

#process(span, _event, _id, payload) ⇒ Object



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/datadog/tracing/contrib/kafka/event.rb', line 32

def process(span, _event, _id, payload)
  span.set_tag(Tracing::Metadata::Ext::TAG_COMPONENT, Ext::TAG_COMPONENT)
  span.set_tag(Contrib::Ext::Messaging::TAG_SYSTEM, Ext::TAG_MESSAGING_SYSTEM)

  span.set_tag(Ext::TAG_CLIENT, payload[:client_id])

  # Set analytics sample rate
  if Contrib::Analytics.enabled?(configuration[:analytics_enabled])
    Contrib::Analytics.set_sample_rate(span, configuration[:analytics_sample_rate])
  end

  # Measure service stats
  Contrib::Analytics.set_measured(span)

  report_if_exception(span, payload)
end

#span_optionsObject



24
25
26
# File 'lib/datadog/tracing/contrib/kafka/event.rb', line 24

def span_options
  { service: configuration[:service_name] }
end