123456789_123456789_123456789_123456789_123456789_

Class: ActiveSupport::Notifications::Fanout::Handle

Relationships & Source Files
Inherits: Object
Defined in: activesupport/lib/active_support/notifications/fanout.rb

Overview

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

Instance Method Summary

Instance Method Details

#finish

[ GitHub ]

  
# File 'activesupport/lib/active_support/notifications/fanout.rb', line 253

def finish
  finish_with_values(@name, @id, @payload)
end

#start

[ GitHub ]

  
# File 'activesupport/lib/active_support/notifications/fanout.rb', line 244

def start
  ensure_state! :initialized
  @state = :started

  iterate_guarding_exceptions(@groups) do |group|
    group.start(@name, @id, @payload)
  end
end