Module: Appsignal::Integrations::ActiveSupportNotificationsIntegration::StartFinishIntegration

Defined in:
lib/appsignal/integrations/active_support_notifications.rb

Instance Method Summary collapse

Instance Method Details

#finish(name, payload = {}) ⇒ Object



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/appsignal/integrations/active_support_notifications.rb', line 39

def finish(name, payload = {})
  # Events that start with a bang are internal to Rails
  instrument_this = name[0] != ActiveSupportNotificationsIntegration::BANG

  if instrument_this
    title, body, body_format = Appsignal::EventFormatter.format(name, payload)
    Appsignal::Transaction.current.finish_event(
      name.to_s,
      title,
      body,
      body_format
    )
  end

  super
end

#start(name, payload = {}) ⇒ Object



30
31
32
33
34
35
36
37
# File 'lib/appsignal/integrations/active_support_notifications.rb', line 30

def start(name, payload = {})
  # Events that start with a bang are internal to Rails
  instrument_this = name[0] != ActiveSupportNotificationsIntegration::BANG

  Appsignal::Transaction.current.start_event if instrument_this

  super
end