[Migration #121.6] Implement FastAPI and agent tracing instrumentation #313
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Parent EPIC: #121 - Backend Migration from Jarvis r1
Phase: 3 - OpenTelemetry Infrastructure
Estimate: 1-2 days
Dependencies: Requires #121.5 (OpenTelemetry core)
Description
Migrate automatic instrumentation for FastAPI and custom agent/tool tracing.
Source Files
jarvis/core/telemetry.py(FastAPI instrumentation)jarvis/core/agent_tracing.pyjarvis/core/tool_tracing.pyTarget Implementation
Acceptance Criteria
Issue #313 successfully implemented and merged to develop (commit
6de631c).Implementation Summary
Added comprehensive OpenTelemetry distributed tracing to the coordinator FastAPI service.
Features Delivered:
✅ FastAPI requests automatically traced via FastAPIInstrumentor
✅ Agent operations traced (@trace_agent_operation decorator)
✅ Tool executions traced (@trace_tool_execution decorator)
✅ Custom decorators supporting both sync and async functions
✅ Span enrichment with context (issue_id, agent_type, agent_id)
✅ Unit tests: 25 tests, 90-91% coverage
Files Added:
Files Modified:
Quality Gates:
✅ All tests passing (25/25)
✅ Coverage: 90-91% (exceeds 85% requirement)
✅ Zero linting errors (ruff)
✅ Zero type checking errors (mypy)
✅ Security review: APPROVED (no vulnerabilities)
✅ Code review: APPROVED
✅ QA testing: PASS
Configuration:
Tracing is now production-ready and compatible with Jaeger, Tempo, and other OTLP backends.