Skip to content

[DOCS] Document infer traces command and /traces shortcut #390

Closed

Description

@edenreich

Summary

inference-gateway/cli#908 (closes inference-gateway/cli#903) adds a local span-tree viewer for the traces recorded by inference-gateway/cli#901: a new infer traces command and a /traces chat shortcut. Both are undocumented.

User-facing behavior to document:

  • infer traces [session-id] - renders the span tree of a session (session root -> LLM turns -> tool calls) with per-span durations, read from the local per-session trace file under ~/.infer/telemetry/<session>-traces.jsonl. With no argument it picks the most recent session.
  • infer traces --list - enumerates sessions that have trace files.
  • infer traces --format json - emits the tree as structured output (span names, start times, durations in fractional milliseconds, attributes, children).
  • /traces [session-id] - the same view as a chat shortcut, mirroring the infer stats / /stats pairing.
  • Spans with error status or an error.type attribute are marked with [error: <type>].
  • Works fully offline from local files; no OTLP collector required; requires telemetry.enabled: true for traces to be recorded in the first place.

Example output:

session (standard, success)                38.8s
|-- chat ollama_cloud/deepseek-v4-flash     3.4s
|-- execute_tool Read                      162us
`-- chat ollama_cloud/deepseek-v4-flash     8.1s

Affected pages:

  • CLI command reference: add infer traces alongside infer stats.
  • Chat shortcuts page: add /traces alongside /stats.
  • Telemetry/observability page (if present): mention the local trace files and the viewer.

Source: inference-gateway/cli#908, inference-gateway/cli#903.

Acceptance Criteria

  • infer traces (including --list and --format json) is documented in the CLI command reference with an example span tree.
  • /traces is documented on the chat shortcuts page.
  • The telemetry docs mention that traces are recorded locally per session and can be viewed offline with infer traces.

Activity

  1. added
    documentation
    on Jul 13, 2026
  2. added theissue type on Jul 13, 2026
  3. moved this to Todo in 2026on Jul 13, 2026
  4. edenreich commented on Jul 14, 2026

    @edenreich
    ContributorAuthor

    @claude Can you work on this?

  5. inference-gateway-maintainer commented on Jul 14, 2026

    @inference-gateway-maintainer
    Contributor

    Claude finished @edenreich's task in 14m 33s —— View job • docs/issue-390-20260714-1140 • [Create PR ➔](https://github.com/inference-gateway/docs/compare/main...docs/issue-390-20260714-1140?quick_pull=1&title=Issue%20%23390%3A%20Changes%20from%20Claude&body=This%20PR%20addresses%20issue%20%23390%0A%0AGenerated%20with%20%5BClaude%20Code%5D(https%3A%2F%2Fclaude.ai%2Fcode)


    Documenting infer traces command and /traces shortcut

    Done. Opened PR #393 documenting the infer traces command and the /traces chat shortcut.

    • Gather context: find where infer stats / /stats / telemetry are documented
    • Add infer traces (--list, --format json) to CLI command reference with example span tree
    • Add /traces to the chat shortcuts (Built-in Shortcuts) section
    • Add local trace file / offline viewer note to telemetry/observability docs
    • Run lint + format checks (format:check, lint:md, build all pass)
    • Commit and open PR

    What changed

    cli.md

    • Added infer stats and infer traces rows to the Core Commands table.
    • New Viewing traces section under Telemetry: infer traces [session-id], --list, --format json, the indented span-tree example, the JSON output shape (span name, start time, duration in fractional ms, attributes, children), and the [error: ...] marker for failed spans - all read offline from the local trace file, no OTLP collector required.
    • Added /stats and /traces to the Built-in Shortcuts table plus a new Telemetry Shortcuts section.

    observability.md

    • The CLI Telemetry section now states traces are recorded locally per session and can be rendered offline with infer traces, with the span-tree example and --list / --format json note.

    All three acceptance criteria are covered.

    Notes for the reviewer

    • infer stats / /stats were referenced in the docs but missing from the command and shortcut tables, so I added them alongside traces for coherence (matching the pairing described in the issue).
    • Reconciliation needed: the issue says traces require telemetry.enabled: true, but cli.md currently documents CLI telemetry as "always on - there is no opt-out switch." I kept the new content consistent with that committed wording. If the CLI now gates trace recording behind a config flag, the Telemetry section's "always on" statement should be updated too. Flagged in the PR body.
    • The escaped \<session-id\> path placeholders match the existing committed convention in the same Telemetry section (they render identically to the untouched -logs.jsonl / .jsonl rows).
    • branch: docs/issue-390-20260714-1140
  6. moved this from Todo to In progress in 2026on Jul 14, 2026
  7. moved this from In progress to QA in 2026on Jul 14, 2026
  8. moved this from QA to Done in 2026on Jul 14, 2026
  9. inference-gateway-releaser commented on Jul 18, 2026

    @inference-gateway-releaser
    Contributor

    🎉 This issue has been resolved in version 0.9.2 🎉

    The release is available on GitHub release

    Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationreleased

    Type

    Projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions