Skip to main content

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.

Application boundary

Arrow trace tables

Named tables preserve the important entities without forcing analysis code to parse every source dialect.

timestampdurationnametraceIdspanIdattributes

What stays portable

Filter and scancolumns, predicates, and limits
Build a timelineslices, spans, processes, and threads
Write or exchangeArrow tables and record batches

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​

LogoFormatLoader resultBatched resultWriter input
Chrome Trace Event JSONValidated JSON or one Arrow event tableArrow event record batchesArrow event table or record batch
Perfetto protobuftracks, slices, processes, and threads Arrow tablesTagged {table, data} record batchesThe same four Arrow tables
OpenTelemetry OTLP tracesresources, scopes, spans, events, and links Arrow tablesTagged {table, data} record batchesThe same five Arrow tables
Jaeger JSON tracesThe five OTLP-compatible Arrow tablesTagged {table, data} record batchesThe same five Arrow tables
Zipkin v2 JSON tracesThe five OTLP-compatible Arrow tablesTagged {table, data} record batchesThe 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.

FormatBest fitAdvantagesTradeoffs
Chrome Trace Event JSONApplication, browser, Node.js, and accelerator timeline profilingSimple JSON; broad profiler and viewer support; flexible duration, instant, counter, async, flow, and metadata events; easy to inspect and generateVerbose at scale; loosely specified extension fields; source-defined time units; no standard resource, service, trace-ID, or span-link model
Perfetto protobufHigh-volume operating-system and application timelinesCompact binary encoding; nanosecond-oriented timestamps; hierarchical tracks; incremental packets and interned data; strong Perfetto toolingNot 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 OTLPNew vendor-neutral distributed tracing pipelines and archival interchangeStandard resource, scope, span, event, link, status, typed-attribute, and nanosecond models; efficient protobuf plus debuggable JSON; strongest cross-vendor semanticsMore structured and complex than Zipkin or Jaeger JSON; not a native CPU/GPU scheduling timeline; protobuf is not directly readable
Jaeger JSONExisting Jaeger Query API, archive, and migration workflowsHuman-readable; explicit process descriptors, typed scalar tags, logs, and references; straightforward compatibility with Jaeger deploymentsMicrosecond precision; legacy model has fewer semantics than OTLP; arrays, maps, scope metadata, status detail, and some links cannot round-trip losslessly
Zipkin v2 JSONLightweight Zipkin HTTP API integrations and legacy interoperabilitySmall conceptual model; easy JSON; familiar client/server endpoints, annotations, and tags; simple to produceMicrosecond 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​

RequirementRecommended format
Vendor-neutral service tracingOTLP protobuf
Readable service-trace exchangeOTLP JSON
Incremental service-trace JSONOTLP JSON Lines
Compact system timelinePerfetto protobuf
Custom profiler JSON or browser toolingChrome Trace Event JSON
Existing Jaeger API or archiveJaeger JSON
Existing Zipkin v2 APIZipkin v2 JSON
APIPurpose
ChromeTraceLoaderLoad Chrome Trace JSON as JSON or Arrow.
ChromeTraceWriterReconstruct Chrome Trace JSON from Arrow events.
PerfettoTraceLoaderLoad stable Perfetto TrackEvent data as Arrow.
PerfettoTraceWriterEncode the package's Perfetto Arrow projection as protobuf.
OtlpTraceLoader and OtlpTraceJsonLoaderLoad OTLP protobuf, protobuf-JSON, or JSON Lines as Arrow.
OtlpTraceWriter and OtlpTraceJsonWriterEncode the OTLP Arrow projection as protobuf or protobuf-JSON.
JaegerTraceLoaderLoad Jaeger Query API, archive, span-array, or JSON Lines data as Arrow.
JaegerTraceWriterEncode the shared OTLP Arrow projection as Jaeger JSON.
ZipkinTraceLoaderLoad Zipkin v2 span arrays, trace lists, or JSON Lines as Arrow.
ZipkinTraceWriterEncode the shared OTLP Arrow projection as Zipkin v2 JSON.
Chrome trace streamingAdapt 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 load or parse when the complete Arrow result is required before processing starts.
  • Use parseInBatches when input arrives incrementally or when downstream work can consume Arrow batches.
  • Use the Chrome streaming helpers when a live consumer expects TraceStreamChunk snapshots 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.

FormatImport subpath
@loaders.gl/traces/chrome-trace
@loaders.gl/traces/chrome-trace-loader
@loaders.gl/traces/chrome-trace/api
@loaders.gl/traces/chrome-trace/bundled
@loaders.gl/traces/jaeger
@loaders.gl/traces/jaeger-trace-loader
@loaders.gl/traces/jaeger/bundled
@loaders.gl/traces/otlp
@loaders.gl/traces/otlp-trace-json-loader
@loaders.gl/traces/otlp-trace-loader
@loaders.gl/traces/otlp/bundled
@loaders.gl/traces/perfetto
@loaders.gl/traces/perfetto-trace-loader
@loaders.gl/traces/perfetto/bundled
@loaders.gl/traces/stream
@loaders.gl/traces/trace-worker.js
@loaders.gl/traces/zipkin
@loaders.gl/traces/zipkin-trace-loader
@loaders.gl/traces/zipkin/bundled