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

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



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

def on_start(span, event, _id, payload)
  super

  span.type = span_type
  span.service = configuration[:service_name] if configuration[:service_name]
  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)
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