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:
+30
-12
@@ -260,7 +260,7 @@ branches compete for budget, a learned router earns its place (v2).
|
||||
becomes data-driven. v1's logs — enriched by meta-level critiques — are v2's training
|
||||
data, and the same data feeds prompt optimization and fine-tuning (META.md).
|
||||
|
||||
## 9-bis. Observability roadmap (future plan): OpenTelemetry
|
||||
## 9-bis. Observability (2026-10-27): OpenTelemetry export, BUILT
|
||||
|
||||
Today a run's observability is files: `runs/<ts>/run.log` (the line-based technical
|
||||
superset), `prompts/NN-stage.txt` (every exact rendered prompt + raw response), and the
|
||||
@@ -268,19 +268,37 @@ WARNING channel (machine judgements worth a human's eye — the mask seed that
|
||||
auto-answered a question, guards refusing ingests, budget starvation). This is complete
|
||||
but closed: reading it means tailing files.
|
||||
|
||||
**Planned, not built:** export the run as **OpenTelemetry** traces/spans so floop is
|
||||
observable from the standard tooling that already exists — Jaeger, Grafana Tempo,
|
||||
any OTLP consumer — instead of floop growing its own dashboards. The mapping is
|
||||
natural: one run = one trace; each LLM call, engine step (probe, search, fetch, check,
|
||||
merge) and evidence append = one span, carrying the fields the logs carry today
|
||||
**BUILT (post-mortem half):** the run exports as **OpenTelemetry** traces/spans
|
||||
(`floop/traces.py`), so floop is observable from the standard tooling that already
|
||||
exists — Jaeger (running on the agentvps as a docker container), Grafana Tempo, any
|
||||
OTLP consumer — instead of floop growing its own dashboards. The mapping is the
|
||||
natural one: one run = one trace; each LLM call, engine step (probe, search, fetch,
|
||||
check, merge) and evidence append = one span, carrying the fields the logs carry today
|
||||
(stage, budget tick, duration, prompt-file pointer, verification flags, warnings).
|
||||
The planned `events.jsonl` (machine-readable event stream) becomes the in-process
|
||||
event bus this exporter reads — one schema, two consumers (offline self-analysis in
|
||||
META.md, live OTel export). Warnings export as span events first-class, since they are
|
||||
the self-improvement signal the lessons bank counts.
|
||||
`events.jsonl` (the flight recorder's machine-readable event stream) is the single
|
||||
schema with two consumers: offline self-analysis in META.md, and `python -m
|
||||
floop.traces <run_dir>` replaying it into Jaeger over OTLP/HTTP after the run — the
|
||||
run itself never touches the network (observability never kills a run). Warnings
|
||||
export as span attributes/events first-class, since they are the self-improvement
|
||||
signal the lessons bank counts.
|
||||
|
||||
Deferred until the loop hardening is done — building it before v1's shape settles
|
||||
would instrument a moving target.
|
||||
Conventions the exporter keeps:
|
||||
- Deterministic trace ids (sha of the run dir name) — the same run always maps to
|
||||
the same trace id, so UI links are stable and a re-push finds the same trace.
|
||||
- The root span is named by the run's question and carries the final answer as an
|
||||
attribute; the trace list in Jaeger reads as a list of questions.
|
||||
- Recursive child runs (recursive floop as an expert attendant) write the SAME
|
||||
events.jsonl with their own run_ts; each child-run block becomes its own span
|
||||
nested under the spawning component, so the fractal recursion is visible as
|
||||
nesting, and `seq` restarting is expected (positions, not seq, identify spans).
|
||||
- `ts` is local wall time without a date; the date comes from the run dir name,
|
||||
and a backwards jump means midnight crossed. The clock is only ever fed in
|
||||
emission order — pre-reading a later event poisons the midnight detector.
|
||||
|
||||
**Still deferred:** the in-process LIVE export (an OTLP exporter listening on the
|
||||
event bus during the run, so Jaeger shows the waterfall while the run is still
|
||||
going). Same schema, second consumer — build when a live run is actually observed
|
||||
from outside; the hardening of the loop has priority.
|
||||
|
||||
## 10. Risks
|
||||
|
||||
|
||||
Reference in New Issue
Block a user