otel_tracer_provider -> otel_tracer -> otel_span -> otel_span_context
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.
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, seeget_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. Seeas_attributes()
for allowed values. You can also useas_attributes()
to convert R objects to OpenTelemetry attributes.
Value
Returns an OpenTelemetry tracer (otel_tracer) object.
See also
Other low level trace API:
get_default_tracer_provider()
,
get_tracer()
,
otel_span
,
otel_span_context
,
otel_tracer
,
tracer_provider_noop
Examples
tp <- otel::get_default_tracer_provider()
trc <- tp$get_tracer()
trc$is_enabled()
#> [1] FALSE