Class: OpenTelemetry::SDK::Metrics::Instrument::Gauge
- Inherits:
-
SynchronousInstrument
- Object
- SynchronousInstrument
- OpenTelemetry::SDK::Metrics::Instrument::Gauge
- Defined in:
- lib/opentelemetry/sdk/metrics/instrument/gauge.rb
Overview
Gauge is the SDK implementation of Metrics::Gauge.
Instance Method Summary collapse
-
#instrument_kind ⇒ Symbol
Returns the instrument kind as a Symbol.
-
#record(value, attributes: {}) ⇒ Object
Record the absolute value of the Gauge.
Methods inherited from SynchronousInstrument
#initialize, #register_with_new_metric_store
Constructor Details
This class inherits a constructor from OpenTelemetry::SDK::Metrics::Instrument::SynchronousInstrument
Instance Method Details
#instrument_kind ⇒ Symbol
Returns the instrument kind as a Symbol
16 17 18 |
# File 'lib/opentelemetry/sdk/metrics/instrument/gauge.rb', line 16 def instrument_kind :gauge end |
#record(value, attributes: {}) ⇒ Object
Record the absolute value of the Gauge.
27 28 29 30 31 32 33 34 35 36 |
# File 'lib/opentelemetry/sdk/metrics/instrument/gauge.rb', line 27 def record(value, attributes: {}) # TODO: When the metrics SDK stabilizes and is merged into the main SDK, # we can leverage the SDK Internal validation classes to enforce this: # https://github.com/open-telemetry/opentelemetry-ruby/blob/6bec625ef49004f364457c26263df421526b60d6/sdk/lib/opentelemetry/sdk/internal.rb#L47 update(value, attributes) nil rescue StandardError => e OpenTelemetry.handle_error(exception: e) nil end |