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

Merged
emili merged 2 commits from feat/otel-traces into main 2026-10-27 15:19:56 +01:00
Owner

ARCHITECTURE 9-bis BUILT (the post-mortem half): the flight recorder's events.jsonl now exports as OpenTelemetry, and the viewer is Jaeger instead of a hand-grown report.

What changed:

  • floop/traces.py (stdlib only): one run = one trace, deterministic id (sha of run dir name, stable UI links); root span named by the question, final answer as attribute; INIT/ROUTE/EXPERT/ANSWER as nested component spans; every llm.done/probe.done/fact.merged event one span with its attributes; recursive child runs (same events.jsonl, own run_ts, seq restarts) nest as per-run spans. Post-mortem only — the run itself never touches the network.
  • Jaeger v2.22 all-in-one docker on agentvps, bound to 10.3.14.59 only (UI :16686, OTLP :4318). Emili's apache at 10.3.14.1 can front it publicly later.
  • CLI: python -m floop.traces runs/ | --latest N | --dry.
  • tests/traces.py: 5/5 (no network). recorder 3/3, inspect 3/3 still green.
  • Docs: ARCHITECTURE 9-bis planned->BUILT with conventions + deferred live export; README usage; RUNLOG tooling entry with the 5 live-found bugs.

How to test: uv run python -m floop.traces runs/20261027-091521-who-was-the-president-before-pedro-sanch, then open the Jaeger UI on the VPN and search service floop. Verified here: 393 spans stored, read back via Jaeger API (root 1193.8s, 128 llm spans); fractal goal run nests to depth 6.

Emili's part (outside this PR): the apache vhost + auth for the public subdomain.

ARCHITECTURE 9-bis BUILT (the post-mortem half): the flight recorder's events.jsonl now exports as OpenTelemetry, and the viewer is Jaeger instead of a hand-grown report. What changed: - floop/traces.py (stdlib only): one run = one trace, deterministic id (sha of run dir name, stable UI links); root span named by the question, final answer as attribute; INIT/ROUTE/EXPERT/ANSWER as nested component spans; every llm.done/probe.done/fact.merged event one span with its attributes; recursive child runs (same events.jsonl, own run_ts, seq restarts) nest as per-run spans. Post-mortem only — the run itself never touches the network. - Jaeger v2.22 all-in-one docker on agentvps, bound to 10.3.14.59 only (UI :16686, OTLP :4318). Emili's apache at 10.3.14.1 can front it publicly later. - CLI: python -m floop.traces runs/<dir> | --latest N | --dry. - tests/traces.py: 5/5 (no network). recorder 3/3, inspect 3/3 still green. - Docs: ARCHITECTURE 9-bis planned->BUILT with conventions + deferred live export; README usage; RUNLOG tooling entry with the 5 live-found bugs. How to test: uv run python -m floop.traces runs/20261027-091521-who-was-the-president-before-pedro-sanch, then open the Jaeger UI on the VPN and search service floop. Verified here: 393 spans stored, read back via Jaeger API (root 1193.8s, 128 llm spans); fractal goal run nests to depth 6. Emili's part (outside this PR): the apache vhost + auth for the public subdomain.
onibot added 1 commit 2026-10-27 12:34:50 +01:00
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.
onibot added 1 commit 2026-10-27 14:27:58 +01:00
Owner's 27/10 review of the OTel export, four asks, all landed:

1. NAMED IN/OUT PER FUNCTION: fn.done events (fn, in, out) at the
   knowledge pipeline's main functions - search (in.query -> out.titles),
   fetch, skim, compose, chunk_gate, serve_set, list_ingest, harvest,
   promote, check, judge - rendered as spans with in.<arg>/out.<arg>
   attributes. "wiki search ('Pedro date take'): [...]" is now
   knowledge.search with in.query and out.titles as data.
2. SIGNATURE IN/OUT: the dspy prompt-log callback emits sig.start/sig.done
   - the typed fields of every dspy call (in.question, out.entities,
   out.facts...). The LLM span and the sig span are one node.
3. CLICKABLE PROMPT: every LLM span carries a child 'prompt' span with
   the exact prompt + raw response read from prompts/NN-stage.txt at
   export time - retroactive for old runs (the Pedro run re-exports with
   128 prompt children).
4. EXPERT NAMES: EXPERT comp spans carry expert= (EXPERT knowledge);
   nested spans prefix with the expert (knowledge.search,
   knowledge.state, knowledge.TranslateToDSL); each expert exports its
   spans under its own OTel service so Jaeger groups by component.

Live-verified end to end: smoke run (glm-5.3-flash) exported while
running - MASK shows in.question -> out.entities [{France, PLACE}],
EXPERT knowledge nests knowledge.TranslateToDSL under service
knowledge; read back via Jaeger's own API. Suite: traces 7/7, all
floop + knowledge test files green (guards/value_clean caught two bugs
in the new emissions before commit: a wrong-scope variable and a
use-before-define; _rec now reads getattr(streams) so __new__ test
fakes survive).

Co-Authored-By: Claude <noreply@anthropic.com>
emili merged commit a007e8da25 into main 2026-10-27 15:19:56 +01:00
emili deleted branch feat/otel-traces 2026-10-27 15:19:56 +01:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: onibot/floop#32