Class: Rack::Metrics::Event
- Inherits:
-
ActiveSupport::Notifications::Event
- Object
- ActiveSupport::Notifications::Event
- Rack::Metrics::Event
- Defined in:
- lib/rack/metrics.rb
Instance Attribute Summary collapse
-
#end ⇒ Object
Returns the value of attribute end.
-
#name ⇒ Object
Returns the value of attribute name.
-
#partials ⇒ Object
Returns the value of attribute partials.
-
#payload ⇒ Object
Returns the value of attribute payload.
-
#queries ⇒ Object
Returns the value of attribute queries.
-
#stack ⇒ Object
Returns the value of attribute stack.
-
#template ⇒ Object
Returns the value of attribute template.
-
#time ⇒ Object
Returns the value of attribute time.
-
#transaction_id ⇒ Object
Returns the value of attribute transaction_id.
Instance Method Summary collapse
- #as_json(options = {}) ⇒ Object
- #init(name, start, ending, transaction_id, payload) ⇒ Object
-
#initialize(name, start, ending, transaction_id, payload) ⇒ Event
constructor
A new instance of Event.
Constructor Details
#initialize(name, start, ending, transaction_id, payload) ⇒ Event
Returns a new instance of Event.
126 127 128 129 130 |
# File 'lib/rack/metrics.rb', line 126 def initialize(name, start, ending, transaction_id, payload) @queries = [] @partials = [] super(name, start, ending, transaction_id, payload) end |
Instance Attribute Details
#end ⇒ Object
Returns the value of attribute end.
124 125 126 |
# File 'lib/rack/metrics.rb', line 124 def end @end end |
#name ⇒ Object
Returns the value of attribute name.
124 125 126 |
# File 'lib/rack/metrics.rb', line 124 def name @name end |
#partials ⇒ Object
Returns the value of attribute partials.
124 125 126 |
# File 'lib/rack/metrics.rb', line 124 def partials @partials end |
#payload ⇒ Object
Returns the value of attribute payload.
124 125 126 |
# File 'lib/rack/metrics.rb', line 124 def payload @payload end |
#queries ⇒ Object
Returns the value of attribute queries.
124 125 126 |
# File 'lib/rack/metrics.rb', line 124 def queries @queries end |
#stack ⇒ Object
Returns the value of attribute stack.
124 125 126 |
# File 'lib/rack/metrics.rb', line 124 def stack @stack end |
#template ⇒ Object
Returns the value of attribute template.
124 125 126 |
# File 'lib/rack/metrics.rb', line 124 def template @template end |
#time ⇒ Object
Returns the value of attribute time.
124 125 126 |
# File 'lib/rack/metrics.rb', line 124 def time @time end |
#transaction_id ⇒ Object
Returns the value of attribute transaction_id.
124 125 126 |
# File 'lib/rack/metrics.rb', line 124 def transaction_id @transaction_id end |
Instance Method Details
#as_json(options = {}) ⇒ Object
140 141 142 143 144 145 146 |
# File 'lib/rack/metrics.rb', line 140 def as_json(={}) attrs = super() attrs['duration'] = self.duration.round(2) attrs.delete_if {|k, v| v.nil?} attrs.delete_if {|k, v| v.respond_to?(:empty?) and v.empty? } attrs end |
#init(name, start, ending, transaction_id, payload) ⇒ Object
132 133 134 135 136 137 138 |
# File 'lib/rack/metrics.rb', line 132 def init(name, start, ending, transaction_id, payload) @name = name @payload = payload.dup @time = start @transaction_id = transaction_id @end = ending end |