Repository navigation
Description
Summary
Today a bash command or skill script is one opaque execute_tool Bash span: total duration only.
Make subprocess timing cooperative and open-standard: the CLI propagates context to the
subprocess using the W3C conventions, and the subprocess reports spans back using OTLP - no
proprietary formats, so anything already instrumented with an OTel SDK (or otel-cli) integrates
with zero custom code.
Context in (W3C). When telemetry is enabled, the Bash tool and the skills runner export to
the subprocess environment:
TRACEPARENT/TRACESTATE- W3C Trace Context (00-<trace_id>-<tool_span_id>-01), the
de-facto env-var propagation convention understood by otel-cli and OTel SDK shell integrations.BAGGAGE- W3C Baggage carrying request-scoped context, e.g.
infer.session.id=...,infer.tool.call.id=.... Per the OTel baggage guidance: baggage flows
downstream only, it is a separate store from span attributes (children decide what to stamp),
and it must never carry secrets.
Spans out (OTLP). No bespoke return channel - the child exports spans the same way every
OTel-instrumented tool already does:
- Collector configured (
telemetry.otlp.endpoint/OTEL_EXPORTER_OTLP_ENDPOINT): the CLI
passes the endpoint and headers through to the child environment. Child spans go straight to
the collector and stitch to the CLI's trace viaTRACEPARENTparentage. Zero CLI runtime work. - Local-first (no collector): the CLI runs an ephemeral localhost OTLP/HTTP receiver for the
session and setsOTEL_EXPORTER_OTLP_ENDPOINT=http://127.0.0.1:<port>in the child env.
Received spans are persisted into the per-session local trace store (and forwarded when a
remote is also configured).go.opentelemetry.io/proto/otlpis already a dependency.
Plain shell scripts need no SDK: otel-cli span --name "go test" -- go test ./... reads
TRACEPARENT and speaks OTLP. The /traces viewer (#903) then shows:
execute_tool Bash 27.5s
|-- go build 4.7s
`-- go test ./internal/... 22.4s
Subagent stitching. Subagents run as infer agent subprocesses (Agent tool,
channels-manager). StartSession honors an inherited TRACEPARENT, so a child session's whole
trace nests under the parent's execute_tool Agent span - same convention, no extra protocol.
Non-goals: proprietary span file formats or CLI-specific return channels; capturing argv/xtrace
(secret-leak risk) - reporting granularity is always the subprocess's choice.
Builds on the traces engine from #893 / PR #901; renders via #903.
Acceptance Criteria
- Bash tool and skills runner export
TRACEPARENT/TRACESTATE(W3C Trace Context, current tool span) andBAGGAGE(W3C Baggage: session id, tool call id; no sensitive values) when telemetry is enabled; none are set when disabled. - With an OTLP endpoint configured, the endpoint and headers are passed through to the subprocess environment so child spans stitch in the backend via parentage.
- Without a configured endpoint, an ephemeral localhost OTLP/HTTP receiver accepts child spans and persists them into the per-session local trace store; defensive limits (span count, payload size) and receiver failures never fail the tool.
-
infer agenthonors an inheritedTRACEPARENTso a subagent session span parents under the caller'sexecute_tool Agentspan (one cross-process trace). - The contract is documented with otel-cli and OTel SDK examples;
[DOCS]follow-up filed against inference-gateway/docs.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
[-][FEATURE] Propagate trace context to subprocesses and ingest trace bags[/-][+][FEATURE] W3C trace context and baggage propagation to subprocesses, span ingestion via OTLP[/+]feat(telemetry): add traces and logs to the telemetry package (#901)
feat(telemetry): add infer traces command and /traces shortcut (#908)
feat(telemetry): propagate W3C trace context to subprocesses and inge…
inference-gateway-releaser commentedon Jul 16, 2026
🎉 This issue has been resolved in version 0.147.0 🎉
The release is available on:
Your semantic-release bot 📦🚀