Repository navigation
feat(telemetry): propagate W3C trace context to subprocesses and ingest child spans via OTLP - #909
Merged
Merged
Conversation
…st child spans via OTLP (#904)
3 tasks
…ransport function The ADK v0.21.0 now supports Config.Transport natively, so callers construct the client inline. Removes the internal/a2a wrapper package entirely and replaces it with a public PropagationTransport(http.RoundTripper) constructor.
3 tasks done
Contributor
Author
|
@infer adk version 0.22.0 just got released, can you create an example for a2a traces? with the mock-agent? the mock-agent is going to be released with the new adk very soon. |
Contributor
|
Model: Todos
Pull Request✅ Infer Result: SuccessEverything is clean and pushed. The work is complete - no further action needed. Model: Tokens: 3,602,442 in · 9,220 out · 3,611,662 total (32 requests) Tool calls: 46 total · 93% success rate
|
Create a focused example demonstrating W3C trace context propagation between the infer CLI and A2A agents via the mock-agent (ADK 0.22.0+). The example shows: - How the CLI injects traceparent/tracestate/baggage headers into A2A HTTP requests - How to enable telemetry on the CLI (INFER_TELEMETRY_ENABLED) - How to view the distributed trace tree with 'infer traces' - Mock-agent OTel export configuration for ADK 0.22.0+
claude Bot
added a commit
to inference-gateway/mock-agent
that referenced
this pull request
Jul 14, 2026
Add examples/opentelemetry/ — a self-contained stack (mock-agent with telemetry enabled + OpenTelemetry Collector + Jaeger) for exercising distributed tracing end-to-end, including the shared-collector scenario with the infer CLI telemetry feature (inference-gateway/cli#909). Telemetry stays off by default (the ADK owns that default); the example enables it via the A2A_TELEMETRY_* env vars and exports OTLP traces to a shared collector so the agent's a2a.request span joins the CLI's trace. - examples/opentelemetry/docker-compose.yaml: agent + collector + jaeger, with opt-in cli/debugger profiles - examples/opentelemetry/otel-collector-config.yaml: OTLP in, Jaeger + debug out - examples/opentelemetry/README.md: how to run it and view traces - README.md: Telemetry & Tracing section linking the example - .adl-ignore: protect hand-authored examples/ from regeneration Refs #51 Co-authored-by: Eden Reich <[email protected]>
edenreich
added a commit
to inference-gateway/mock-agent
that referenced
this pull request
Jul 14, 2026
* feat(telemetry): add OpenTelemetry support via agent.yaml manifest * docs(telemetry): add runnable OpenTelemetry collector example Add examples/opentelemetry/ — a self-contained stack (mock-agent with telemetry enabled + OpenTelemetry Collector + Jaeger) for exercising distributed tracing end-to-end, including the shared-collector scenario with the infer CLI telemetry feature (inference-gateway/cli#909). Telemetry stays off by default (the ADK owns that default); the example enables it via the A2A_TELEMETRY_* env vars and exports OTLP traces to a shared collector so the agent's a2a.request span joins the CLI's trace. - examples/opentelemetry/docker-compose.yaml: agent + collector + jaeger, with opt-in cli/debugger profiles - examples/opentelemetry/otel-collector-config.yaml: OTLP in, Jaeger + debug out - examples/opentelemetry/README.md: how to run it and view traces - README.md: Telemetry & Tracing section linking the example - .adl-ignore: protect hand-authored examples/ from regeneration Refs #51 Co-authored-by: Eden Reich <[email protected]> --------- Co-authored-by: inference-gateway-maintainer[bot] <246577062+inference-gateway-maintainer[bot]@users.noreply.github.com> Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com> Co-authored-by: Eden Reich <[email protected]>
inference-gateway-releaser Bot
added a commit
to inference-gateway/mock-agent
that referenced
this pull request
Jul 14, 2026
## [0.2.0](v0.1.11...v0.2.0) (2026-07-14) ### ✨ Features * **telemetry:** add OpenTelemetry support via agent.yaml manifest ([#55](#55)) ([36db7e8](36db7e8)), references [inference-gateway/cli#909](inference-gateway/cli#909) [#51](#51) ### 🐛 Bug Fixes * **flox:** pin go-task to ^3.48.0 and bump manifest schema to 1.13.0 ([#44](#44)) ([8c5c4ab](8c5c4ab)) ### 👷 CI * **claude:** change effort to max ([cf2aca2](cf2aca2)) * **claude:** remove system prompt - use default community maintained prompt ([0cfbcf7](0cfbcf7)) * **claude:** standardize workflow + task-based branch prefix ([8aee026](8aee026)) * **deps:** bump actions/checkout in the github-actions group ([#35](#35)) ([65b7fd8](65b7fd8)) * **deps:** Bump anthropics/claude-code-action in the github-actions group ([#30](#30)) ([b86d3c5](b86d3c5)) * **deps:** bump anthropics/claude-code-action in the github-actions group ([#32](#32)) ([4805f63](4805f63)) * **deps:** bump github.com/inference-gateway/sdk in the gomod group ([#31](#31)) ([03ccbd5](03ccbd5)) * **deps:** bump github.com/inference-gateway/sdk in the gomod group ([#36](#36)) ([1dbf416](1dbf416)) * **deps:** bump github.com/inference-gateway/sdk in the gomod group ([#37](#37)) ([4580301](4580301)) * **deps:** bump github.com/inference-gateway/sdk in the gomod group ([#50](#50)) ([90899f8](90899f8)) * **deps:** bump github.com/inference-gateway/sdk in the gomod group ([#53](#53)) ([455c984](455c984)) * **deps:** bump github.com/quic-go/quic-go from 0.59.0 to 0.59.1 ([#33](#33)) ([3a80b04](3a80b04)) * **deps:** bump golang.org/x/crypto from 0.51.0 to 0.52.0 ([#43](#43)) ([0fd1504](0fd1504)) * **deps:** bump golang.org/x/net from 0.51.0 to 0.55.0 ([#40](#40)) ([73833a7](73833a7)) * **deps:** bump the github-actions group with 2 updates ([#38](#38)) ([b2c3d2e](b2c3d2e)) * **deps:** bump the github-actions group with 2 updates ([#41](#41)) ([1b23d61](1b23d61)) * **deps:** bump the github-actions group with 6 updates ([#39](#39)) ([c023410](c023410)) * **deps:** bump the gomod group with 3 updates ([#42](#42)) ([c3eb2ef](c3eb2ef)) * **deps:** downgrade task version from 3.51.1 to 3.48.0 in workflows and manifest ([7bd813e](7bd813e)) * **release:** update semantic release and plugins to latest versions with local installation ([d13b918](d13b918)) ### 🔧 Miscellaneous * **deps:** bump ADL CLI to v0.46.0 ([#46](#46)) ([f30c770](f30c770)) * **deps:** bump ADL CLI to v0.46.5 ([#49](#49)) ([ba8e7c8](ba8e7c8)) * **deps:** bump ADL CLI to v0.47.1 ([#54](#54)) ([c61da04](c61da04)) * **deps:** bump ADL CLI v0.39.3 -> v0.40.0 ([#28](#28)) ([db16a9a](db16a9a)) * **deps:** bump ADL CLI v0.40.0 -> v0.43.2 ([#29](#29)) ([dd0fc67](dd0fc67)) * **deps:** bump ADL CLI v0.43.2 -> v0.44.0 ([#34](#34)) ([8d33102](8d33102)) * **deps:** bump ADL CLI v0.46.5 -> v0.47.0 ([#52](#52)) ([3fcf418](3fcf418)) * **deps:** bump docker/setup-qemu-action version v4.0.0 -> v4.1.0 ([0d3999d](0d3999d)) * **deps:** update Go version from 1.26.2 to 1.26.4 ([bde7a3e](bde7a3e)) * **flox:** add missing lock file changes ([86a8440](86a8440)) * **schema:** update adl schema to latest ([a063018](a063018)) * small fix ([56cee02](56cee02))
This was referenced Jul 15, 2026
inference-gateway-maintainer Bot
added a commit
to inference-gateway/docs
that referenced
this pull request
Jul 15, 2026
…eiver_address, a2a-traces example Add documentation for the CLI distributed-tracing surface added in inference-gateway/cli#909: - Document telemetry.receiver_address config key (INFER_TELEMETRY_RECEIVER_ADDRESS) with default loopback-only behavior and fixed-address usage for external collector fan-back - Document the a2a-traces example with push/pull topology, W3C trace context propagation to A2A agents, and collector fan-back to the CLI receiver - Document that ingested foreign spans are labeled name [service] from the producer's service.name resource attribute - Link back to the source PR inference-gateway/cli#909
edenreich
pushed a commit
to inference-gateway/docs
that referenced
this pull request
Jul 15, 2026
…eiver_address, a2a-traces example (#406) Add documentation for the CLI distributed-tracing surface added in inference-gateway/cli#909: - Document telemetry.receiver_address config key (INFER_TELEMETRY_RECEIVER_ADDRESS) with default loopback-only behavior and fixed-address usage for external collector fan-back - Document the a2a-traces example with push/pull topology, W3C trace context propagation to A2A agents, and collector fan-back to the CLI receiver - Document that ingested foreign spans are labeled name [service] from the producer's service.name resource attribute - Link back to the source PR inference-gateway/cli#909 Co-authored-by: inference-gateway-maintainer[bot] <246577062+inference-gateway-maintainer[bot]@users.noreply.github.com>
This was referenced Jul 15, 2026
…k-agent to version 0.3.2
Contributor
|
🎉 This PR is included in version 0.147.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
inference-gateway-releaser Bot
added a commit
to inference-gateway/docs
that referenced
this pull request
Jul 18, 2026
## [0.9.2](0.9.1...0.9.2) (2026-07-18) ### 📚 Documentation * add CLI telemetry documentation for traces, logs, and metrics ([#392](#392)) ([f8bfcdc](f8bfcdc)) * **adk:** align telemetry docs with A2A_TELEMETRY_ENABLE as single trace gate ([#403](#403)) ([fea405f](fea405f)), references [inference-gateway/adk#234](inference-gateway/adk#234) * **adl-cli,adk:** document OTel service.name/service.version from ADL manifest metadata ([#408](#408)) ([be1b66e](be1b66e)) * **adl-cli:** move generated skills to .agents/skills layout ([#421](#421)) ([2e4e925](2e4e925)) * align ADK telemetry config with OpenTelemetry ([#400](#400)) ([aa0a862](aa0a862)) * **cli-channels:** document channels-manager OTLP telemetry setup ([#415](#415)) ([283ddff](283ddff)) * **cli,a2a:** document A2A agent liveness probes ([#425](#425)) ([5844ea9](5844ea9)), closes [#424](#424) * **cli:** document distributed tracing - infer traces, telemetry.receiver_address, a2a-traces example ([#406](#406)) ([4fc24f5](4fc24f5)), references [inference-gateway/cli#909](inference-gateway/cli#909) * document /tasks output panel and agent inherit_mock ([#388](#388)) ([7f3d72b](7f3d72b)) * document built-in skills and tmux skill ([#386](#386)) ([fc013ab](fc013ab)) * document extended spec.telemetry otel exporter fields ([#399](#399)) ([712f6de](712f6de)) * document infer traces command and /traces shortcut ([#393](#393)) ([b938a19](b938a19)) * document infer-action workflow for infer orchestrator ([#396](#396)) ([4e1d792](4e1d792)) * document W3C trace propagation and OTLP span ingestion ([#394](#394)) ([f26494c](f26494c)) * **llamacpp:** add llama.cpp provider documentation ([#417](#417)) ([356f9ac](356f9ac)) * note Go SDK retry cancellation preserves HTTP error ([#382](#382)) ([e39bcab](e39bcab)) * **observability:** document OTEL_METRICS_EXPORTER and Prometheus pull env vars ([#412](#412)) ([b450177](b450177)), closes [#409](#409) * **operator:** add Orchestrator CRD telemetry reference ([#413](#413)) ([8210e06](8210e06)) * **rust-adk:** document A2A_OTEL_TRACES_EXPORTER trace gating ([#407](#407)) ([29c5f67](29c5f67)) * **sdks:** add llamacpp to supported providers list ([#422](#422)) ([ed2a466](ed2a466)) * **sdks:** document python responses api and zai provider ([#423](#423)) ([c5b608e](c5b608e)) ### 🔧 Miscellaneous * **deps-dev:** bump the bun group with 2 updates ([#384](#384)) ([fc813d8](fc813d8)) * **deps:** bump infer CLI v0.141.0 -> v0.147.1 ([#411](#411)) ([03b6342](03b6342)) * **release:** update GitHub App credentials to use RELEASER_APP_ID and RELEASER_APP_PRIVATE_KEY ([4275006](4275006))
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #904.
Today a bash command, skill script, or subagent is one opaque
execute_toolspan with a total duration only. This PR makes subprocess timing cooperative and open-standard: the CLI propagates context out using pure W3C conventions, and children report spans back via standard OTLP. No proprietary formats or env vars are introduced, so anything already instrumented with an OTel SDK (orotel-cli) integrates with zero custom code. Local storage remains the default sink; a remote OTLP collector stays opt-in via the existingtelemetry.otlp.endpointconfig.Context out (W3C). The telemetry tool-span decorator computes
TRACEPARENT/TRACESTATE(from the liveexecute_toolspan, via the standard OTelpropagation.TraceContextpropagator) andBAGGAGE(infer.session.id,infer.tool.call.id— no secrets) once per tool span and carries the result on the context. The Bash tool sets it on the child env (one assignment covers foreground, streaming, and detached — they share the sameexec.Cmd), and headless subagents get it throughsubagentExtraEnv. When telemetry is disabled the decorator is absent, so children get no trace env at all. Skills run through the Bash tool and are covered transitively.Spans in (OTLP). The OTLP sink for children is resolved in
Recorder.ChildEnv: a config-file endpoint is passed through explicitly asOTEL_EXPORTER_OTLP_ENDPOINT/OTEL_EXPORTER_OTLP_HEADERS; an env-configured endpoint is simply inherited; and with no endpoint at all, a lazy ephemeral loopback OTLP/HTTP receiver acceptsPOST /v1/traces(protobuf) and persists each span into the per-session local trace file in the stdouttrace stub shape the/tracesviewer (#903 / #908) reads. Defensive limits: 4 MiB per request, 5000 spans per session, always responds 200 — receiver failures never fail the tool. AlockedWritershared between the stdouttrace exporter and the receiver serializes trace-file writes, eliminating interleaving by construction.Subagent stitching.
StartSessionnow extracts an inheritedTRACEPARENT/TRACESTATEfrom the environment (standard extract; no env means unchanged behavior), so a subagent's session span parents under the caller'sexecute_tool Agentspan — one cross-process trace. Since the parent points the child at its loopback receiver, the child's existing OTLP export path lights up with zero child-side code and its spans land in the parent's session file. Verified end to end against the mock gateway:A2A remote servers. All six adk client construction sites now use
telemetry.NewA2AClient, which wraps the HTTP transport with a RoundTripper injectingtraceparent/tracestate/baggageheaders from the request context. This is context-out only: whether a remote agent records spans and where they go is its business (shared-collector scenario); its spans do not land in our local store.No new config keys and no new go.mod modules:
otel/propagationandotel/baggagelive in the already-requiredgo.opentelemetry.io/otelroot module;go.opentelemetry.io/proto/otlpandgoogle.golang.org/protobufmerely moved from indirect to direct.Known limitations
infer chatREPL without completion semantics.infer statsreads metrics files, which are untouched.Testing
internal/telemetry/propagation_test.go:ChildEnvmatrix (nil recorder, no span, loopback default, config endpoint passthrough, env-endpoint inheritance), baggage members, header injection on traced vs untraced requests.internal/telemetry/receiver_test.go: real OTLP protobuf export ingested and nested under the tool span byLoadTraceTree; garbage payloads and/v1/metricsaccepted and dropped; session span cap enforced.recordertest: inheritedTRACEPARENTbecomes the session span's parent; unset keeps a zero parent.bashtool test: trace env present in the child exactly when the context carries it.go test -raceon the touched packages, and golangci-lint all pass. Manual end-to-end run against the mock gateway shown above.Cross-repo impact
Docs only: follow-up
[DOCS]issue filed against inference-gateway/docs to document the propagation contract with otel-cli and OTel SDK examples. No schema, gateway, or operator changes — all env vars used are standard OTel/W3C ones.