Class: OneApm::Agent::Instrumentation::Event

Inherits:
Object
  • Object
show all
Defined in:
lib/one_apm/inst/support/evented_subscriber.rb

Overview

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.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, start, ending, transaction_id, payload) ⇒ Event

Returns a new instance of Event.



71
72
73
74
75
76
77
78
# File 'lib/one_apm/inst/support/evented_subscriber.rb', line 71

def initialize(name, start, ending, transaction_id, payload)
  @name           = name
  @payload        = payload.dup
  @time           = start
  @transaction_id = transaction_id
  @end            = ending
  @children       = []
end

Instance Attribute Details

#childrenObject (readonly)

Returns the value of attribute children.



68
69
70
# File 'lib/one_apm/inst/support/evented_subscriber.rb', line 68

def children
  @children
end

#endObject

Returns the value of attribute end.



69
70
71
# File 'lib/one_apm/inst/support/evented_subscriber.rb', line 69

def end
  @end
end

#frameObject

Returns the value of attribute frame.



69
70
71
# File 'lib/one_apm/inst/support/evented_subscriber.rb', line 69

def frame
  @frame
end

#nameObject (readonly)

Returns the value of attribute name.



68
69
70
# File 'lib/one_apm/inst/support/evented_subscriber.rb', line 68

def name
  @name
end

#parentObject

Returns the value of attribute parent.



69
70
71
# File 'lib/one_apm/inst/support/evented_subscriber.rb', line 69

def parent
  @parent
end

#payloadObject (readonly)

Returns the value of attribute payload.



68
69
70
# File 'lib/one_apm/inst/support/evented_subscriber.rb', line 68

def payload
  @payload
end

#timeObject (readonly)

Returns the value of attribute time.



68
69
70
# File 'lib/one_apm/inst/support/evented_subscriber.rb', line 68

def time
  @time
end

#transaction_idObject (readonly)

Returns the value of attribute transaction_id.



68
69
70
# File 'lib/one_apm/inst/support/evented_subscriber.rb', line 68

def transaction_id
  @transaction_id
end

Instance Method Details

#<<(event) ⇒ Object



88
89
90
# File 'lib/one_apm/inst/support/evented_subscriber.rb', line 88

def <<(event)
  @children << event
end

#durationObject



84
85
86
# File 'lib/one_apm/inst/support/evented_subscriber.rb', line 84

def duration
  self.end - time
end

#metric_nameObject

Raises:

  • (NotImplementedError)


80
81
82
# File 'lib/one_apm/inst/support/evented_subscriber.rb', line 80

def metric_name
  raise NotImplementedError
end

#parent_of?(event) ⇒ Boolean

Returns:

  • (Boolean)


92
93
94
# File 'lib/one_apm/inst/support/evented_subscriber.rb', line 92

def parent_of?(event)
  @children.include? event
end