class ActiveSupport::Notifications::Fanout::Handle
A Handle is used to record the start and finish time of event.
Both start and finish must each be called exactly once.
Where possible, itβs best to use the block form: ActiveSupport::Notifications.instrument. Handle is a low-level API intended for cases where the block form canβt be used.
handle = ActiveSupport::Notifications.instrumenter.build_handle("my.event", {}) begin handle.start # work to be instrumented ensure handle.finish end
Public Instance Methods
Source
# File lib/active_support/notifications/fanout.rb, line 249 def finish finish_with_values(@name, @id, @payload) end
Source
# File lib/active_support/notifications/fanout.rb, line 240 def start ensure_state! :initialized @state = :started iterate_guarding_exceptions(@groups) do |group| group.start(@name, @id, @payload) end end
Private Instance Methods
Source
# File lib/active_support/notifications/fanout.rb, line 263 def ensure_state!(expected) if @state != expected raise ArgumentError, "expected state to be #{expected.inspect} but was #{@state.inspect}" end end