otel_meter_provider -> otel_meter -> otel_counter, otel_up_down_counter, otel_histogram, otel_gauge
Details
Usually you do not need to deal with otel_meter objects directly.
counter_add()
, up_down_counter_add()
, histogram_record()
and
gauge_record()
automatically set up the meter and uses it to create
instruments.
A meter object is created by calling the get_meter()
method of an
otel_meter_provider.
You can use the create_counter()
, create_up_down_counter()
,
create_histogram()
, create_gauge()
methods of the meter object to
create instruments.
Typically there is a separate meter object for each instrumented R package.
Methods
meter$is_enabled()
Whether the meter is active and emitting measurements.
This is equivalent to the is_measuring_enabled()
function.
meter$create_counter()
Create a new counter instrument.
Arguments
name
: Name of the instrument.description
: Optional description.unit
: Optional measurement unit. If specified, it should use units from Unified Code for Units of Measure, according to the OpenTelemetry semantic conventions.
Value
An OpenTelemetry counter (otel_counter) object.
meter$create_up_down_counter()
Create a new up-down counter instrument.
Arguments
name
: Name of the instrument.description
: Optional description.unit
: Optional measurement unit. If specified, it should use units from Unified Code for Units of Measure, according to the OpenTelemetry semantic conventions.
Value
An OpenTelemetry counter (otel_up_down_counter) object.
meter$create_histogram()
Create a new histogram.
Arguments
name
: Name of the instrument.description
: Optional description.unit
: Optional measurement unit. If specified, it should use units from Unified Code for Units of Measure, according to the OpenTelemetry semantic conventions.
Value
An OpenTelemetry histogram (otel_histogram) object.
meter$create_gauge()
Create a new gauge.
Arguments
name
: Name of the instrument.description
: Optional description.unit
: Optional measurement unit. If specified, it should use units from Unified Code for Units of Measure, according to the OpenTelemetry semantic conventions.
Value
An OpenTelemetry gauge (otel_gauge) object.
See also
Other low level metrics API:
get_default_meter_provider()
,
get_meter()
,
meter_provider_noop
,
otel_counter
,
otel_gauge
,
otel_histogram
,
otel_meter_provider
,
otel_up_down_counter
Examples
mp <- get_default_meter_provider()
mtr <- mp$get_meter()
ctr <- mtr$create_counter("session")
ctr$add(1)