Class: Dynflow::Telemetry
- Inherits:
-
Object
- Object
- Dynflow::Telemetry
- Defined in:
- lib/dynflow/telemetry.rb
Class Attribute Summary collapse
-
.instance ⇒ Object
readonly
Returns the value of attribute instance.
Class Method Summary collapse
- .measure(name, tags = {}, &block) ⇒ Object
-
.register_metrics! ⇒ void
Registers the metrics to be collected.
-
.set_adapter(adapter) ⇒ Object
Configures the adapter to use for telemetry.
-
.with_instance(&block) ⇒ Object
Passes the block into the current telemetry adapter’s Dynflow::TelemetryAdapters::Abstract#with_instance method.
Class Attribute Details
.instance ⇒ Object (readonly)
Returns the value of attribute instance.
10 11 12 |
# File 'lib/dynflow/telemetry.rb', line 10 def instance @instance end |
Class Method Details
.measure(name, tags = {}, &block) ⇒ Object
25 26 27 |
# File 'lib/dynflow/telemetry.rb', line 25 def measure(name, = {}, &block) @instance.measure name, , &block end |
.register_metrics! ⇒ void
This method returns an undefined value.
Registers the metrics to be collected
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/dynflow/telemetry.rb', line 31 def register_metrics! return if @registered @registered = true with_instance do |t| # Worker related t.add_gauge :dynflow_active_workers, 'The number of currently busy workers', [:queue, :world] t.add_counter :dynflow_worker_events, 'The number of processed events', [:queue, :world, :worker] # Execution plan related t.add_gauge :dynflow_active_execution_plans, 'The number of active execution plans', [:action, :world, :state] t.add_gauge :dynflow_queue_size, 'Number of items in queue', [:queue, :world] t.add_counter :dynflow_finished_execution_plans, 'The number of execution plans', [:action, :world, :result] # Step related # TODO: Configure buckets in a sane manner t.add_histogram :dynflow_step_real_time, 'The time between the start end end of the step', [:action, :phase] t.add_histogram :dynflow_step_execution_time, 'The time spent executing a step', [:action, :phase] # Connector related t.add_counter :dynflow_connector_envelopes, 'The number of envelopes handled by a connector', [:world, :direction] # Persistence related t.add_histogram :dynflow_persistence, 'The time spent communicating with the database', [:world, :method] end end |
.set_adapter(adapter) ⇒ Object
Configures the adapter to use for telemetry
15 16 17 |
# File 'lib/dynflow/telemetry.rb', line 15 def set_adapter(adapter) @instance = adapter end |
.with_instance(&block) ⇒ Object
Passes the block into the current telemetry adapter’s Dynflow::TelemetryAdapters::Abstract#with_instance method
21 22 23 |
# File 'lib/dynflow/telemetry.rb', line 21 def with_instance(&block) @instance.with_instance(&block) end |