Class: ActiveSupport::Notifications::InstrumentationRegistry

Inherits:
Object
  • Object
show all
Extended by:
PerThreadRegistry
Defined in:
lib/active_support/notifications.rb

Overview

This class is a registry which holds all of the Instrumenter objects in a particular thread local. To access the Instrumenter object for a particular notifier, you can call the following method:

InstrumentationRegistry.instrumenter_for(notifier)

The instrumenters for multiple notifiers are held in a single instance of this class.

Instance Method Summary collapse

Methods included from PerThreadRegistry

extended, instance

Constructor Details

#initializeInstrumentationRegistry

Returns a new instance of InstrumentationRegistry.



205
206
207
# File 'lib/active_support/notifications.rb', line 205

def initialize
  @registry = {}
end

Instance Method Details

#instrumenter_for(notifier) ⇒ Object



209
210
211
# File 'lib/active_support/notifications.rb', line 209

def instrumenter_for(notifier)
  @registry[notifier] ||= Instrumenter.new(notifier)
end