class TingYun::Instrumentation::Support::Event

Taken from ActiveSupport::Notifications::Event, pasted here with a couple minor additions so we don't have a hard dependency on ActiveSupport::Notifications.

Represents an intrument event, provides timing and metric name information useful when recording metrics.

Attributes

children[R]
end[RW]
frame[RW]
name[R]
parent[RW]
payload[R]
time[R]
transaction_id[R]

Public Class Methods

new(name, start, ending, transaction_id, payload, _=nil) click to toggle source
# File lib/ting_yun/instrumentation/support/evented_subscriber.rb, line 69
def initialize(name, start, ending, transaction_id, payload, _=nil)
  @name           = name
  @payload        = payload.dup
  @time           = start
  @transaction_id = transaction_id
  @end            = ending
  @children       = []
end

Public Instance Methods

<<(event) click to toggle source
# File lib/ting_yun/instrumentation/support/evented_subscriber.rb, line 86
def <<(event)
  @children << event
end
duration() click to toggle source
# File lib/ting_yun/instrumentation/support/evented_subscriber.rb, line 82
def duration
  (self.end - time)*1000
end
metric_name() click to toggle source
# File lib/ting_yun/instrumentation/support/evented_subscriber.rb, line 78
def metric_name
  raise NotImplementedError
end
parent_of?(event) click to toggle source
# File lib/ting_yun/instrumentation/support/evented_subscriber.rb, line 90
def parent_of?(event)
  @children.include? event
end