feat: named inputs/outputs in traces + clickable prompts + expert names

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>
This commit is contained in:
2026-10-27 14:27:56 +01:00
co-authored by Claude
parent 6ea769b7d1
commit 1af308ae60
10 changed files with 628 additions and 132 deletions
+45
View File
@@ -467,3 +467,48 @@ depth 6. Three traces pushed live. ARCHITECTURE §9-bis updated: BUILT
**Emili's open item:** the vhost at oniricapps (he configures the apache
reverse proxy + LE cert for e.g. jaeger.oniricapps.com; the container is
already reachable at 10.3.14.59:16686 from his server).
---
# Tooling 2 — named inputs/outputs in the traces (2026-10-27, PM)
**His review of the first export** (the four asks, verbatim in the PR):
inputs and outputs of everything below the floop/expert components; the
prompt accessible from Jaeger itself; the expert's name in the span
names (EXPERT knowledge, knowledge.search inside); Signature inputs and
outputs on LLM calls. All four landed on the same branch (PR #32).
**What was added:**
- `fn.done` events (fn, in, out) at the knowledge pipeline's main
functions: search (in.query/limit -> out.titles), fetch (in.title ->
out.url/chars/tables), skim, compose, chunk_gate, serve_set,
list_ingest, harvest, promote, check, judge (in.question/rows ->
out.value/confidence). Named arguments, structured values as compact
JSON.
- `sig.start`/`sig.done` from the dspy prompt-log callback: every module
forward emits the Signature's input fields (in.question,
in.entities...) and typed outputs (out.entities, out.facts,
out.value...). The LLM span and the sig span are one node.
- The `prompt` child span: the exact prompt + raw response read from
prompts/NN-stage.txt AT EXPORT TIME — retroactive for old runs (the
128-file Pedro run re-exports with 128 clickable prompts).
- Expert names: `streams.call(..., expert=...)` on the EXPERT component;
the exporter renders 'EXPERT knowledge', prefixes children
(knowledge.state, knowledge.TYPE, knowledge.search), and exports each
expert under its own OTel service — Jaeger's service selector and
colors group by component.
**Live-found bugs (mine, fixed before commit):** the harvest fn.done
referenced a local of another function (NameError) and the list_ingest
event read `verify` before it existed (UnboundLocalError) — the
value_clean test's `__new__` fake caught that _rec touched
self.streams; the law now: `_rec` reads getattr(self, "streams", None)
(__new__-built fakes never define it). Smoke run live (glm-5.3-flash):
MASK carries in.question -> out.entities [{France, PLACE}], EXPERT
knowledge nests knowledge.TranslateToDSL — verified in the export
before the run finished (the recorder flushes).
**Still open from his review:** the trace-level 'which input fed which
output' is event-adjacency, not a dataflow edge — the honest limit of
post-mortem spans. And baseline/`--baseline` mode has no recorder yet.