class OpenTelemetry::Metrics::Meter
No-op implementation of Meter.
def create_counter(name, unit: nil, description: nil)
-
(nil)
- after creation of counter, it will be stored in instrument_registry
Parameters:
-
description
(optional String
) -- an optional free-form text provided by user. -
unit
(optional String
) -- an optional string provided by user. -
name
(String
) -- the name of the counter
def create_counter(name, unit: nil, description: nil) create_instrument(:counter, name, unit, description, nil) { COUNTER } end
def create_gauge(name, unit: nil, description: nil)
-
(nil)
- after creation of gauge, it will be stored in instrument_registry
Parameters:
-
description
(optional String
) -- an optional free-form text provided by user. -
unit
(optional String
) -- an optional string provided by user. -
name
(String
) -- the name of the gauge.
def create_gauge(name, unit: nil, description: nil) create_instrument(:gauge, name, unit, description, nil) { GAUGE } end
def create_histogram(name, unit: nil, description: nil)
-
(nil)
- after creation of histogram, it will be stored in instrument_registry
Parameters:
-
description
(optional String
) -- an optional free-form text provided by user. -
unit
(optional String
) -- an optional string provided by user. -
name
(String
) -- the name of the histogram
def create_histogram(name, unit: nil, description: nil) create_instrument(:histogram, name, unit, description, nil) { HISTOGRAM } end
def create_instrument(kind, name, unit, description, callback)
def create_instrument(kind, name, unit, description, callback) @mutex.synchronize do OpenTelemetry.logger.warn("duplicate instrument registration occurred for instrument #{name}") if @instrument_registry.include? name @instrument_registry[name] = yield end end
def create_observable_counter(name, callback:, unit: nil, description: nil)
-
(nil)
- after creation of observable_counter, it will be stored in instrument_registry
Parameters:
-
description
(optional String
) -- an optional free-form text provided by user. -
unit
(optional String
) -- an optional string provided by user. -
callback
(Proc
) -- the callback function that used to collect metrics -
name
(String
) -- the name of the observable_counter
def create_observable_counter(name, callback:, unit: nil, description: nil) create_instrument(:observable_counter, name, unit, description, callback) { OBSERVABLE_COUNTER } end
def create_observable_gauge(name, callback:, unit: nil, description: nil)
-
(nil)
- after creation of observable_gauge, it will be stored in instrument_registry
Parameters:
-
description
(optional String
) -- an optional free-form text provided by user. -
unit
(optional String
) -- an optional string provided by user. -
callback
(Proc
) -- the callback function that used to collect metrics -
name
(String
) -- the name of the observable_gauge
def create_observable_gauge(name, callback:, unit: nil, description: nil) create_instrument(:observable_gauge, name, unit, description, callback) { OBSERVABLE_GAUGE } end
def create_observable_up_down_counter(name, callback:, unit: nil, description: nil)
-
(nil)
- after creation of observable_up_down_counter, it will be stored in instrument_registry
Parameters:
-
description
(optional String
) -- an optional free-form text provided by user. -
unit
(optional String
) -- an optional string provided by user. -
callback
(Proc
) -- the callback function that used to collect metrics -
name
(String
) -- the name of the observable_up_down_counter
def create_observable_up_down_counter(name, callback:, unit: nil, description: nil) create_instrument(:observable_up_down_counter, name, unit, description, callback) { OBSERVABLE_UP_DOWN_COUNTER } end
def create_up_down_counter(name, unit: nil, description: nil)
-
(nil)
- after creation of up_down_counter, it will be stored in instrument_registry
Parameters:
-
description
(optional String
) -- an optional free-form text provided by user. -
unit
(optional String
) -- an optional string provided by user. -
name
(String
) -- the name of the up_down_counter
def create_up_down_counter(name, unit: nil, description: nil) create_instrument(:up_down_counter, name, unit, description, nil) { UP_DOWN_COUNTER } end
def initialize
def initialize @mutex = Mutex.new @instrument_registry = {} end