Module: Appsignal::Integrations::ActiveSupportNotificationsIntegration::InstrumentIntegration Private

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

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Instance Method Summary collapse

Instance Method Details

#instrument(name, payload = {}, &block) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

[View source]

10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/appsignal/integrations/active_support_notifications.rb', line 10

def instrument(name, payload = {}, &block)
  # 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
ensure
  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
end