Class: OpenTelemetry::Metrics::Instrument::Gauge
- Inherits:
-
Object
- Object
- OpenTelemetry::Metrics::Instrument::Gauge
- Defined in:
- lib/opentelemetry/metrics/instrument/gauge.rb
Overview
No-op implementation of Gauge.
Instance Method Summary collapse
-
#bind(attributes: {}) ⇒ Gauge
(Development) Binds a fixed set of attributes to this Gauge, returning an instrument whose #record calls associate every measurement with those attributes.
-
#enabled? ⇒ Boolean
Returns whether this Gauge is enabled for recording measurements.
-
#record(amount, attributes: {}) ⇒ Object
Record the current value for the Gauge.
Instance Method Details
#bind(attributes: {}) ⇒ Gauge
(Development) Binds a fixed set of attributes to this Gauge, returning an instrument whose #record calls associate every measurement with those attributes. Attributes are resolved once at bind time rather than on every recording, avoiding repeated attribute processing and lookup. Passing attributes to #record on the returned bound instrument negates this benefit.
44 45 46 |
# File 'lib/opentelemetry/metrics/instrument/gauge.rb', line 44 def bind(attributes: {}) self end |
#enabled? ⇒ Boolean
Returns whether this Gauge is enabled for recording measurements.
Instrumentation authors need to call this API each time they record a measurement to ensure they have the most up-to-date value.
28 29 30 |
# File 'lib/opentelemetry/metrics/instrument/gauge.rb', line 28 def enabled? true end |
#record(amount, attributes: {}) ⇒ Object
Record the current value for the Gauge
19 |
# File 'lib/opentelemetry/metrics/instrument/gauge.rb', line 19 def record(amount, attributes: {}); end |