Skip to content

OpenTelemetry

read_otlp

read_otlp(
    source: str
    | PathLike[str]
    | bytes
    | Mapping[str, Any]
    | Iterable[Any],
) -> Traces

Read OTLP/JSON traces.

Parameters:

  • source (str | PathLike[str] | bytes | Mapping[str, Any] | Iterable[Any]) –

    A file (.json, or .jsonl with one export request per line), JSON text, or the parsed JSON: an export request ({"resourceSpans": [...]}) or a list of them.

Returns:

  • Traces –

    The spans and the events in them.

Traces

Bases: NamedTuple

Spans and their events, as dicts of columns (any table library reads them).

spans instance-attribute

spans: dict[str, ndarray]

A row per span: trace_id, span_id, parent_id (None for a root), name, service, kind, status ("unset", "ok", "error"), status_message, start and end (datetime64[ns], UTC) and attributes (as text).

events instance-attribute

events: dict[str, ndarray]

A row per event in a span (a log line, an exception): trace_id, span_id, time (datetime64[ns], UTC), name and attributes (as text).