otel_tracer_provider -> otel_tracer -> otel_span -> otel_span_context
Details
Usually you do not need to deal with otel_tracer objects directly.
start_local_active_span() (and start_span()) automatically
sets up the tracer and uses it to create spans.
A tracer object is created by calling the get_tracer() method of an
otel_tracer_provider.
You can use the start_span() method of the tracer object to create a
span.
Typically there is a separate tracer object for each instrumented R package.
Methods
tracer$start_span()
Creates and starts a new span.
It does not activate the new span.
It is equivalent to the start_span() function.
Arguments
name: Name of the span. If not specified it will be"<NA>".attributes: Span attributes. OpenTelemetry supports the following R types as attributes: `character, logical, double, integer. You may useas_attributes()to convert other R types to OpenTelemetry attributes.links: A named list of links to other spans. Every link must be an OpenTelemetry span (otel_span) object, or a list with a span object as the first element and named span attributes as the rest.options: A named list of span options. May include:start_system_time: Start time in system time.start_steady_time: Start time using a steady clock.parent: A parent span or span context. If it isNA, then the span has no parent and it will be a root span. If it isNULL, then the current context is used, i.e. the active span, if any.kind: Span kind, one of span_kinds: "internal", "server", "client", "producer", "consumer".
Value
A new otel_span object.
tracer$is_enabled()
Whether the tracer is active and recording traces.
This is equivalent to the is_tracing_enabled() function.
See also
Other low level trace API:
get_default_tracer_provider(),
get_tracer(),
otel_span,
otel_span_context,
otel_tracer_provider,
tracer_provider_noop
Examples
tp <- get_default_tracer_provider()
trc <- tp$get_tracer()
trc$is_enabled()
#> [1] FALSE