feat: OTel trace exporter - events.jsonl to Jaeger (post-mortem)

ARCHITECTURE 9-bis BUILT: one run = one OTel trace, deterministic id
(sha of run dir name); root span named by the question with the final
answer as attribute; INIT/ROUTE/EXPERT/ANSWER as nested component spans;
every llm.done/probe.done/fact.merged event one span; recursive child
runs (same events.jsonl, own run_ts, seq restarts) nest as per-run
spans. Post-mortem only - the run never touches the network.

floop/traces.py stdlib only; pushes OTLP/HTTP JSON to Jaeger v2
(docker on agentvps, 10.3.14.59:16686 UI / :4318 ingest, VPN-bound).
python -m floop.traces runs/<dir> | --latest N | --dry.

Verified: Pedro 09:15 run -> 393 spans (root 1193.8s, 128 llm spans),
read back via Jaeger API; fractal goal run nests to depth 6.
tests/traces.py 5/5; recorder 3/3; inspect 3/3.
This commit is contained in:
2026-10-27 12:34:44 +01:00
parent d6c5bed443
commit 6ea769b7d1
5 changed files with 568 additions and 12 deletions
+23
View File
@@ -71,9 +71,32 @@ floop/llm.py dspy LM configuration (OpenAI-compatible endpoints)
floop/dspy_modules.py every LLM call as a dspy module (INIT, ROUTE, EXPERT, MISSING, ANSWER)
floop/engine.py engine interface + draft stub engines
floop/machine.py FloopRun — the loop; recursion for the `floop` attendant
floop/recorder.py the flight recorder — events.jsonl (one JSON line per component)
floop/traces.py events.jsonl -> OpenTelemetry spans; push a run to Jaeger (post-mortem)
floop/inspect_html.py events.jsonl -> self-contained inspect.html (offline viewer)
tests/state.py unit tests (no LLM)
tests/traces.py exporter tests (no network)
```
## Viewing a run as traces (Jaeger, 2026-10-27)
Every run records `events.jsonl`; `floop/traces.py` replays it as one
OpenTelemetry trace and pushes it to the Jaeger container on the agentvps
(`http://10.3.14.59:16686` on the VPN; OTLP ingest on `:4318`):
```bash
uv run python -m floop.traces runs/<ts>-<slug> # one run -> Jaeger
uv run python -m floop.traces --latest 3 # the newest runs
uv run python -m floop.traces <dir> --dry # build the payload, don't push
```
The root span is the run (named by the question, final answer as an
attribute); INIT/ROUTE/EXPERT/ANSWER components nest under it, every LLM
call is a span with its stage/duration/prompt file, and recursive child
runs appear as nested run-spans. Trace ids are deterministic — re-pushing
a run lands on the same trace. Stdlib only; the run itself never touches
the network.
## Next steps (design order from the docs)
1. Real check layer on expert arrival (well-formedness per expert kind) — the