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[] | Array[ActiveSupport::Notifications::Fanout::Subscribers::Timed]) listeners_state, String name, Hash payload) -> Array[ActiveSupport::Notifications::Fanout::Subscribers::Evented]
  def initialize: (ActiveSupport::Notifications::Fanout notifier) -> void
  def instrument: (String name, ?Hash payload) -> (PG::Result | ActionView::AbstractRenderer::RenderedTemplate | ActionView::OutputBuffer)
  def start: (String name, Hash payload) -> Array[ActiveSupport::Notifications::Fanout::Subscribers::Evented]
end

Instrumenters are stored in a thread local.

def finish(name, payload)

Send a finish notification with +name+ and +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_listeners_state = ActiveSupport::Notifications::Fanout::Subscribers::Evented | ActiveSupport::Notifications::Fanout::Subscribers::EventObject | ActiveSupport::Notifications::Fanout::Subscribers::Evented | ActiveSupport::Notifications::Fanout::Subscribers::EventObject |  | ActiveSupport::Notifications::Fanout::Subscribers::Evented | ActiveSupport::Notifications::Fanout::Subscribers::Evented | ActiveSupport::Notifications::Fanout::Subscribers::EventObject
type ActiveSupport__Notifications__Instrumenter_finish_with_state_payload = sql | String | name | String | binds |  | type_casted_binds |  | statement_name | NilClass | async | FalseClass | connection | ActiveRecord::ConnectionAdapters::PostgreSQLAdapter | controller | String | action | String | request | ActionDispatch::Request | params | controller | String | action | String | headers | ActionDispatch::Http::Headers | format | Symbol | method | String | path | String | identifier | String | layout | NilClass | cache_hit | NilClass | sql | String | name | String | binds | ActiveRecord::Relation::QueryAttribute | ActiveRecord::Relation::QueryAttribute | type_casted_binds | String | String | statement_name | NilClass | async | FalseClass | connection | ActiveRecord::ConnectionAdapters::PostgreSQLAdapter | sql | String | name | String | binds | ActiveModel::Attribute::FromUser | ActiveModel::Attribute::FromUser | ActiveModel::Attribute::FromUser | ActiveModel::Attribute::FromUser | ActiveModel::Attribute::FromUser | ActiveModel::Attribute::FromUser | ActiveModel::Attribute::FromUser | ActiveModel::Attribute::FromUser | ActiveModel::Attribute::FromUser | ActiveModel::Attribute::FromUser | ActiveModel::Attribute::FromUser | type_casted_binds | String | String | String | String | String | String | String | String | String | String | NilClass | statement_name | NilClass | async | FalseClass | connection | ActiveRecord::ConnectionAdapters::PostgreSQLAdapter | record_count | Integer | class_name | String | identifier | String | sql | String | name | String | binds | ActiveModel::Attribute::FromUser | ActiveModel::Attribute::FromUser | ActiveModel::Attribute::FromUser | ActiveModel::Attribute::FromUser | ActiveModel::Attribute::FromUser | ActiveModel::Attribute::FromUser | ActiveModel::Attribute::FromUser | ActiveModel::Attribute::FromUser | ActiveModel::Attribute::FromUser | ActiveModel::Attribute::FromUser | ActiveModel::Attribute::FromUser | type_casted_binds | String | String | String | String | String | String | String | String | String | String | String | statement_name | NilClass | async | FalseClass | connection | ActiveRecord::ConnectionAdapters::PostgreSQLAdapter | sql | String | name | NilClass | binds |  | type_casted_binds |  | statement_name | NilClass | async | FalseClass | connection | ActiveRecord::ConnectionAdapters::SQLite3Adapter | sql | String | name | String | binds | ActiveModel::Attribute::WithCastValue | type_casted_binds | Integer | statement_name | NilClass | async | FalseClass | connection | ActiveRecord::ConnectionAdapters::SQLite3Adapter | sql | String | name | String | binds |  | type_casted_binds |  | statement_name | NilClass | async | FalseClass | connection | ActiveRecord::ConnectionAdapters::SQLite3Adapter | virtual_path | String | identifier | String | sql | String | name | String | binds | ActiveModel::Attribute::WithCastValue | ActiveModel::Attribute::WithCastValue | type_casted_binds | Integer | Integer | statement_name | NilClass | async | FalseClass | connection | ActiveRecord::ConnectionAdapters::SQLite3Adapter

def finish_with_state: (ActiveSupport__Notifications__Instrumenter_finish_with_state_listeners_state listeners_state, String name, ActiveSupport__Notifications__Instrumenter_finish_with_state_payload payload) -> (ActiveSupport::Notifications::Fanout::Subscribers::EventObject | ActiveSupport::Notifications::Fanout::Subscribers::Evented | ActiveSupport::Notifications::Fanout::Subscribers::EventObject | ActiveSupport::Notifications::Fanout::Subscribers::Evented | ActiveSupport::Notifications::Fanout::Subscribers::Evented | ActiveSupport::Notifications::Fanout::Subscribers::EventObject)

This signature was generated using 69 samples from 2 applications.

def finish_with_state(listeners_state, name, payload)
  @notifier.finish name, @id, payload, listeners_state
end

def initialize(notifier)

Experimental RBS support (using type sampling data from the type_fusion project).

def initialize: (ActiveSupport::Notifications::Fanout notifier) -> void

This signature was generated using 1 sample from 1 application.

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 = sql | String | name | String | binds |  | type_casted_binds |  | statement_name | NilClass | async | FalseClass | connection | ActiveRecord::ConnectionAdapters::PostgreSQLAdapter | sql | String | name | String | binds | ActiveRecord::Relation::QueryAttribute | ActiveRecord::Relation::QueryAttribute | type_casted_binds | String | String | statement_name | NilClass | async | FalseClass | connection | ActiveRecord::ConnectionAdapters::PostgreSQLAdapter | identifier | String | layout | NilClass | cache_hit | NilClass | sql | String | name | String | binds | ActiveModel::Attribute::FromUser | ActiveModel::Attribute::FromUser | ActiveModel::Attribute::FromUser | ActiveModel::Attribute::FromUser | ActiveModel::Attribute::FromUser | ActiveModel::Attribute::FromUser | ActiveModel::Attribute::FromUser | ActiveModel::Attribute::FromUser | ActiveModel::Attribute::FromUser | ActiveModel::Attribute::FromUser | ActiveModel::Attribute::FromUser | type_casted_binds | String | String | String | String | String | String | String | String | String | String | String | statement_name | NilClass | async | FalseClass | connection | ActiveRecord::ConnectionAdapters::PostgreSQLAdapter | sql | String | name | String | binds | ActiveRecord::Relation::QueryAttribute | type_casted_binds | String | statement_name | NilClass | async | FalseClass | connection | ActiveRecord::ConnectionAdapters::PostgreSQLAdapter | sql | String | name | NilClass | binds |  | type_casted_binds |  | statement_name | NilClass | async | FalseClass | connection | ActiveRecord::ConnectionAdapters::SQLite3Adapter | identifier | String

def instrument: (String name, ?ActiveSupport__Notifications__Instrumenter_instrument_payload payload) -> (PG::Result | ActionView::AbstractRenderer::RenderedTemplate | ActionView::OutputBuffer)

This signature was generated using 60 samples from 2 applications.

passed-in block.
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:

: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).

type ActiveSupport__Notifications__Instrumenter_start_payload = identifier | String | layout | String | sql | String | name | String | binds |  | type_casted_binds |  | statement_name | NilClass | async | FalseClass | connection | ActiveRecord::ConnectionAdapters::PostgreSQLAdapter | identifier | String | layout | NilClass | controller | String | action | String | request | ActionDispatch::Request | params | controller | String | action | String | headers | ActionDispatch::Http::Headers | format | Symbol | method | String | path | String | sql | String | name | String | binds | ActiveRecord::Relation::QueryAttribute | ActiveRecord::Relation::QueryAttribute | type_casted_binds | String | String | statement_name | NilClass | async | FalseClass | connection | ActiveRecord::ConnectionAdapters::PostgreSQLAdapter | record_count | Integer | class_name | String | sql | String | name | String | binds | ActiveModel::Attribute::FromUser | ActiveModel::Attribute::FromUser | ActiveModel::Attribute::FromUser | ActiveModel::Attribute::FromUser | ActiveModel::Attribute::FromUser | ActiveModel::Attribute::FromUser | ActiveModel::Attribute::FromUser | ActiveModel::Attribute::FromUser | ActiveModel::Attribute::FromUser | ActiveModel::Attribute::FromUser | ActiveModel::Attribute::FromUser | type_casted_binds | String | String | String | String | String | String | String | String | String | String | NilClass | statement_name | NilClass | async | FalseClass | connection | ActiveRecord::ConnectionAdapters::PostgreSQLAdapter | controller | String | action | String | request | ActionDispatch::Request | params | controller | String | action | String | gem | String | version | String | id | String | headers | ActionDispatch::Http::Headers | format | Symbol | method | String | path | String

def start: (String name, ActiveSupport__Notifications__Instrumenter_start_payload payload) -> (ActiveSupport::Notifications::Fanout::Subscribers::Evented | ActiveSupport::Notifications::Fanout::Subscribers::EventObject | ActiveSupport::Notifications::Fanout::Subscribers::EventObject)

This signature was generated using 63 samples from 1 application.

Send a start notification with +name+ and +payload+.
def start(name, payload)
  @notifier.start name, @id, payload
end

def unique_id

def unique_id
  SecureRandom.hex(10)
end