Summary
When Agent A calls Agent B which calls Agent C, there is no way to trace the request across hops. Debugging multi-agent failures requires manually correlating timestamps across separate log streams. The OTel Collector is already running in docker-compose but the backend isn't instrumented.
Solution
Add OpenTelemetry auto-instrumentation for FastAPI, httpx, and Redis using official opentelemetry-instrumentation-* packages. This gives automatic trace propagation — the traceparent header flows through every inter-agent call, creating a connected trace.
Scope
- Add
opentelemetry-instrumentation-fastapi, opentelemetry-instrumentation-httpx, opentelemetry-instrumentation-redis to backend dependencies
- Initialize OTel SDK in
main.py startup (exporter pointed at existing collector on :4317)
- Auto-instrument FastAPI app, httpx client, and Redis connections
- Propagate trace context through agent-to-agent calls (
traceparent header via httpx instrumentation)
- Add trace ID to structured log output (
logging_config.py) for log-trace correlation
Acceptance Criteria
Key Files
src/backend/main.py — OTel initialization
src/backend/logging_config.py — trace ID in log format
src/backend/services/agent_client.py — httpx auto-instrumented (no code change needed)
docker-compose.yml — collector already configured
Dependencies
None — collector infrastructure already exists.
Summary
When Agent A calls Agent B which calls Agent C, there is no way to trace the request across hops. Debugging multi-agent failures requires manually correlating timestamps across separate log streams. The OTel Collector is already running in docker-compose but the backend isn't instrumented.
Solution
Add OpenTelemetry auto-instrumentation for FastAPI, httpx, and Redis using official
opentelemetry-instrumentation-*packages. This gives automatic trace propagation — thetraceparentheader flows through every inter-agent call, creating a connected trace.Scope
opentelemetry-instrumentation-fastapi,opentelemetry-instrumentation-httpx,opentelemetry-instrumentation-redisto backend dependenciesmain.pystartup (exporter pointed at existing collector on:4317)traceparentheader via httpx instrumentation)logging_config.py) for log-trace correlationAcceptance Criteria
otel-collector:4317)main.py, 3 new pip packages, zero new infrastructureKey Files
src/backend/main.py— OTel initializationsrc/backend/logging_config.py— trace ID in log formatsrc/backend/services/agent_client.py— httpx auto-instrumented (no code change needed)docker-compose.yml— collector already configuredDependencies
None — collector infrastructure already exists.