class Mmtrix::Agent::Instrumentation::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 intrumentation 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) click to toggle source
# File lib/mmtrix/agent/instrumentation/evented_subscriber.rb, line 73
def initialize(name, start, ending, transaction_id, payload)
  @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/mmtrix/agent/instrumentation/evented_subscriber.rb, line 90
def <<(event)
  @children << event
end
duration() click to toggle source
# File lib/mmtrix/agent/instrumentation/evented_subscriber.rb, line 86
def duration
  self.end - time
end
metric_name() click to toggle source
# File lib/mmtrix/agent/instrumentation/evented_subscriber.rb, line 82
def metric_name
  raise NotImplementedError
end
parent_of?(event) click to toggle source
# File lib/mmtrix/agent/instrumentation/evented_subscriber.rb, line 94
def parent_of?(event)
  @children.include? event
end