Module: Datadog::Tracing::Contrib::ActionMailer::Event::ClassMethods

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

Overview

Class methods for ActionMailer events.

Instance Method Summary collapse

Instance Method Details

#configurationObject



26
27
28
# File 'lib/datadog/tracing/contrib/action_mailer/event.rb', line 26

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

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



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

def process(span, event, _id, payload)
  span.service = configuration[:service_name] if configuration[:service_name]
  span.resource = payload[:mailer]
  span.set_tag(Tracing::Metadata::Ext::TAG_COMPONENT, Ext::TAG_COMPONENT)

  # 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)
rescue StandardError => e
  Datadog.logger.debug(e.message)
end

#span_optionsObject



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

def span_options
  options = {}
  options[:service] = configuration[:service_name] if configuration[:service_name]
  options
end