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
Print the tree in a script
Render in a Jupyter cell
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.
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(default100_000). - Marks per span: keeps every
kind="summary"mark and the most recent1024kind="point"marks. This bound matters for long-lived open spans likecirron.sessionwhosespan_idnever appears in the span eviction list.
Cirron:
Related
output= sinks
Continuous spool / log / stdout streaming as scopes close.
Lifecycle
flush, health, shutdown.