Learn R Programming

otel (version 0.2.0)

otel_tracer_provider: OpenTelemetry Tracer Provider Object

Description

otel_tracer_provider -> otel_tracer -> otel_span -> otel_span_context

Arguments

Value

Not applicable.

Implementations

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

  • tracer_provider_noop: No-op tracer provider, used when no traces are emitted.

  • otelsdk::tracer_provider_file: Save traces to a JSONL file.

  • otelsdk::tracer_provider_http: Send traces to a collector over HTTP/OTLP.

  • otelsdk::tracer_provider_memory: Collect emitted traces in memory. For testing.

  • otelsdk::tracer_provider_stdstream: Write traces to standard output or error or to a file. Primarily for debugging.

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.

See also

get_default_tracer_provider(), get_tracer().

tracer_provider$flush()

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

Usage

tracer_provider$flush()

Value

Nothing.

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.

See Also

Other low level trace API: get_default_tracer_provider(), get_tracer(), otel_span, otel_span_context, otel_tracer, tracer_provider_noop

Examples

Run this code
tp <- otel::get_default_tracer_provider()
trc <- tp$get_tracer()
trc$is_enabled()

Run the code above in your browser using DataLab