otel_meter_provider -> otel_meter -> otel_counter, otel_up_down_counter, otel_histogram, otel_gauge
Not applicable.
meter$is_enabled()
Whether the meter is active and emitting measurements.
This is equivalent to the is_measuring_enabled()
function.
meter$is_enabled()
Logical scalar.
meter$create_counter()
Create a new counter instrument.
create_counter(name, description = NULL, unit = NULL)
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.
An OpenTelemetry counter (otel_counter) object.
meter$create_up_down_counter()
Create a new up-down counter instrument.
create_up_down_counter(name, description = NULL, unit = NULL)
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.
An OpenTelemetry counter (otel_up_down_counter) object.
meter$create_histogram()
Create a new histogram.
create_histogram(name, description = NULL, unit = NULL)
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.
An OpenTelemetry histogram (otel_histogram) object.
meter$create_gauge()
Create a new gauge.
create_gauge(name, description = NULL, unit = NULL)
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.
An OpenTelemetry gauge (otel_gauge) object.
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.
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
mp <- get_default_meter_provider()
mtr <- mp$get_meter()
ctr <- mtr$create_counter("session")
ctr$add(1)
Run the code above in your browser using DataLab