Module: BrainzLab::Instrumentation::ActionMailerInstrumentation

Defined in:
lib/brainzlab/instrumentation/action_mailer.rb

Class Method Summary collapse

Class Method Details

.install!Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/brainzlab/instrumentation/action_mailer.rb', line 9

def install!
  return unless defined?(::ActionMailer::Base)
  return if @installed

  # Subscribe to deliver notification
  ActiveSupport::Notifications.subscribe('deliver.action_mailer') do |*args|
    event = ActiveSupport::Notifications::Event.new(*args)
    record_delivery(event)
  end

  # Subscribe to process notification (when mail is being prepared)
  ActiveSupport::Notifications.subscribe('process.action_mailer') do |*args|
    event = ActiveSupport::Notifications::Event.new(*args)
    record_process(event)
  end

  @installed = true
  BrainzLab.debug_log('ActionMailer instrumentation installed')
end

.installed?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/brainzlab/instrumentation/action_mailer.rb', line 29

def installed?
  @installed
end

.reset!Object



33
34
35
# File 'lib/brainzlab/instrumentation/action_mailer.rb', line 33

def reset!
  @installed = false
end