The tracer provider defines how traces are exported when collecting telemetry data. It is unlikely that you need to call this function directly, but read on to learn how to configure which exporter to use.
get_default_tracer_provider()
The default tracer provider, an otel_tracer_provider
object. See otel_tracer_provider for its methods.
If there is no default set currently, then it creates and sets a default.
The default tracer provider is created based on the OTEL_R_TRACES_EXPORTER environment variable. This environment variable is specifically for R applications with OpenTelemetry support.
If this is not set, then the generic OTEL_TRACES_EXPORTER environment variable is used. This applies to all applications that support OpenTelemetry and use the OpenTelemetry SDK.
The following values are allowed:
none
: no traces are exported.
stdout
or console
: uses otelsdk::tracer_provider_stdstream,
to write traces to the standard output.
stderr
: uses otelsdk::tracer_provider_stdstream, to write traces
to the standard error.
http
or otlp
: uses otelsdk::tracer_provider_http, to send
traces through HTTP, using the OpenTelemetry Protocol (OTLP).
otlp/file
uses otelsdk::tracer_provider_file to write traces
to a JSONL file.
<package>::<provider>
: will select the <provider>
object from
the <package>
package to use as a tracer provider. It calls
<package>::<provider>$new()
to create the new tracer provider.
If this fails for some reason, e.g. the package is not installed,
then it throws an error.
Other low level trace API:
get_tracer()
,
otel_span
,
otel_span_context
,
otel_tracer
,
otel_tracer_provider
,
tracer_provider_noop