Skip to content

Value

Not applicable.

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.

Usage

meter$is_enabled()

Value

Logical scalar.

meter$create_counter()

Create a new counter instrument.

Usage

create_counter(name, description = NULL, unit = NULL)

Arguments

Value

An OpenTelemetry counter (otel_counter) object.

meter$create_up_down_counter()

Create a new up-down counter instrument.

Usage

create_up_down_counter(name, description = NULL, unit = NULL)

Arguments

Value

An OpenTelemetry counter (otel_up_down_counter) object.

meter$create_histogram()

Create a new histogram.

Usage

create_histogram(name, description = NULL, unit = NULL)

Arguments

Value

An OpenTelemetry histogram (otel_histogram) object.

meter$create_gauge()

Create a new gauge.

Usage

create_gauge(name, description = NULL, unit = NULL)

Arguments

Value

An OpenTelemetry gauge (otel_gauge) object.

Examples

mp <- get_default_meter_provider()
mtr <- mp$get_meter()
ctr <- mtr$create_counter("session")
ctr$add(1)