Class: OpenTelemetry::Internal::ProxyMeter Private

Inherits:
Metrics::Meter show all
Defined in:
lib/opentelemetry/internal/proxy_meter.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

ProxyMeter is an implementation of Trace::Meter. It is returned from the ProxyMeterProvider until a delegate meter provider is installed. After the delegate meter provider is installed, the ProxyMeter will delegate to the corresponding “real” meter.

Constant Summary

Constants inherited from Metrics::Meter

Metrics::Meter::DuplicateInstrumentError, Metrics::Meter::InstrumentDescriptionError, Metrics::Meter::InstrumentNameError, Metrics::Meter::InstrumentUnitError, Metrics::Meter::NAME_REGEX

Instance Method Summary collapse

Methods inherited from Metrics::Meter

#create_counter, #create_histogram, #create_observable_counter, #create_observable_gauge, #create_observable_up_down_counter, #create_up_down_counter

Constructor Details

#initializeProxyMeter

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new OpenTelemetry::Internal::ProxyMeter instance.



19
20
21
22
# File 'lib/opentelemetry/internal/proxy_meter.rb', line 19

def initialize
  super
  @delegate = nil
end

Instance Method Details

#delegate=(meter) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Set the delegate Meter. If this is called more than once, a warning will be logged and superfluous calls will be ignored.

Parameters:

  • meter (Meter)

    The Meter to delegate to



28
29
30
31
32
33
34
35
36
37
# File 'lib/opentelemetry/internal/proxy_meter.rb', line 28

def delegate=(meter)
  @mutex.synchronize do
    if @delegate.nil?
      @delegate = meter
      @instrument_registry.each_value { |instrument| instrument.upgrade_with(meter) }
    else
      OpenTelemetry.logger.warn 'Attempt to reset delegate in ProxyMeter ignored.'
    end
  end
end