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

OptionDescriptionDefault
--spool <dir>Override the spool directory./.cirron/spool
--jsonEmit machine-readable JSON (view, list, snapshots)
--no-colorDisable ANSI color (view, snapshot)TTY-aware; honors NO_COLOR

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.
OptionDescription
--last <n>Show the N newest sessions (default: 1)
--name <substr>Keep only spans whose name contains the substring (ancestors preserved)
--session <id>Show a specific session. Prefix match allowed
--depth <n>Collapse the tree below depth N (shows aggregate duration and span count)
--min-wall <dur>Hide spans shorter than the given duration (ns, us/µs, ms, s, m, h)

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.).
OptionDescription
--format <fmt>Required. One of parquet, otel (alias: otlp), csv, json
--output <path>Output path. Parquet → directory; other formats → file. Defaults to ./cirron-traces[.ext]
--session <id>Export a single session (prefix match allowed). Default: all sessions

--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.
OptionDescription
--before <iso-date>Only sessions with start_ns before this ISO-8601 date are eligible
--keep <n>Retain the N most recent non-live sessions
--yesSkip the confirmation prompt
--no-prune-orphansDon’t sweep snapshot directories whose span id isn’t referenced by any surviving session
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.
OptionDescription
--file <path>Read a specific safetensors file instead of auto-selecting weights.safetensors and gradients.safetensors under the span directory
--preview <n>Print first N values of the selected tensor (requires a tensor argument)
--tail <n>Print last N values
--export <path>With tensor: write a single-tensor safetensors file. Without tensor: copy whole-span blobs
--jsonMachine-readable output
--no-colorDisable ANSI color

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

ErrorResolution
No traces foundCall ci.profile() in your Python script before the work you want to trace, or point --spool at the right directory
No session found matching <prefix>Use cirron traces list for valid ids; prefix matching is substring-prefix, not fuzzy
Tensor "<name>" not foundRun cirron traces snapshot <span> without a tensor name to list all tensors; copy names verbatim (layer1.0.conv1.weight)
Destination is a single file but N blobs were foundPoint --export at a directory, or use --file <path> to pick one blob
Invalid --before dateUse ISO-8601: 2026-04-20, 2026-04-20T12:00:00Z
Ctrl-C during clearReports how many files/dirs were deleted before interruption; exit code 130
  • 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.