ActiveSupport::Notifications

module ActiveSupport::Notifications

Notifications

ActiveSupport::Notifications provides an instrumentation API for Ruby.

Instrumenters

To instrument an event you just need to do:

ActiveSupport::Notifications.instrument('render', extra: :information) do
  render text: 'Foo'
end

That executes the block first and notifies all subscribers once done.

In the example above render is the name of the event, and the rest is called the payload. The payload is a mechanism that allows instrumenters to pass extra information to subscribers. Payloads consist of a hash whose contents are arbitrary and