Skip to main content

cirron traces

Read and export the local trace data the Cirron Python SDK produces when ci.profile() runs. Where cirron spool gives you a file-level view of the raw batch JSON on disk, cirron traces gives you a semantic view: reconstructs the scope tree across batches, groups records into sessions, renders flamegraphs, and exports to Parquet, OpenTelemetry, CSV, or JSON. Everything runs entirely against the local spool (./.cirron/spool/) and snapshot directory (./.cirron/snapshots/<span_id>/). No network, no platform authentication. Your traces are yours, in open formats, on your disk.

Subcommands

Usage

Global Options

Vocabulary

  • Session: One ci.profile() lifetime, rooted at a cirron.session span. Typically one per training run.
  • Span: A timed scope (epoch, step, forward pass, optimizer step). Spans nest via parent_id.
  • Mark: A named scalar (ci.mark("loss", 0.5)) attached to the innermost open span.
  • Snapshot: Per-tensor weight or gradient record at an epoch boundary. Stats live inline; sampled/full modes also store safetensors blobs under ./.cirron/snapshots/<span_id>/.
Sessions reconstruct by deduplicating spans across batches (preferring records with end_ns) and walking parent pointers from every cirron.session root. Unknown top-level and per-span fields are ignored. A newer SDK can add metadata without breaking an older CLI.

View the scope tree

Render one or more sessions as an indented text flamegraph.

Example output

Marks render as indented ci.mark <name>=<value> lines under the span they attach to. point marks render as-is; summary marks carry a (summary) suffix. With --depth 1, subtrees collapse to … 33.6ms (4 spans, collapsed) aggregates. The collapsed duration sums descendants only, so it’s always ≤ the parent’s wall time.

List sessions

Table of every session in the spool, newest first.
Live sessions (root cirron.session without end_ns) show (live) and are protected from destructive clear --keep operations.

Export traces

Convert local traces into an open format for DuckDB, pandas, Polars, or any OpenTelemetry backend (Jaeger, Tempo, Honeycomb, etc.).

--format parquet

Writes three files into the output directory: spans.parquet (one row per span; columns mirror the platform TraceSpan model), marks.parquet (one row per mark), snapshots.parquet (stats inline; blobs remain on disk). All *_ns columns are INT64.
Parquet writing uses @dsnp/parquetjs (pure JavaScript) so the CLI’s pkg-built binaries work without native modules.

--format otel

Emits a single OTLP/JSON file. If a tool speaks OTLP, it can read this file. No Cirron-specific reader required. Works with Jaeger, Grafana Tempo, SigNoz, Uptrace, ClickStack, Honeycomb, Datadog, New Relic, Dynatrace, Splunk Observability, Lightstep, Elastic APM, Axiom, Azure Monitor, Google Cloud Trace, AWS X-Ray (via OTEL collector), otelcol, Grafana Alloy/Agent, Vector, and any OTLP/HTTP /v1/traces endpoint:
For backends requiring OTLP/gRPC, run the JSON through the OpenTelemetry Collector to transparently convert formats. Encoding details: each session becomes one resourceSpans[] with service.name=cirron, sdk.version, and cirron.session.id. traceId (32 hex) is derived from the session id; spanId/parentSpanId (16 hex each) from Cirron span ids, derived, not just truncated, so non-hex ids stay spec-valid. startTimeUnixNano/endTimeUnixNano are string-encoded int64 per the OTLP spec. Attributes wrap as AnyValue with correct scalar promotion. Marks attach to their owning span as events[]. Status.code defaults UNSET (0); becomes ERROR (2) if the span has an error attribute. OK is never set proactively (the profiler has no success/failure model).

--format csv

Flat, spans-only CSV streamed to disk (bounded memory). Columns:
Marks and snapshots are not in CSV. Use Parquet or JSON for full fidelity.

--format json

Merged, deduplicated JSON in the same shape as a single spool batch:
Dedupe is by id across spans, marks, and snapshots, safe to diff or re-import.

Clear sessions

Delete sessions (batch files plus snapshot directories) with a confirmation prompt by default.
Deletes batch JSONs for eligible sessions, their ./.cirron/snapshots/<span_id>/ directories, and by default any orphan snapshot directories. Live sessions are never deleted by --keep; --before deletes them only if their start timestamp is already in the past cutoff. Confirmation prompt:
Compare with cirron spool clear (file-level, deletes batch JSON only). Prefer traces clear for user-facing cleanup.

List snapshots

Weight/gradient snapshots grouped by the span that produced them.
  • TENSORS: number of snapshot records (one per parameter and per .grad if gradients were captured).
  • MODES: stats (inline only), sampled (stats + blob for some epochs), full (blob every epoch).
  • WITH BLOB: records carrying a blob_uri.

Inspect a snapshot

Deep-dive view: combines inline stats with the safetensors file header on disk, renders an ASCII histogram of tensor values, and optionally previews or exports raw tensor data.

Example: span summary

Example: focused tensor view

The histogram uses Unicode block characters (▁▂▃▄▅▆▇█) scaled to the max bucket count.

Supported dtypes

Every standard safetensors dtype: F64, F32, F16, BF16, I64, I32, I16, I8, U64, U32, U16, U8, BOOL. --preview upcasts F16/BF16 to float32 for display; integer types print exact values (64-bit ints as BigInt).

Export rules

With a tensor name: writes a fresh single-tensor safetensors file containing only the requested tensor. If <path> is an existing directory, the file is written as <tensor_name>.safetensors inside it (non-filename characters replaced with _). Without a tensor name: copies the candidate safetensors blob(s) to the destination. File vs directory is auto-detected:
  • If the path exists on disk, we use what’s there (dir → dir, file → file).
  • If the path ends in .safetensors, it’s treated as a file.
  • If there’s exactly one blob and the path has no extension, it’s treated as a file.
  • Otherwise the path is treated as a directory.
Mismatches (e.g. pointing at a file path but two blobs exist) produce an error directing you to --file to narrow the selection.

Examples

Troubleshooting

  • cirron spool: File-level view; required for spool flush to upload batches to the platform.
  • cirron auth: Authenticate before spool flush (not needed for any traces subcommand).
  • cirron status: Check CLI + platform connectivity.