Skip to content

feat(otel): Phases 1–5 + Phoenix BYOK cookout (mock Ollama) - #51

Closed
shashikanth-gs wants to merge 10 commits into
mainfrom
cursor/otel-core-api
Closed

shashikanth-gs wants to merge 10 commits into
mainfrom
cursor/otel-core-api

Conversation

@shashikanth-gs

@shashikanth-gs shashikanth-gs commented Oct 10, 2026 •

Copy link
Copy Markdown
Owner

What and why

Optional OpenTelemetry for a2a-* with a realistic local cookout: fake Ollama BYOK → real Copilot/Claude CLIs → Phoenix. No cloud keys, no GPU, no Jaeger requirement.

Phases

  1. Core bridge (Hook A/D)
  2. Usage + anti-dupe (Hook E)
  3. Backend passthrough (Hook F)
  4. CLI bootstrap + span links
  5. Ownership matrix + gateway IDs
  6. Phoenix demo, package identity, usage flags
  7. BYOK mock-Ollama cookout (this)

Verified in agent env

phoenix serve
node examples/otel-stack/cookout-byok.mjs
Path Mock Ollama Phoenix span
a2a-copilot BYOK (wireApi: responses) POST /v1/responses a2a.wrapper.sdk=a2a-copilot, usage 12/5
a2a-claude via ANTHROPIC_BASE_URL POST /v1/messages a2a.wrapper.sdk=a2a-claude, usage 12/5

Also fixed: hand-rolled wrapper CLIs were not calling bootstrapOtelSdkFromConfig (only the unused createCli scaffold did). All five CLIs now bootstrap + flush OTel. CLI bootstrap uses SimpleSpanProcessor + protobuf exporter (Phoenix rejects JSON with 415).

Why mock Ollama (agree with review)

  • Copilot already documents BYOK → Ollama (copilot.provider.baseUrl)
  • Claude Code documents Ollama via Anthropic-compatible API (ANTHROPIC_BASE_URL)
  • Better cookout than stubbing session managers — exercises real CLI + A2A message/send

Package identity

a2a.wrapper.core.version + a2a.wrapper.sdk / .sdk.version on every task span.

Checklist

  • Core OTel tests
  • Live Phoenix BYOK cookout (Copilot + Claude)
  • Changesets + docs (examples/otel-stack)
Open in Web Open in Cursor 

cursoragent and others added 2 commits October 10, 2026 18:02
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>
@cursor cursor Bot changed the title feat(otel): Phase 1 OpenTelemetry API plumbing in @a2a-wrapper/core feat(otel): Phase 1–2 OpenTelemetry plumbing + usage anti-dupe Oct 10, 2026
cursoragent and others added 2 commits October 10, 2026 18:49
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>
@cursor cursor Bot changed the title feat(otel): Phase 1–2 OpenTelemetry plumbing + usage anti-dupe feat(otel): Phases 1–3 OpenTelemetry core + usage + backend passthrough Oct 10, 2026
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>
@cursor cursor Bot changed the title feat(otel): Phases 1–3 OpenTelemetry core + usage + backend passthrough feat(otel): Phases 1–4 OpenTelemetry (core, usage, Hook F, polish) Oct 10, 2026
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>
@cursor cursor Bot changed the title feat(otel): Phases 1–4 OpenTelemetry (core, usage, Hook F, polish) feat(otel): Phases 1–5 OpenTelemetry (core, usage, Hook F, polish, ownership) Oct 10, 2026
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>
@cursor cursor Bot changed the title feat(otel): Phases 1–5 OpenTelemetry (core, usage, Hook F, polish, ownership) feat(otel): Phases 1–5 OpenTelemetry + Phoenix demo & package identity Oct 10, 2026
cursoragent and others added 3 commits October 10, 2026 19:25
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>
@cursor cursor Bot changed the title feat(otel): Phases 1–5 OpenTelemetry + Phoenix demo & package identity feat(otel): Phases 1–5 + Phoenix BYOK cookout (mock Ollama) Oct 10, 2026
@shashikanth-gs
shashikanth-gs marked this pull request as ready for review October 10, 2026 19:52
@cursor

cursor Bot commented Oct 11, 2026

Copy link
Copy Markdown

Superseded by #52 on branch otel (same OTel work + shared examples/mock-ollama). Closing this Cursor-named PR in favor of that one.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants