otel_meter_provider -> otel_meter -> otel_counter, otel_up_down_counter, otel_histogram, otel_gauge
Not applicable.
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.
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.
meter_provider$get_meter()Get or create a new meter object.
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.
Returns an OpenTelemetry meter (otel_meter) object.
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
mp <- otel::get_default_meter_provider()
mtr <- mp$get_meter()
mtr$is_enabled()
#> [1] FALSE