Class: NewRelic::Agent::Instrumentation::ActionMailerSubscriber

Inherits:
NotificationsSubscriber show all
Defined in:
lib/new_relic/agent/instrumentation/action_mailer_subscriber.rb

Overview

NOTE: as of v7.1.0.0.alpha, deliver.action_mailer will provide an empty payload hash ({}) to #start, so in this subscriber class we defer params population until #finish and start the segment with a temporary name that is later replaced

Constant Summary collapse

BASE_NAME =
'Ruby/ActionMailer'
PAYLOAD_KEYS =
%i[action data key mailer message_id perform_deliveries subject]
PATTERN =
/\A([^\.]+)\.action_mailer\z/
UNKNOWN_MAILER =
%r{^#{BASE_NAME}/#{UNKNOWN}/}
METHOD_NAME_MAPPING =
Hash.new do |h, k|
  if PATTERN =~ k
    h[k] = $1
  else
    h[k] = NewRelic::UNKNOWN
  end
end

Instance Method Summary collapse

Methods inherited from NotificationsSubscriber

#add_segment_params, #define_exception_method, find_all_subscribers, #initialize, #log_notification_error, #pop_segment, #push_segment, #segment_stack, #state, subscribe, subscribed?

Constructor Details

This class inherits a constructor from NewRelic::Agent::Instrumentation::NotificationsSubscriber

Instance Method Details

#finish(name, id, payload) ⇒ Object



36
37
38
39
40
41
42
# File 'lib/new_relic/agent/instrumentation/action_mailer_subscriber.rb', line 36

def finish(name, id, payload)
  return unless state.is_execution_traced?

  finish_segment(id, payload)
rescue => e
  log_notification_error(e, name, 'finish')
end

#start(name, id, payload) ⇒ Object



28
29
30
31
32
33
34
# File 'lib/new_relic/agent/instrumentation/action_mailer_subscriber.rb', line 28

def start(name, id, payload)
  return unless state.is_execution_traced?

  start_segment(name, id, payload)
rescue => e
  log_notification_error(e, name, 'start')
end