Skip to contents

Gives a tool, a resource, a prompt or a completion function the OpenTelemetry trace context its client sent in the _meta of the request: traceparent, tracestate and baggage, in the W3C formats. The function can make it the parent of its own spans, with otel::start_local_active_span(options = list(parent = otel::extract_http_context(mordew::trace_context()))), or send it on to the services it calls, so that its work shows in the trace of the client.

Usage

trace_context()

Value

A named list of the keys the client sent, or NULL outside a call or when it sent none.

Examples

# Outside a call, there is none.
trace_context()
#> NULL