Class: NewRelic::Agent::Instrumentation::Event
- Inherits:
-
Object
- Object
- NewRelic::Agent::Instrumentation::Event
- Defined in:
- lib/new_relic/agent/instrumentation/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.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#children ⇒ Object
readonly
Returns the value of attribute children.
-
#end ⇒ Object
Returns the value of attribute end.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#parent ⇒ Object
Returns the value of attribute parent.
-
#payload ⇒ Object
readonly
Returns the value of attribute payload.
-
#scope ⇒ Object
Returns the value of attribute scope.
-
#time ⇒ Object
readonly
Returns the value of attribute time.
-
#transaction_id ⇒ Object
readonly
Returns the value of attribute transaction_id.
Instance Method Summary collapse
- #<<(event) ⇒ Object
- #duration ⇒ Object
-
#initialize(name, start, ending, transaction_id, payload) ⇒ Event
constructor
A new instance of Event.
- #metric_name ⇒ Object
- #parent_of?(event) ⇒ Boolean
Constructor Details
#initialize(name, start, ending, transaction_id, payload) ⇒ Event
Returns a new instance of Event.
64 65 66 67 68 69 70 71 |
# File 'lib/new_relic/agent/instrumentation/evented_subscriber.rb', line 64 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
#children ⇒ Object (readonly)
Returns the value of attribute children.
61 62 63 |
# File 'lib/new_relic/agent/instrumentation/evented_subscriber.rb', line 61 def children @children end |
#end ⇒ Object
Returns the value of attribute end.
62 63 64 |
# File 'lib/new_relic/agent/instrumentation/evented_subscriber.rb', line 62 def end @end end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
61 62 63 |
# File 'lib/new_relic/agent/instrumentation/evented_subscriber.rb', line 61 def name @name end |
#parent ⇒ Object
Returns the value of attribute parent.
62 63 64 |
# File 'lib/new_relic/agent/instrumentation/evented_subscriber.rb', line 62 def parent @parent end |
#payload ⇒ Object (readonly)
Returns the value of attribute payload.
61 62 63 |
# File 'lib/new_relic/agent/instrumentation/evented_subscriber.rb', line 61 def payload @payload end |
#scope ⇒ Object
Returns the value of attribute scope.
62 63 64 |
# File 'lib/new_relic/agent/instrumentation/evented_subscriber.rb', line 62 def scope @scope end |
#time ⇒ Object (readonly)
Returns the value of attribute time.
61 62 63 |
# File 'lib/new_relic/agent/instrumentation/evented_subscriber.rb', line 61 def time @time end |
#transaction_id ⇒ Object (readonly)
Returns the value of attribute transaction_id.
61 62 63 |
# File 'lib/new_relic/agent/instrumentation/evented_subscriber.rb', line 61 def transaction_id @transaction_id end |
Instance Method Details
#<<(event) ⇒ Object
81 82 83 |
# File 'lib/new_relic/agent/instrumentation/evented_subscriber.rb', line 81 def <<(event) @children << event end |
#duration ⇒ Object
77 78 79 |
# File 'lib/new_relic/agent/instrumentation/evented_subscriber.rb', line 77 def duration self.end - time end |
#metric_name ⇒ Object
73 74 75 |
# File 'lib/new_relic/agent/instrumentation/evented_subscriber.rb', line 73 def metric_name raise NotImplementedError end |
#parent_of?(event) ⇒ Boolean
85 86 87 |
# File 'lib/new_relic/agent/instrumentation/evented_subscriber.rb', line 85 def parent_of?(event) @children.include? event end |