Learn R Programming

otel (version 0.2.0)

otel_meter_provider: OpenTelemetry meter provider objects

Description

otel_meter_provider -> otel_meter -> otel_counter, otel_up_down_counter, otel_histogram, otel_gauge

Arguments

Value

Not applicable.

Implementations

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

  • meter_provider_noop: No-op meter provider, used when no metrics are emitted.

  • otelsdk::meter_provider_file: Save metrics to a JSONL file.

  • otelsdk::meter_provider_http: Send metrics to a collector over HTTP/OTLP.

  • otelsdk::meter_provider_memory: Collect emitted metrics in memory. For testing.

  • otelsdk::meter_provider_stdstream: Write metrics to standard output or error or to a file. Primarily for debugging.

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.

See also

get_default_meter_provider(), get_meter().

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

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.

See Also

Other low level metrics API: get_default_meter_provider(), get_meter(), meter_provider_noop, otel_counter, otel_gauge, otel_histogram, otel_meter, otel_up_down_counter

Examples

Run this code
mp <- otel::get_default_meter_provider()
mtr <- mp$get_meter()
mtr$is_enabled()

Run the code above in your browser using DataLab