Class: Riffer::Metrics::Histogram

Inherits:
Object
  • Object
show all
Defined in:
lib/riffer/metrics.rb

Overview

A handle to a named histogram, safe to hold as a constant: it defers backend resolution to record time, so it survives a meter-provider swap or a runtime enabled flip.

Instance Method Summary collapse

Constructor Details

#initialize(name, unit: nil, description: nil) ⇒ Histogram

– : (String, ?unit: String?, ?description: String?) -> void



28
29
30
31
32
# File 'lib/riffer/metrics.rb', line 28

def initialize(name, unit: nil, description: nil)
  @name = name
  @unit = unit
  @description = description
end

Instance Method Details

#record(value, attributes: nil) ⇒ Object

– : (Numeric, ?attributes: Hash[String, untyped]?) -> void



36
37
38
# File 'lib/riffer/metrics.rb', line 36

def record(value, attributes: nil)
  Riffer::Metrics.record_histogram(@name, value, unit: @unit, description: @description, attributes: attributes)
end