Repository navigation
Description
Task
T-126· Milestone M10 — Evaluation · Size S · Priority P3 · Epic #10Implements NFR-OBS-001
Branch
feat/t-126-optional-opentelemetry-tracing-api-orchestrator— one task = one branch = one PR (doc 32 §6)
Summary
Add optional OTel instrumentation (FastAPI, SQLAlchemy, custom spans for run lifecycle) exporting OTLP to a collector in the observability profile; disabled by default with zero overhead.
Context / motivation
Doc 21 §5.3 (optional tracing).
Scope
In scope
- Trace id propagated into problem+json
trace_idand logs.
Implementation guidance
roboprobe/observability/tracing.py:def configure_tracing(settings: ObservabilitySettings, service_name: str) -> None— a no-op unlessobservability.otlp_endpointis set (doc 27 §4.10, doc 21 §5.3); importsopentelemetrylazily inside the function (extraroboprobe[otel]).- Instrument FastAPI and SQLAlchemy, plus manual spans
campaign.tick,strategy.propose,run.executewith childrenmaterialize,episode,judge,persist(doc 21 §5.3). - Propagate
trace_idinto the structlog context and problem+jsontrace_id. - Optionally add an OTel collector + Jaeger to the observability profile.
- Standards: respect the layering contracts (doc 16 §2) and conventions in doc 34; no hard-coded tunables — thresholds/defaults come from typed settings (doc 27); no magic numbers (ruff
PLR2004); public APIs typed (mypy strict) and documented.
Configuration keys
From the configuration reference (doc 27). Keys marked (new) must be added to the typed settings models and appear in the generated reference (T-003c).
observability.otlp_endpointobservability.service_name
Acceptance criteria
- Disabled: no OTel import at runtime (test).
- Enabled: spans visible in collector.
- With the endpoint unset,
opentelemetryis not imported (sys.modules test). - Span names exactly as in doc 21 §5.3.
- Tests listed below added and green in CI; coverage of new code meets the gate in doc 18 §3.
- Docs, config reference and CHANGELOG
Unreleasedupdated where behaviour, keys or interfaces changed. - Definition of Done (doc 32 §3) satisfied.
Tests required
tests/integration/test_tracing.py.
Dependencies
Blocked by: #214 (T-125)
Blocks: no other task (leaf)
Parallelization notes
Files / paths owned by this task — avoid editing other paths; shared files (pyproject.toml entry points, cli/main.py, api/routers/__init__.py, router.tsx, docker/compose.yaml, ci.yml) are append-only:
backend/src/roboprobe/observability/tracing.py
Optional.
Definition of Done
Per doc 32 §3 and AGENTS.md §5: lint, format, mypy strict and import-linter green; tests added and passing; docs updated; PR template completed with Closes #<this issue>; Conventional Commit messages referencing T-126 (doc 16 §6); commits authored only by the repository owner identity (AGENTS.md §4); CI green; reviewer checklist (doc 32 §5.1) satisfied.
References
Design docs: doc 21 §5.3
Requirements: NFR-OBS-001 (traceability: doc 28)
External:
Metadata
Metadata
Assignees
Labels
Projects
- StatusShow more project fieldsBacklog
Activity
Add observability compose profile and optional OpenTelemetry tracing (C…