Skip to content

otel_tracer_provider -> otel_tracer -> otel_span -> otel_span_context

Value

Not applicable.

Details

The tracer provider defines how traces are exported when collecting telemetry data. It is unlikely that you'd need to use tracer provider objects directly.

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

Typically the tracer provider is created automatically, at the first start_local_active_span() or start_span() call. otel decides which tracer provider class to use based on Environment Variables.

Implementations

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

Methods

tracer_provider$get_tracer()

Get or create a new tracer object.

Usage

tracer_provider$get_tracer(
  name = NULL,
  version = NULL,
  schema_url = NULL,
  attributes = NULL
)

Arguments

  • name: Tracer name, see get_tracer().

  • 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 tracer (otel_tracer) object.

tracer_provider$flush()

Force any buffered spans to flush. Tracer providers might not implement this method.

Usage

tracer_provider$flush()

Value

Nothing.

Examples

tp <- otel::get_default_tracer_provider()
trc <- tp$get_tracer()
trc$is_enabled()
#> [1] FALSE