Summary
PR #901 (towards #893) records the traces signal locally: every session writes a per-session
~/.infer/telemetry/<session>-traces.jsonl with a session root span, chat <model> spans per
LLM turn, and execute_tool <name> spans per tool call. Nothing in the CLI renders them yet -
the only consumer today is an OTLP collector, which most users don't run.
Add a local span-tree viewer, paired the same way infer stats / /stats are:
infer traces [session-id] - render the span tree of a session (default: the most recent one)
from the local trace file, with durations, so per-run latency questions ("what took 27s in that
run?") are answerable without any collector:
session (standard, success) 42.1s
|-- chat deepseek/deepseek-v4-flash 3.2s
|-- execute_tool Read 9ms
|-- chat deepseek/deepseek-v4-flash 2.8s
`-- execute_tool Bash 27.5s
/traces [session-id] - the same view as a chat shortcut (markdown output), matching the
internal/shortcuts/stats.go pattern.
This is read-only over the existing -traces.jsonl format (one stdouttrace span stub JSON object
per line, already parsed by internal/telemetry/tracer_test.go::readSpans). Once subprocess span
ingestion lands (#904), child-process spans appear in this view automatically as children of
their tool span - no viewer changes needed.
Acceptance Criteria
Summary
PR #901 (towards #893) records the traces signal locally: every session writes a per-session
~/.infer/telemetry/<session>-traces.jsonlwith asessionroot span,chat <model>spans perLLM turn, and
execute_tool <name>spans per tool call. Nothing in the CLI renders them yet -the only consumer today is an OTLP collector, which most users don't run.
Add a local span-tree viewer, paired the same way
infer stats//statsare:infer traces [session-id]- render the span tree of a session (default: the most recent one)from the local trace file, with durations, so per-run latency questions ("what took 27s in that
run?") are answerable without any collector:
/traces [session-id]- the same view as a chat shortcut (markdown output), matching theinternal/shortcuts/stats.gopattern.This is read-only over the existing
-traces.jsonlformat (one stdouttrace span stub JSON objectper line, already parsed by
internal/telemetry/tracer_test.go::readSpans). Once subprocess spaningestion lands (#904), child-process spans appear in this view automatically as children of
their tool span - no viewer changes needed.
Acceptance Criteria
infer traces [session-id]renders the span tree (root -> LLM turns -> tool calls) with per-span durations from the local per-session trace file; with no argument it picks the most recent session.infer traces --list(or equivalent) enumerates sessions that have trace files, so a session id can be found without ls-ing the telemetry dir./traces [session-id]chat shortcut renders the same tree as markdown, mirroring the stats command/shortcut pairing.--format jsonemits the tree as structured output.error.typeare visibly marked.