class Dynflow::TelemetryAdapters::Abstract
Constants
- DEFAULT_BUCKETS
Default buckets to use when defining a histogram
Public Instance Methods
Configures a counter to be collected
@param [String] name Name of the counter @param [String] description Human-readable description of the counter @param [Array<String>] instance_labels Labels which will be assigned to the collected data @return [void]
# File lib/dynflow/telemetry_adapters/abstract.rb, line 13 def add_counter(name, description, instance_labels = []) end
Configures a gauge to be collected
@param [String] name Name of the gauge @param [String] description Human-readable description of the gauge @param [Array<String>] instance_labels Labels which will be assigned to the collected data @return [void]
# File lib/dynflow/telemetry_adapters/abstract.rb, line 22 def add_gauge(name, description, instance_labels = []) end
Configures a histogram to be collected
@param [String] name Name of the histogram @param [String] description Human-readable description of the histogram @param [Array<String>] instance_labels Labels which will be assigned to the collected data @param [Array<Integer>] buckest Buckets to fit the value into @return [void]
# File lib/dynflow/telemetry_adapters/abstract.rb, line 32 def add_histogram(name, description, instance_labels = [], buckets = DEFAULT_BUCKETS) end
Increments a counter
@param [String,Symbol] name Name of the counter to increment @param [Integer] value Step to increment by @param [Hash{Symbol=>String}] tags Tags to apply to this record @return [void]
# File lib/dynflow/telemetry_adapters/abstract.rb, line 41 def increment_counter(name, value = 1, tags = {}) end
# File lib/dynflow/telemetry_adapters/abstract.rb, line 70 def measure(name, tags = {}) 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, tags) end
Records a histogram entry
@param [String,Symbol] name Name of the histogram @param [String,Integer] value Value to record @param [Hash{Symbol=>String}] tags Tags to apply to this record @return [void]
# File lib/dynflow/telemetry_adapters/abstract.rb, line 59 def observe_histogram(name, value, tags = {}) end
Modifies a gauge
@param [String,Symbol] name Name of the gauge to increment @param [String,Integer] value Step to change by @param [Hash{Symbol=>String}] tags Tags to apply to this record @return [void]
# File lib/dynflow/telemetry_adapters/abstract.rb, line 50 def set_gauge(name, value, tags = {}) end
Passes self into the block and evaulates it
@yieldparam [Abstract] adapter the current telemetry adapter @return [void]
# File lib/dynflow/telemetry_adapters/abstract.rb, line 66 def with_instance yield self if block_given? end