Performance data module
Put trace formats on a common table path.
The traces module reads browser, system, and distributed-tracing formats and projects them into typed Arrow tables. That makes trace data available to the same filtering, analysis, and writer workflows as other columnar data.
A common trace boundary
Different event models. One typed table path.
The input formats keep their own vocabulary. The application can work with named Arrow tables for filtering, analysis, visualization, and writing.
Trace inputs
Application boundary
Arrow trace tables
Named tables preserve the important entities without forcing analysis code to parse every source dialect.
What stays portable
The normalized schema is intentionally explicit: source-specific fields remain available where they matter, while shared operations can target the table boundary.
The trace path
Different trace dialects, predictable tables.
Each source format has its own event model. The module preserves its important entities while normalizing them into named Arrow tables that analysis code can consume consistently.
Browser traces
Chrome Trace Event JSON and Arrow
System traces
Perfetto TrackEvent protobuf tables
Distributed traces
OTLP, Jaeger, and Zipkin projections
Write
Re-encode compatible Arrow tables for supported formats
The @loaders.gl/traces module reads and writes performance trace formats without requiring a
specific visualization framework. Chrome Trace Event JSON can be loaded as validated JSON or
Apache Arrow. Stable Perfetto TrackEvent protobuf data is projected into four typed Arrow tables.
OpenTelemetry OTLP traces in protobuf, protobuf-JSON, or JSON Lines are normalized into five
relational Arrow tables. Jaeger and Zipkin JSON use the same five-table projection for direct
interoperability.
Detailed guide
Trace format and table details
The sections below compare formats, loaders, writers, streaming results, and the normalized Arrow table contracts.
Installation
npm install @loaders.gl/core @loaders.gl/traces apache-arrow
Formats and APIs
| Logo | Format | Loader result | Batched result | Writer input |
|---|---|---|---|---|
| Chrome Trace Event JSON | Validated JSON or one Arrow event table | Arrow event record batches | Arrow event table or record batch | |
![]() | Perfetto protobuf | tracks, slices, processes, and threads Arrow tables | Tagged {table, data} record batches | The same four Arrow tables |
| OpenTelemetry OTLP traces | resources, scopes, spans, events, and links Arrow tables | Tagged {table, data} record batches | The same five Arrow tables | |
| Jaeger JSON traces | The five OTLP-compatible Arrow tables | Tagged {table, data} record batches | The same five Arrow tables | |
| Zipkin v2 JSON traces | The five OTLP-compatible Arrow tables | Tagged {table, data} record batches | The same five Arrow tables |
Choosing a Trace Format
There is no single best trace format. Chrome Trace and Perfetto are timeline-oriented formats for profiling one machine or runtime. OTLP, Jaeger, and Zipkin are span-oriented formats for tracing requests across services.
| Format | Best fit | Advantages | Tradeoffs |
|---|---|---|---|
| Chrome Trace Event JSON | Application, browser, Node.js, and accelerator timeline profiling | Simple JSON; broad profiler and viewer support; flexible duration, instant, counter, async, flow, and metadata events; easy to inspect and generate | Verbose at scale; loosely specified extension fields; source-defined time units; no standard resource, service, trace-ID, or span-link model |
| Perfetto protobuf | High-volume operating-system and application timelines | Compact binary encoding; nanosecond-oriented timestamps; hierarchical tracks; incremental packets and interned data; strong Perfetto tooling | Not human-readable; full format is very broad; clocks may require normalization; this module intentionally supports the stable TrackEvent projection rather than every packet family |
| OpenTelemetry OTLP | New vendor-neutral distributed tracing pipelines and archival interchange | Standard resource, scope, span, event, link, status, typed-attribute, and nanosecond models; efficient protobuf plus debuggable JSON; strongest cross-vendor semantics | More structured and complex than Zipkin or Jaeger JSON; not a native CPU/GPU scheduling timeline; protobuf is not directly readable |
| Jaeger JSON | Existing Jaeger Query API, archive, and migration workflows | Human-readable; explicit process descriptors, typed scalar tags, logs, and references; straightforward compatibility with Jaeger deployments | Microsecond precision; legacy model has fewer semantics than OTLP; arrays, maps, scope metadata, status detail, and some links cannot round-trip losslessly |
| Zipkin v2 JSON | Lightweight Zipkin HTTP API integrations and legacy interoperability | Small conceptual model; easy JSON; familiar client/server endpoints, annotations, and tags; simple to produce | Microsecond precision; string-only tags; no native instrumentation scopes, typed attributes, span links, or OTLP-style loss counters |
Recommendations
- Use OTLP protobuf as the default for new distributed tracing systems. Choose OTLP JSON when human inspection matters more than payload size, and JSON Lines when traces must be emitted or processed incrementally.
- Use Perfetto for compact, high-volume system or application timelines that will be analyzed with Perfetto-compatible tooling. Use Trace Processor instead of this module when analysis depends on ftrace, heap profiles, SQL metrics, or cross-clock normalization.
- Use Chrome Trace when producers and consumers already use the Trace Event ecosystem, or when a transparent JSON timeline is more valuable than compact storage. It is usually the easiest format for custom profiler instrumentation.
- Use Jaeger JSON or Zipkin JSON primarily at compatibility boundaries. They are appropriate when integrating with their native APIs, but OTLP retains more information as a long-term canonical representation.
- Do not convert a system timeline to a distributed-span format merely for uniformity. Tracks, counters, flows, scheduler events, and clock-domain information do not map cleanly to spans.
- Expect conversions from OTLP to Jaeger or Zipkin to be lossy. Review each writer's fidelity section before using a converted file for archival or compliance purposes.
Quick Decisions
| Requirement | Recommended format |
|---|---|
| Vendor-neutral service tracing | OTLP protobuf |
| Readable service-trace exchange | OTLP JSON |
| Incremental service-trace JSON | OTLP JSON Lines |
| Compact system timeline | Perfetto protobuf |
| Custom profiler JSON or browser tooling | Chrome Trace Event JSON |
| Existing Jaeger API or archive | Jaeger JSON |
| Existing Zipkin v2 API | Zipkin v2 JSON |
| API | Purpose |
|---|---|
ChromeTraceLoader | Load Chrome Trace JSON as JSON or Arrow. |
ChromeTraceWriter | Reconstruct Chrome Trace JSON from Arrow events. |
PerfettoTraceLoader | Load stable Perfetto TrackEvent data as Arrow. |
PerfettoTraceWriter | Encode the package's Perfetto Arrow projection as protobuf. |
OtlpTraceLoader and OtlpTraceJsonLoader | Load OTLP protobuf, protobuf-JSON, or JSON Lines as Arrow. |
OtlpTraceWriter and OtlpTraceJsonWriter | Encode the OTLP Arrow projection as protobuf or protobuf-JSON. |
JaegerTraceLoader | Load Jaeger Query API, archive, span-array, or JSON Lines data as Arrow. |
JaegerTraceWriter | Encode the shared OTLP Arrow projection as Jaeger JSON. |
ZipkinTraceLoader | Load Zipkin v2 span arrays, trace lists, or JSON Lines as Arrow. |
ZipkinTraceWriter | Encode the shared OTLP Arrow projection as Zipkin v2 JSON. |
| Chrome trace streaming | Adapt event, Arrow, or JSON chunk streams into live trace snapshots. |
Quick Start
import {load, encode} from '@loaders.gl/core';
import {ChromeTraceLoader} from '@loaders.gl/traces/chrome-trace';
import {ChromeTraceWriter} from '@loaders.gl/traces/chrome-trace/bundled';
import {JaegerTraceLoader} from '@loaders.gl/traces/jaeger';
import {JaegerTraceWriter} from '@loaders.gl/traces/jaeger/bundled';
import {OtlpTraceJsonLoader, OtlpTraceLoader} from '@loaders.gl/traces/otlp';
import {OtlpTraceWriter} from '@loaders.gl/traces/otlp/bundled';
import {PerfettoTraceLoader} from '@loaders.gl/traces/perfetto';
import {PerfettoTraceWriter} from '@loaders.gl/traces/perfetto/bundled';
import {ZipkinTraceLoader} from '@loaders.gl/traces/zipkin';
import {ZipkinTraceWriter} from '@loaders.gl/traces/zipkin/bundled';
const chromeEvents = await load('trace.json', ChromeTraceLoader, {
chromeTrace: {shape: 'arrow'}
});
const chromeJson = await encode(chromeEvents, ChromeTraceWriter);
const perfettoTables = await load('trace.perfetto-trace', PerfettoTraceLoader);
const perfettoProtobuf = await encode(perfettoTables, PerfettoTraceWriter);
const otlpTables = await load('traces.otlp', OtlpTraceLoader);
const otlpProtobuf = await encode(otlpTables, OtlpTraceWriter);
const otlpJsonTables = await load('traces.otlp.json', OtlpTraceJsonLoader);
const jaegerTables = await load('trace.jaeger.json', JaegerTraceLoader);
const jaegerJson = await encode(jaegerTables, JaegerTraceWriter);
const zipkinTables = await load('trace.zipkin.json', ZipkinTraceLoader);
const zipkinJson = await encode(zipkinTables, ZipkinTraceWriter);
Bundle Splitting
The format subpaths export metadata loaders. Async core APIs call each loader's preload()
method and dynamically import its parser-bearing implementation. This keeps parser code out of the
initial bundle until parsing starts.
Applications that need parser-bearing loader objects directly can import the implementation subpaths:
import {ChromeTraceLoaderWithParser} from '@loaders.gl/traces/chrome-trace/bundled';
import {PerfettoTraceLoaderWithParser} from '@loaders.gl/traces/perfetto/bundled';
import {OtlpTraceLoaderWithParser} from '@loaders.gl/traces/otlp/bundled';
import {OtlpTraceJsonLoaderWithParser} from '@loaders.gl/traces/otlp/bundled';
import {JaegerTraceLoaderWithParser} from '@loaders.gl/traces/jaeger/bundled';
import {ZipkinTraceLoaderWithParser} from '@loaders.gl/traces/zipkin/bundled';
Writers and shared public types remain available from @loaders.gl/traces.
Choosing an API
- Use
loadorparsewhen the complete Arrow result is required before processing starts. - Use
parseInBatcheswhen input arrives incrementally or when downstream work can consume Arrow batches. - Use the Chrome streaming helpers when a live consumer expects
TraceStreamChunksnapshots rather than Arrow batches. - Use
parseChromeTrace(...)when an application needs semantic Chrome processes, threads, spans, counters, flows, and instants instead of raw event rows.
Worker parsing
All six trace loaders support browser workers for atomic parsing and parseInBatches:
ChromeTraceLoader, PerfettoTraceLoader, OtlpTraceLoader, OtlpTraceJsonLoader,
JaegerTraceLoader, and ZipkinTraceLoader. They share the published trace-worker.js bundle.
Workers transfer owned Arrow column buffers through the existing Arrow column utilities, without IPC encoding. Atomic results retain their Arrow table or logical-table collection shape. Streaming results retain real Arrow record batches and their logical-table tags, including bigint timestamps, schemas, and metadata. Each parser keeps its state for the entire stream; a format that collects a JSON document still needs that complete document before emitting batches.
import {parseInBatches} from '@loaders.gl/core';
import {OtlpTraceJsonLoader} from '@loaders.gl/traces/otlp';
const batches = await parseInBatches(response, OtlpTraceJsonLoader, {
core: {worker: true},
otlpTrace: {batchSize: 1000}
});
for await (const {table, data} of batches) {
consume(table, data);
}
Chrome trace whole-file shape: 'json' converts hydrated Arrow events into the validated
JSON container on the caller, preserving passthrough event and container fields. Chrome
trace batches continue to require shape: 'arrow'. Use an abort signal or close the
iterator to release the worker. Input buffers already transferred remain detached.
Sources and credits
See the package source and license inventory and the project-wide Attributions and Credits.
Package exports
All exported subpaths (19)
These are the package's public exports, including format entry points, parsers, writers, sources, and worker assets.
