Methods
Attributes
[R] | children | |
[RW] | end | |
[R] | name | |
[R] | payload | |
[R] | time | |
[R] | transaction_id |
Class Public methods
new(name, start, ending, transaction_id, payload)
📝 Source code
# File activesupport/lib/active_support/notifications/instrumenter.rb, line 58
def initialize(name, start, ending, transaction_id, payload)
@name = name
@payload = payload.dup
@time = start
@transaction_id = transaction_id
@end = ending
@children = []
@duration = nil
end
🔎 See on GitHub
Instance Public methods
<<(event)
📝 Source code
# File activesupport/lib/active_support/notifications/instrumenter.rb, line 84
def <<(event)
@children << event
end
🔎 See on GitHub
duration()
Returns the difference in milliseconds between when the execution of the event started and when it ended.
ActiveSupport::Notifications.subscribe('wait') do |*args|
@event = ActiveSupport::Notifications::Event.new(*args)
end
ActiveSupport::Notifications.instrument('wait') do
sleep 1
end
@event.duration # => 1000.138
📝 Source code
# File activesupport/lib/active_support/notifications/instrumenter.rb, line 80
def duration
@duration ||= 1000.0 * (self.end - time)
end
🔎 See on GitHub
parent_of?(event)
📝 Source code
# File activesupport/lib/active_support/notifications/instrumenter.rb, line 88
def parent_of?(event)
@children.include? event
end
🔎 See on GitHub