Repository navigation
feat(otel): OpenTelemetry for a2a-* + shared mock-ollama cookout - #52
Merged
Merged
Conversation
Add optional peer @opentelemetry/api and core hooks so createA2AServer wraps executors with a2a.task.* spans. Hosts register TracerProvider / OTLP exporters; without them instrumentation is a no-op. Align factory A2AExecutor with executor/types so instrumentExecutor typechecks. Ship OSS docs/observability.md (not research notes). Co-authored-by: Shashi Kanth G S <shashikanth-gs@users.noreply.github.com>
Hook E applies task usage to a2a.task.execute as a2a.task.usage.* always, and gen_ai.usage.* only when backend OTel is off — so Copilot/Claude/Codex LLM spans do not double-count with the parent in Tempo SUMs. Also adds createExecutionObservability (Hook B), session span attrs, injectW3cTraceHeaders, wires Copilot/Antigravity, migrates all wrappers, and documents the anti-dupe rules. Co-authored-by: Shashi Kanth G S <shashikanth-gs@users.noreply.github.com>
Default model is ~99% one a2a.task.execute per inbound request — not a multi-span factory. When the orchestrator calls again (resume/retry), still one new span with the same conversation/task ids plus a2a.task.invocation(_kind) and a2a.message.id for platform joins. Co-authored-by: Shashi Kanth G S <shashikanth-gs@users.noreply.github.com>
Wire Copilot telemetry + onGetTraceContext, Claude subprocess OTel/TRACEPARENT, and Codex otel configOverrides via core helpers. Activate real OTel context in withSpan so parent-link works. Document OpenCode/Antigravity limits. Co-authored-by: Shashi Kanth G S <shashikanth-gs@users.noreply.github.com>
createCli dynamically bootstraps NodeSDK when otel.exporter.endpoint is set (optional peers). Continue/retry invocations get span links. Ship examples/otel-stack (Jaeger OTLP) and fix withSpan not to re-run on errors. Co-authored-by: Shashi Kanth G S <shashikanth-gs@users.noreply.github.com>
Document who owns which attrs vs draft GenAI A2A #254. Stamp gen_ai.operation.name, session.id, a2a.method.name, and a2a.gateway.* from orchestrator metadata. Claude/Codex now apply per-request usage rollups. Co-authored-by: Shashi Kanth G S <shashikanth-gs@users.noreply.github.com>
Drop the Jaeger-required compose stack for a lightweight Arize Phoenix demo (pip/uv; optional Docker). CLI bootstrap defaults to OTLP protobuf (`exporter-trace-otlp-proto`) so Phoenix ingest works. Stamp a2a.wrapper.core.version plus a2a.wrapper.sdk / .sdk.version on task spans and wire every wrapper server with its package identity. Add otel.taskUsageRollup (default on) and otel.annotateUsageCalls (default off; Claude/Codex call applyUsageCallToActiveSpan). Verified live against phoenix serve in this environment. Co-authored-by: Shashi Kanth G S <shashikanth-gs@users.noreply.github.com>
Add examples/otel-stack/smoke-providers.mjs that drives a2a-copilot and a2a-claude executors under instrumentExecutor against a live Phoenix collector. Backends are faked (this environment has no Copilot policy access / Claude login); wrapper spans still show sdk identity + usage. Co-authored-by: Shashi Kanth G S <shashikanth-gs@users.noreply.github.com>
Co-authored-by: Shashi Kanth G S <shashikanth-gs@users.noreply.github.com>
Add a fake Ollama (OpenAI Responses + Anthropic Messages) and cookout-byok that boots real a2a-copilot / a2a-claude CLIs against it into Phoenix — no cloud keys or GPU. Wire bootstrapOtelSdkFromConfig into all hand-rolled wrapper CLIs (they were skipping SDK start) and use SimpleSpanProcessor for reliable short-lived export. Co-authored-by: Shashi Kanth G S <shashikanth-gs@users.noreply.github.com>
Move the fake Ollama stub out of otel-stack into examples/mock-ollama so any feature can cook out against real a2a-copilot / a2a-claude without cloud keys. OTel cookout now layers Phoenix config on those shared agents. Co-authored-by: Shashi Kanth G S <shashikanth-gs@users.noreply.github.com>
3 tasks done
Common settings stay on otel.*; Hook F knobs are only otel.backend.<this package>. OpenCode schema no longer lists Codex/Claude/Copilot backends (and peers). Regenerated agent-config.schema.json for all wrappers. Co-authored-by: Shashi Kanth G S <shashikanth-gs@users.noreply.github.com>
shashikanth-gs
marked this pull request as ready for review
October 15, 2026 23:20
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.
What and why
Introduces optional OpenTelemetry (OTel) tracing across
@a2a-wrapper/coreand all fivea2a-*wrappers (a2a-claude,a2a-codex,a2a-copilot,a2a-opencode,a2a-antigravity), plus a shared fake Ollama (mock-ollama) for local zero-cloud-key verification and Phoenix cookouts.Key Capabilities
a2a.task.executespans per inbound A2A request, tagginggen_ai.conversation.id,gen_ai.agent.name,gen_ai.agent.id,session.id,a2a.task.id, anda2a.message.id.gen_ai.usage.*on parent spans to avoid double counting vendor LLM spans, emittinga2a.task.usage.*rollups instead. If backend OTel is off, the wrapper promotes rollups togen_ai.usage.*(including input, output, cache, and reasoning tokens).traceparent/tracestateinto:CLAUDE_CODE_ENABLE_TELEMETRY=1,TRACEPARENT,TRACESTATE)onGetTraceContextconfigOverrides.otela2a.task.prior_invocation) instead of creating artificial infinite parent spans.@opentelemetry/sdk-nodeand OTLP exporters whenotel.enabledis configured; keeps core lightweight with zero hard dependencies on OTel SDK.mock-ollamaCookout: Reusable LLM stub underexamples/mock-ollamaproviding OpenAI Responses API and Anthropic Messages API endpoints for local OTel testing without external keys or GPUs.Packages touched
@a2a-wrapper/corea2a-claude/a2a-codex/a2a-copilot/a2a-opencode/a2a-antigravityChecklist
npm run build && npm testpassnpm run changeset) if a published package changed