Class: Chillout::Subscribers::ActionControllerNotifications::RequestMetric
- Inherits:
-
Object
- Object
- Chillout::Subscribers::ActionControllerNotifications::RequestMetric
- Defined in:
- lib/chillout/subscribers/action_controller_notifications.rb
Instance Attribute Summary collapse
-
#duration ⇒ Object
readonly
Returns the value of attribute duration.
-
#end ⇒ Object
readonly
Returns the value of attribute end.
-
#payload ⇒ Object
readonly
Returns the value of attribute payload.
Instance Method Summary collapse
- #as_measurements ⇒ Object
-
#initialize(event) ⇒ RequestMetric
constructor
A new instance of RequestMetric.
Constructor Details
#initialize(event) ⇒ RequestMetric
Returns a new instance of RequestMetric.
6 7 8 9 10 |
# File 'lib/chillout/subscribers/action_controller_notifications.rb', line 6 def initialize(event) @end = event.end @duration = event.duration @payload = event.payload.except(:headers) end |
Instance Attribute Details
#duration ⇒ Object (readonly)
Returns the value of attribute duration.
35 36 37 |
# File 'lib/chillout/subscribers/action_controller_notifications.rb', line 35 def duration @duration end |
#end ⇒ Object (readonly)
Returns the value of attribute end.
35 36 37 |
# File 'lib/chillout/subscribers/action_controller_notifications.rb', line 35 def end @end end |
#payload ⇒ Object (readonly)
Returns the value of attribute payload.
35 36 37 |
# File 'lib/chillout/subscribers/action_controller_notifications.rb', line 35 def payload @payload end |
Instance Method Details
#as_measurements ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/chillout/subscribers/action_controller_notifications.rb', line 12 def as_measurements() format = (payload[:format] || "all").to_s format = "all" if format == "*/*" [{ series: "request", tags: { controller: payload[:controller], action: payload[:action], format: format, method: payload[:method], status: payload[:status], }, timestamp: self.end.iso8601, values: { finished: 1, duration: duration.to_f, db: (payload[:db_runtime] || 0).to_f, view: (payload[:view_runtime] || 0).to_f, }, }] end |