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
15 16 |
# File 'lib/dynflow/telemetry_adapters/abstract.rb', line 15 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
24 25 |
# File 'lib/dynflow/telemetry_adapters/abstract.rb', line 24 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
34 35 |
# File 'lib/dynflow/telemetry_adapters/abstract.rb', line 34 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
43 44 |
# File 'lib/dynflow/telemetry_adapters/abstract.rb', line 43 def increment_counter(name, value = 1, = {}) end |
#measure(name, tags = {}) ⇒ Object
72 73 74 75 76 77 78 79 |
# File 'lib/dynflow/telemetry_adapters/abstract.rb', line 72 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
61 62 |
# File 'lib/dynflow/telemetry_adapters/abstract.rb', line 61 def observe_histogram(name, value, = {}) end |
#set_gauge(name, value, tags = {}) ⇒ void
This method returns an undefined value.
Modifies a gauge
52 53 |
# File 'lib/dynflow/telemetry_adapters/abstract.rb', line 52 def set_gauge(name, value, = {}) end |
#with_instance {|adapter| ... } ⇒ void
This method returns an undefined value.
Passes self into the block and evaulates it
68 69 70 |
# File 'lib/dynflow/telemetry_adapters/abstract.rb', line 68 def with_instance yield self if block_given? end |