Class: OpenTelemetry::SDK::Metrics::Instrument::ObservableGauge

Inherits:
AsynchronousInstrument show all
Defined in:
lib/opentelemetry/sdk/metrics/instrument/observable_gauge.rb

Overview

ObservableGauge is the SDK implementation of AsynchronousInstrument. Asynchronous Gauge is an asynchronous Instrument which reports non-additive value(s) (e.g. the room temperature)

Instance Method Summary collapse

Methods inherited from AsynchronousInstrument

#add_attributes, #init_callback, #initialize, #register_callback, #register_with_new_metric_store, #timeout, #unregister

Constructor Details

This class inherits a constructor from OpenTelemetry::SDK::Metrics::Instrument::AsynchronousInstrument

Instance Method Details

#instrument_kindSymbol

Returns the instrument kind as a Symbol

Returns:

  • (Symbol)


17
18
19
# File 'lib/opentelemetry/sdk/metrics/instrument/observable_gauge.rb', line 17

def instrument_kind
  :observable_gauge
end

#observe(timeout: nil, attributes: {}) ⇒ Object

Observe the Gauge with fixed timeout duration.

Parameters:

  • timeout (int) (defaults to: nil)

    The timeout duration for callback to run, which MUST be a non-negative numeric value.

  • attributes (Hash{String => String, Numeric, Boolean, Array<String, Numeric, Boolean>}) (defaults to: {})

    Values must be non-nil and (array of) string, boolean or numeric type. Array values must not contain nil elements and all elements must be of the same basic type (string, numeric, boolean).



28
29
30
# File 'lib/opentelemetry/sdk/metrics/instrument/observable_gauge.rb', line 28

def observe(timeout: nil, attributes: {})
  update(timeout, attributes)
end