Skip to main content

Distributed trace format

Keep OpenTelemetry’s hierarchy when traces enter the browser.

OTLP carries resources, instrumentation scopes, spans, events, links, status, and typed attributes. loaders.gl preserves that hierarchy through related Arrow tables and supports binary and JSON-oriented encodings.

loaders.gl support​

The OTLP path

Decode the envelope. Preserve resources. Analyze spans as tables.

The projection keeps resource and scope identity separate from repeated span rows, while retaining typed attributes and nanosecond timestamps for downstream analysis.

Input

OTLP protobuf, protobuf-JSON, or JSON Lines

Hierarchy

Resources → scopes → spans → events and links

Output

Five related Arrow tables

Stream

Repeated protobuf messages or complete JSON Lines

The OpenTelemetry Protocol (OTLP) represents distributed traces as resources containing instrumentation scopes, which contain spans. Spans can contain attributes, timestamped events, links to other spans, and status information. The traces module accepts the standard OTLP TracesData wire shape used by trace export requests.

Detailed guide

OTLP projection and fidelity details

The reference below covers encodings, related Arrow tables, typed attributes, streaming, timestamps, and the supported scope.

Supported Encodings​

  • Binary protobuf using the OpenTelemetry trace schema
  • OTLP protobuf-JSON, including hexadecimal trace and span identifiers and integer enum values
  • JSON Lines where each non-empty line is one complete OTLP JSON document

Unknown JSON and protobuf fields are ignored for forward compatibility. The generated protobuf schema is based on OpenTelemetry Protocol v1.11.0 and retains its Apache-2.0 license.

Arrow Projection​

The loaders normalize the nested OTLP message into five related Arrow tables. Synthetic resource_id and scope_id values preserve hierarchy without duplicating resource and scope data on every span row.

resources​

ColumnArrow typeNullableDescription
resource_idUint32noLoader-assigned resource key.
schema_urlUtf8yesResource schema URL.
attributes_jsonUtf8noProtobuf-JSON KeyValue[].
dropped_attributes_countUint32noDropped resource attributes.

scopes​

ColumnArrow typeNullableDescription
scope_idUint32noLoader-assigned scope key.
resource_idUint32noOwning resource key.
schema_urlUtf8yesScope schema URL.
name, versionUtf8noInstrumentation scope identity.
attributes_jsonUtf8noProtobuf-JSON KeyValue[].
dropped_attributes_countUint32noDropped scope attributes.

spans​

ColumnArrow typeNullableDescription
trace_idFixedSizeBinary(16)no128-bit trace identifier.
span_idFixedSizeBinary(8)no64-bit span identifier.
parent_span_idFixedSizeBinary(8)yesParent identifier, or null for a root span.
resource_id, scope_idUint32noResource and instrumentation scope keys.
trace_state, name, status_messageUtf8noSpan text fields.
flagsUint32noW3C trace flags and OTLP flag bits.
kind, status_codeInt8noOTLP enum numeric values.
start_time_unix_nano, end_time_unix_nanoUint64noUnix epoch nanoseconds.
attributes_jsonUtf8noProtobuf-JSON KeyValue[].
dropped_attributes_count, dropped_events_count, dropped_links_countUint32noOTLP loss counters.

events​

Events are keyed by trace_id, span_id, and event_index. They retain time_unix_nano, name, attributes_json, and dropped_attributes_count.

Links are keyed by parent_trace_id, parent_span_id, and link_index. Each row retains the linked trace_id, span_id, trace state, flags, attributes, and dropped-attribute count.

Attribute Fidelity​

OTLP AnyValue is a tagged union that can contain strings, booleans, integers, doubles, bytes, arrays, and nested key-value lists. Attribute arrays are stored as protobuf-JSON text instead of a flattened map so type tags, duplicate keys, ordering, and 64-bit integer strings survive a load/write round trip.

Streaming​

Binary parseInBatches incrementally tokenizes repeated top-level ResourceSpans messages. JSON Lines parsing emits each complete line immediately and safely handles UTF-8 code points split across byte chunks. Pretty-printed or compact single-document JSON is accepted, but a multi-line single document must be complete before Arrow batches can be emitted.

Every batch is tagged with table and data. The configured row limit applies independently to each logical table. Resource and scope identifiers remain unique across a JSON Lines stream.

Scope​

The projection covers OTLP trace data, not metrics, logs, profiles, or transport envelopes such as HTTP headers and gRPC framing. Protobuf unknown fields are not retained in Arrow and therefore cannot be recreated by a writer.