otel_tracer_provider -> otel_tracer -> otel_span -> otel_span_context
Not applicable.
span_context$get_span_id()
Get the id of the span.
span_context$get_span_id()
String scalar, a span id. For invalid spans it is invalid_span_id.
span_context$get_trace_flags()
Get the trace flags of a span.
See the specification for more details on trace flags.
span_context$get_trace_flags()
A list with entries:
is_sampled
: logical flag, whether the trace of the span is sampled.
If FALSE
then the caller is not recording the trace. See details in
the specification.
is_random
: logical flag, it specifies how trace ids are generated.
See details in the specification.
span_context$get_trace_id()
Get the id of the trace the span belongs to.
span_context$get_trace_id()
A string scalar, a trace id. For invalid spans it is invalid_trace_id.
span_context$is_remote()
Whether the span was propagated from a remote parent.
span_context$is_remote()
A logical scalar.
span_context$is_sampled()
Whether the span is sampled. This is the same as the is_sampled
trace flags, see get_trace_flags()
above.
span_context$is_sampled()
Logical scalar.
span_context$is_valid()
Whether the span is valid. Sometimes otel functions return an
invalid span or a span context referring to an invalid span. E.g.
get_active_span_context()
does that if there is no active span.
is_valid()
checks if the span is valid.
An span id of an invalid span is invalid_span_id.
span_context$is_valid()
A logical scalar.
span_context$to_http_headers()
Serialize the span context into one or more HTTP headers that can be transmitted to other processes or servers, to create a distributed trace.
The other process can deserialize these headers into a span context that can be used to create new remote spans.
span_context$to_http_headers()
A named character vector, the HTTP header representation of the span
context. Usually includes a traceparent
header. May include other
headers.
This is a representation of a span that can be serialized, copied to other processes, and it can be used to create new child spans.
Other low level trace API:
get_default_tracer_provider()
,
get_tracer()
,
otel_span
,
otel_tracer
,
otel_tracer_provider
,
tracer_provider_noop
spc <- get_active_span_context()
spc$get_trace_flags()
spc$get_trace_id()
spc$get_span_id()
spc$is_remote()
spc$is_sampled()
spc$is_valid()
spc$to_http_headers()
Run the code above in your browser using DataLab