Class: Chillout::Integrations::StateMachineTransitionMeasurement
- Inherits:
-
Object
- Object
- Chillout::Integrations::StateMachineTransitionMeasurement
- Defined in:
- lib/chillout/integrations/state_machine.rb
Instance Method Summary collapse
- #as_measurements ⇒ Object
-
#initialize(instance, transition, started, finished) ⇒ StateMachineTransitionMeasurement
constructor
A new instance of StateMachineTransitionMeasurement.
- #job_class ⇒ Object
Constructor Details
#initialize(instance, transition, started, finished) ⇒ StateMachineTransitionMeasurement
Returns a new instance of StateMachineTransitionMeasurement.
6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/chillout/integrations/state_machine.rb', line 6 def initialize(instance, transition, started, finished) @class = instance.class.name @attribute = transition.attribute.to_s @event = transition.event.to_s @from = transition.from.to_s @to = transition.to.to_s @started = started.utc @finished = finished.utc @duration = 1000.0 * (@finished.to_f - @started.to_f) end |
Instance Method Details
#as_measurements ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/chillout/integrations/state_machine.rb', line 23 def as_measurements() [{ series: "#{@class}##{@attribute}", tags: { class: @class, attribute: @attribute, event: @event, from: @from, to: @to, }, timestamp: @finished.iso8601, values: { value: 1, duration: @duration.to_f, }, }] end |
#job_class ⇒ Object
19 20 21 |
# File 'lib/chillout/integrations/state_machine.rb', line 19 def job_class @class end |