Class: OpenTelemetry::Metrics::Meter
- Inherits:
-
Object
- Object
- OpenTelemetry::Metrics::Meter
- Defined in:
- lib/opentelemetry/metrics/meter.rb
Overview
No-op implementation of Meter.
Direct Known Subclasses
Constant Summary collapse
- DuplicateInstrumentError =
Class.new(OpenTelemetry::Error)
- InstrumentNameError =
Class.new(OpenTelemetry::Error)
- InstrumentUnitError =
Class.new(OpenTelemetry::Error)
- InstrumentDescriptionError =
Class.new(OpenTelemetry::Error)
Instance Method Summary collapse
- #create_counter(name, unit: nil, description: nil) ⇒ Object
- #create_histogram(name, unit: nil, description: nil) ⇒ Object
- #create_observable_counter(name, callback:, unit: nil, description: nil) ⇒ Object
- #create_observable_gauge(name, callback:, unit: nil, description: nil) ⇒ Object
- #create_observable_up_down_counter(name, callback:, unit: nil, description: nil) ⇒ Object
- #create_up_down_counter(name, unit: nil, description: nil) ⇒ Object
-
#initialize ⇒ Meter
constructor
A new instance of Meter.
Constructor Details
#initialize ⇒ Meter
Returns a new instance of Meter.
25 26 27 28 |
# File 'lib/opentelemetry/metrics/meter.rb', line 25 def initialize @mutex = Mutex.new @instrument_registry = {} end |
Instance Method Details
#create_counter(name, unit: nil, description: nil) ⇒ Object
30 31 32 |
# File 'lib/opentelemetry/metrics/meter.rb', line 30 def create_counter(name, unit: nil, description: nil) create_instrument(:counter, name, unit, description, nil) { COUNTER } end |
#create_histogram(name, unit: nil, description: nil) ⇒ Object
34 35 36 |
# File 'lib/opentelemetry/metrics/meter.rb', line 34 def create_histogram(name, unit: nil, description: nil) create_instrument(:histogram, name, unit, description, nil) { HISTOGRAM } end |
#create_observable_counter(name, callback:, unit: nil, description: nil) ⇒ Object
42 43 44 |
# File 'lib/opentelemetry/metrics/meter.rb', line 42 def create_observable_counter(name, callback:, unit: nil, description: nil) create_instrument(:observable_counter, name, unit, description, callback) { OBSERVABLE_COUNTER } end |
#create_observable_gauge(name, callback:, unit: nil, description: nil) ⇒ Object
46 47 48 |
# File 'lib/opentelemetry/metrics/meter.rb', line 46 def create_observable_gauge(name, callback:, unit: nil, description: nil) create_instrument(:observable_gauge, name, unit, description, callback) { OBSERVABLE_GAUGE } end |
#create_observable_up_down_counter(name, callback:, unit: nil, description: nil) ⇒ Object
50 51 52 |
# File 'lib/opentelemetry/metrics/meter.rb', line 50 def create_observable_up_down_counter(name, callback:, unit: nil, description: nil) create_instrument(:observable_up_down_counter, name, unit, description, callback) { OBSERVABLE_UP_DOWN_COUNTER } end |
#create_up_down_counter(name, unit: nil, description: nil) ⇒ Object
38 39 40 |
# File 'lib/opentelemetry/metrics/meter.rb', line 38 def create_up_down_counter(name, unit: nil, description: nil) create_instrument(:up_down_counter, name, unit, description, nil) { UP_DOWN_COUNTER } end |