Skip to main content
ci.trace() returns the current session’s scope tree without leaving the Python process. It is the on-demand companion to the continuous output= sinks: a notebook user can call it after a training cell to see the tree inline; a script can call it mid-run to inspect what has happened so far. The data source is a process-wide in-memory buffer that the flush thread populates each tick. ci.trace() performs a best-effort synchronous drain into the buffer before reading, so spans closed between the last tick and the call are visible immediately.

Signature

Parameters

Formats

format="df" raises CirronDependencyError when pandas is not installed, with a pip install hint.

Examples

Render in a Jupyter cell

The Jupyter detection probes IPython.get_ipython() and only treats the ZMQ kernel as a notebook. A plain ipython REPL still prints.

Custom analysis with a DataFrame

Filter to a single scope name

Recent spans only

Behavior with no profiler attached

ci.trace() works without a prior ci.profile() call. In that mode it drains the in-memory buffer directly and never writes a spool file as a side effect, so it is safe on read-only filesystems and in notebook inspection contexts.
When a profiler is active, the synchronous drain routes through ci.flush() so the user’s configured output= sinks still fire (an output="spool" run continues to land batches on disk).

Buffer bounds

The in-memory buffer is bounded:
  • Spans: keeps the most recent trace_buffer_max_spans (default 100_000).
  • Marks per span: keeps every kind="summary" mark and the most recent 1024 kind="point" marks. This bound matters for long-lived open spans like cirron.session whose span_id never appears in the span eviction list.
Tune via Cirron:

output= sinks

Continuous spool / log / stdout streaming as scopes close.

Lifecycle

flush, health, shutdown.