class Dynflow::TelemetryAdapters::Abstract

Constants

DEFAULT_BUCKETS

Default buckets to use when defining a histogram

Public Instance Methods

add_counter(name, description, instance_labels = []) click to toggle source

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
add_gauge(name, description, instance_labels = []) click to toggle source

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
add_histogram(name, description, instance_labels = [], buckets = DEFAULT_BUCKETS) click to toggle source

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
increment_counter(name, value = 1, tags = {}) click to toggle source

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
measure(name, tags = {}) { || ... } click to toggle source
# 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
observe_histogram(name, value, tags = {}) click to toggle source

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
set_gauge(name, value, tags = {}) click to toggle source

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
with_instance() { |self| ... } click to toggle source

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