Skip to contents

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, boundaries = NULL)

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.

  • boundaries: Optional numeric vector of explicit bucket boundaries, in increasing order. This is an advisory parameter, the SDK may ignore it, e.g. if a view configures different boundaries for the histogram. If NULL, the default boundaries of the SDK are used.

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)