Skip to content

Value

Not applicable.

Details

The meter provider defines how metrics are exported when collecting telemetry data. It is unlikely that you need to use meter provider objects directly.

Usually there is a single meter provider for an R app or script.

Typically the meter provider is created automatically, at the first counter_add(), up_down_counter_add(), histogram_record(), gauge_record() or get_meter() call. otel decides which meter provider class to use based on Environment Variables.

Implementations

Note that this list is updated manually and may be incomplete.

Methods

meter_provider$get_meter()

Get or create a new meter object.

Usage

meter_provider$get_meter(
  name = NULL,
  version = NULL,
  schema_url = NULL,
  attributes = NULL
)

Arguments

  • name: Meter name, see get_meter().

  • version: Optional. Specifies the version of the instrumentation scope if the scope has a version (e.g. R package version). Example value: "1.0.0".

  • schema_url: Optional. Specifies the Schema URL that should be recorded in the emitted telemetry.

  • attributes: Optional. Specifies the instrumentation scope attributes to associate with emitted telemetry. See as_attributes() for allowed values. You can also use as_attributes() to convert R objects to OpenTelemetry attributes.

Value

Returns an OpenTelemetry meter (otel_meter) object.

meter_provider$flush()

Force any buffered metrics to flush. Meter providers might not implement this method.

Usage

meter_provider$flush()

Value

Nothing.

meter_provider$shutdown()

Stop the meter provider. Stops collecting and emitting measurements.

Usage

meter_provider$shurdown()

Value

Nothing

Examples

mp <- otel::get_default_meter_provider()
mtr <- mp$get_meter()
mtr$is_enabled()
#> [1] FALSE