Repository navigation
feat(tracing): add OpenTelemetry distributed tracing for multi-agent calls (#305) - #330
Merged
Merged
Conversation
…calls (#305) - Add OTel auto-instrumentation packages (fastapi, httpx, redis) - Initialize OTel SDK with configurable sampling (OTEL_SAMPLE_RATE, default 10%) - Inject trace_id and span_id into structured JSON logs - Export traces to existing OTel Collector (trinity-otel-collector:4317) - Enable via OTEL_ENABLED=1 environment variable Traces propagate through inter-agent calls via traceparent header, enabling end-to-end request tracing across Agent A → Backend → Agent B. Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Add tests/unit/test_otel_trace_logging.py with 3 tests: - test_log_includes_trace_id_when_span_active - test_log_excludes_trace_id_when_no_span - test_log_preserves_standard_fields - Add opentelemetry-api and opentelemetry-sdk to test requirements - Update test-runner.md catalog with new test file Co-Authored-By: Claude Opus 4.5 <[email protected]>
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.
Summary
OTEL_SAMPLE_RATE)trace_idandspan_idinto structured JSON logs for log-trace correlationtrinity-otel-collector:4317)Traces propagate through inter-agent calls via
traceparentheader, enabling end-to-end request tracing across Agent A → Backend → Agent B.Changes
docker/backend/Dockerfile— 6 new OTel packagessrc/backend/main.py— OTel SDK initialization (~40 lines)src/backend/logging_config.py— trace_id in JSON log entriesdocs/memory/architecture.md— document new tracing capabilityTest Plan
OTEL_ENABLED=1trace_idappears in JSON log entries during request handlingConfiguration
Closes #305
🤖 Generated with Claude Code