Class: OpenTelemetry::SDK::Metrics::Instrument::ObservableUpDownCounter

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

Overview

ObservableUpDownCounter is the SDK implementation of AsynchronousInstrument. Asynchronous UpDownCounter is an asynchronous Instrument which reports additive value(s) (e.g. the process heap size)

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_up_down_counter.rb', line 17

def instrument_kind
  :observable_up_down_counter
end

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

Observe the UpDownCounter 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_up_down_counter.rb', line 28

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