Skip to content

Get a meter from the default meter provider

Usage

get_meter(
  name = NULL,
  version = NULL,
  schema_url = NULL,
  attributes = NULL,
  ...,
  provider = NULL
)

Arguments

name

Name of the new tracer. If missing, then deduced automatically.

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.

...

Additional arguments are passed to the get_meter() method of the provider.

provider

Meter provider to use. If NULL, then it uses get_default_meter_provider() to get a tracer provider.

Value

An otel_meter object.

Examples

myfun <- function() {
  mtr <- otel::get_meter()
  ctr <- mtr$create_counter("session-count")
  ctr$add(1)
}
myfun()