class ActiveSupport::Notifications::Instrumenter
Experimental RBS support (using type sampling data from the type_fusion project).
# sig/active_support/notifications/instrumenter.rbs class ActiveSupport::Notifications::Instrumenter def finish_with_state: ((Array[ActiveSupport::Notifications::Fanout::Subscribers::Evented] | Array[ActiveSupport::Notifications::Fanout::Subscribers::EventObject]) listeners_state, String name, Hash payload) -> untyped def instrument: (String name, ?Hash payload) -> untyped def start: (String name, Hash payload) -> untyped end
Instrumenters are stored in a thread local.
def finish(name, payload)
def finish(name, payload) @notifier.finish name, @id, payload end
def finish_with_state(listeners_state, name, payload)
Experimental RBS support (using type sampling data from the type_fusion project).
type ActiveSupport__Notifications__Instrumenter_finish_with_state_payload = identifier | String | layout | NilClass | cache_hit | NilClass | sql | String | name | String | binds | ActiveRecord::Relation::QueryAttribute | ActiveRecord::Relation::QueryAttribute | type_casted_binds | String | Integer | statement_name | NilClass | async | FalseClass | connection | ActiveRecord::ConnectionAdapters::PostgreSQLAdapter | sql | String | name | String | binds | ActiveModel::Attribute::WithCastValue | type_casted_binds | Integer | statement_name | NilClass | async | FalseClass | connection | ActiveRecord::ConnectionAdapters::PostgreSQLAdapter | record_count | Integer | class_name | String | sql | String | name | String | binds | ActiveRecord::Relation::QueryAttribute | ActiveModel::Attribute::WithCastValue | type_casted_binds | Integer | Integer | statement_name | NilClass | async | FalseClass | connection | ActiveRecord::ConnectionAdapters::PostgreSQLAdapter def finish_with_state: ((ActiveSupport::Notifications::Fanout::Subscribers::EventObject | ActiveSupport::Notifications::Fanout::Subscribers::Evented | ActiveSupport::Notifications::Fanout::Subscribers::Timed | ActiveSupport::Notifications::Fanout::Subscribers::EventObject | ) listeners_state, String name, ActiveSupport__Notifications__Instrumenter_finish_with_state_payload payload) -> untyped
This signature was generated using 5 samples from 1 application.
def finish_with_state(listeners_state, name, payload) @notifier.finish name, @id, payload, listeners_state end
def initialize(notifier)
def initialize(notifier) @id = unique_id @notifier = notifier end
def instrument(name, payload = {})
Experimental RBS support (using type sampling data from the type_fusion project).
type ActiveSupport__Notifications__Instrumenter_instrument_payload = identifier | String | layout | NilClass | sql | String | name | String | binds | ActiveRecord::Relation::QueryAttribute | ActiveRecord::Relation::QueryAttribute | type_casted_binds | Integer | String | statement_name | String | async | FalseClass | connection | ActiveRecord::ConnectionAdapters::PostgreSQLAdapter | identifier | String | record_count | Integer | class_name | String def instrument: (String name, ?ActiveSupport__Notifications__Instrumenter_instrument_payload payload) -> untyped
This signature was generated using 4 samples from 1 application.
notifier. Notice that events get sent even if an error occurs in the
and publish it. Without a block, simply send a message via the
Given a block, instrument it by measuring the time taken to execute
def instrument(name, payload = {}) # some of the listeners might have state listeners_state = start name, payload begin yield payload if block_given? rescue Exception => e payload[:exception] = [e.class.name, e.message] payload[:exception_object] = e raise e ensure finish_with_state listeners_state, name, payload end end
def new_event(name, payload = {}) # :nodoc:
def new_event(name, payload = {}) # :nodoc: Event.new(name, nil, nil, @id, payload) end
def start(name, payload)
Experimental RBS support (using type sampling data from the type_fusion project).
def start: (String name, (sql | String | name | String | binds | ActiveRecord::Relation::QueryAttribute | ActiveRecord::Relation::QueryAttribute | type_casted_binds | TrueClass | Integer | statement_name | String | async | FalseClass | connection | ActiveRecord::ConnectionAdapters::PostgreSQLAdapter | identifier | String | layout | NilClass | controller | String | action | String | request | ActionDispatch::Request | params | authenticity_token | String | controller | String | action | String | connected_folder_id | String | headers | ActionDispatch::Http::Headers | format | Symbol | method | String | path | String) payload) -> untyped
This signature was generated using 3 samples from 1 application.
def start(name, payload) @notifier.start name, @id, payload end
def unique_id
def unique_id SecureRandom.hex(10) end