Class: Dynflow::TelemetryAdapters::Abstract
- Inherits:
-
Object
- Object
- Dynflow::TelemetryAdapters::Abstract
- Defined in:
- lib/dynflow/telemetry_adapters/abstract.rb
Constant Summary collapse
- DEFAULT_BUCKETS =
Default buckets to use when defining a histogram
[0.005, 0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1, 2.5, 5, 10, 20, 30, 60, 120, 300, 600, 1200].freeze
Instance Method Summary collapse
-
#add_counter(name, description, instance_labels = []) ⇒ void
Configures a counter to be collected.
-
#add_gauge(name, description, instance_labels = []) ⇒ void
Configures a gauge to be collected.
-
#add_histogram(name, description, instance_labels = [], buckets = DEFAULT_BUCKETS) ⇒ void
Configures a histogram to be collected.
-
#increment_counter(name, value = 1, tags = {}) ⇒ void
Increments a counter.
- #measure(name, tags = {}) ⇒ Object
-
#observe_histogram(name, value, tags = {}) ⇒ void
Records a histogram entry.
-
#set_gauge(name, value, tags = {}) ⇒ void
Modifies a gauge.
-
#with_instance {|adapter| ... } ⇒ void
Passes self into the block and evaulates it.
Instance Method Details
#add_counter(name, description, instance_labels = []) ⇒ void
This method returns an undefined value.
Configures a counter to be collected
14 15 |
# File 'lib/dynflow/telemetry_adapters/abstract.rb', line 14 def add_counter(name, description, instance_labels = []) end |
#add_gauge(name, description, instance_labels = []) ⇒ void
This method returns an undefined value.
Configures a gauge to be collected
23 24 |
# File 'lib/dynflow/telemetry_adapters/abstract.rb', line 23 def add_gauge(name, description, instance_labels = []) end |
#add_histogram(name, description, instance_labels = [], buckets = DEFAULT_BUCKETS) ⇒ void
This method returns an undefined value.
Configures a histogram to be collected
33 34 |
# File 'lib/dynflow/telemetry_adapters/abstract.rb', line 33 def add_histogram(name, description, instance_labels = [], buckets = DEFAULT_BUCKETS) end |
#increment_counter(name, value = 1, tags = {}) ⇒ void
This method returns an undefined value.
Increments a counter
42 43 |
# File 'lib/dynflow/telemetry_adapters/abstract.rb', line 42 def increment_counter(name, value = 1, = {}) end |
#measure(name, tags = {}) ⇒ Object
71 72 73 74 75 76 77 78 |
# File 'lib/dynflow/telemetry_adapters/abstract.rb', line 71 def measure(name, = {}) before = Process.clock_gettime(Process::CLOCK_MONOTONIC) yield ensure after = Process.clock_gettime(Process::CLOCK_MONOTONIC) duration = (after - before) * 1000 # In miliseconds observe_histogram(name, duration, ) end |
#observe_histogram(name, value, tags = {}) ⇒ void
This method returns an undefined value.
Records a histogram entry
60 61 |
# File 'lib/dynflow/telemetry_adapters/abstract.rb', line 60 def observe_histogram(name, value, = {}) end |
#set_gauge(name, value, tags = {}) ⇒ void
This method returns an undefined value.
Modifies a gauge
51 52 |
# File 'lib/dynflow/telemetry_adapters/abstract.rb', line 51 def set_gauge(name, value, = {}) end |
#with_instance {|adapter| ... } ⇒ void
This method returns an undefined value.
Passes self into the block and evaulates it
67 68 69 |
# File 'lib/dynflow/telemetry_adapters/abstract.rb', line 67 def with_instance yield self if block_given? end |