Parent

Class Index [+]

Quicksearch

ActiveSupport::Notifications::Instrumenter

Attributes

id[R]

Public Class Methods

new(notifier) click to toggle source
    # File lib/active_support/notifications/instrumenter.rb, line 9
 9:       def initialize(notifier)
10:         @id = unique_id
11:         @notifier = notifier
12:       end

Public Instance Methods

instrument(name, payload={}) click to toggle source

Instrument the given block by measuring the time taken to execute it and publish it. Notice that events get sent even if an error occurs in the passed-in block

    # File lib/active_support/notifications/instrumenter.rb, line 17
17:       def instrument(name, payload={})
18:         started = Time.now
19: 
20:         begin
21:           yield
22:         rescue Exception => e
23:           payload[:exception] = [e.class.name, e.message]
24:           raise e
25:         ensure
26:           @notifier.publish(name, started, Time.now, @id, payload)
27:         end
28:       end

Private Instance Methods

unique_id() click to toggle source
    # File lib/active_support/notifications/instrumenter.rb, line 31
31:         def unique_id
32:           SecureRandom.hex(10)
33:         end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.