Skip to content

feat(dev): collect local OTEL traces in project dev - #1980

Open
tejaskash wants to merge 7 commits into
feat/project-dev-handlerfrom
feat/dev-otel-collector
Open

feat(dev): collect local OTEL traces in project dev#1980
tejaskash wants to merge 7 commits into
feat/project-dev-handlerfrom
feat/dev-otel-collector

Conversation

@tejaskash

Copy link
Copy Markdown
Contributor

Summary

  • add an in-process OTLP/HTTP collector for agentcore project dev: accepts POST /v1/traces and POST /v1/logs (protobuf via pinned @opentelemetry/otlp-transformer@0.213.0 generated decoders, or JSON), persisting raw payloads as per-trace JSON Lines under agentcore/.cli/traces/otlp/
  • split responsibilities: io/httpServer.ts (loopback node:http primitive), core/dev/otel/store.ts (persistence + list/get queries), core/dev/otel/transforms.ts (pure OTLP flattening/noise filtering), core/dev/otel/collector.ts (routing + decode)
  • dev handler starts the collector by default, gated on instrumentation.enableOtel ?? true and a new --no-traces flag; spawned agents receive OTEL_EXPORTER_OTLP_ENDPOINT + OTEL_SERVICE_NAME env, with the endpoint rewritten to host.docker.internal for Container runtimes
  • Python CodeZip agents get sitecustomize-based auto-instrumentation on PYTHONPATH (an opentelemetry-instrument wrapper would leave uvicorn --reload worker respawns untraced); a status line warns when opentelemetry-distro is absent
  • router now renders boolean flags defaulting to true as --no-<name> negations
  • the collector binds an OS-assigned port (agents learn it via env), eliminating port-scan contention logic

Stack

  • targets feat/project-dev-handler (feat(project): wire dev handler #1966); retarget to refactor after it merges
  • PR A of the dev OTEL/Inspector plan; PR B (Agent Inspector web UI) consumes the TraceStore read API

Verification

  • bun test (1202 pass)
  • bun run typecheck, bun run lint:check, bun run format:check
  • bun run build + smoke: node dist/index.js project dev --help shows --no-traces
  • protobuf decode round-trip verified under bun source, the Node bundle, and a compiled binary (the pinned generated root survives all three)

Note: running bun test after bun run build picks up dist/assets/cdk/test/cdk.test.ts (pre-existing; unrelated to this change).

Adds an in-process OTLP/HTTP collector (protobuf + JSON ingest, JSONL
persistence per trace) started by the dev handler unless --no-traces or
instrumentation.enableOtel is false. Spawned agents receive OTEL env
pointing at the collector; container runtimes get a host.docker.internal
endpoint, and Python CodeZip agents get sitecustomize-based
auto-instrumentation so uvicorn --reload workers stay traced.
@github-actions github-actions Bot added the size/xl PR size: XL label Aug 12, 2026
@github-actions github-actions Bot added the agentcore-harness-reviewing AgentCore Harness review in progress label Aug 12, 2026
@github-actions github-actions Bot added size/xl PR size: XL and removed size/xl PR size: XL labels Aug 12, 2026
@github-actions github-actions Bot removed the agentcore-harness-reviewing AgentCore Harness review in progress label Aug 12, 2026
@tejaskash
tejaskash force-pushed the feat/project-dev-handler branch 2 times, most recently from 37312c9 to 73ab887 Compare August 13, 2026 17:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/xl PR size: XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant