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:
@@ -295,6 +295,26 @@ Conventions the exporter keeps:
|
||||
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.
|
||||
|
||||
Owner's visibility laws (27/10, this PR) — inputs and outputs are data, not
|
||||
prose:
|
||||
- Every pipeline function emits `fn.done` (fn, in, out) with NAMED arguments:
|
||||
in.query / out.titles for the Wikipedia search, in.title / out.{url, chars,
|
||||
tables} for the fetch, in.question / out.{value, confidence} for the judge,
|
||||
compose, skim, chunk_gate, serve_set, list_ingest, harvest, promote, check.
|
||||
- Every dspy call emits `sig.start` (the Signature's input fields, named:
|
||||
in.question, in.entities...) and `sig.done` (the typed output fields:
|
||||
out.entities, out.facts, out.value...) — emitted by the prompt-log callback,
|
||||
which sees the module forward; the LLM span and the sig span are the SAME
|
||||
node (name = stage, attributes carry in.*/out.* plus dur/call_seq/file).
|
||||
- The exact prompt + raw response live in a CHILD `prompt` span of every LLM
|
||||
span, read from the prompts/ file at export time — clickable in Jaeger,
|
||||
works retroactively for old runs.
|
||||
- EXPERT component spans carry the attendant's name (EXPERT knowledge);
|
||||
everything nested inside carries the expert prefix (knowledge.search,
|
||||
knowledge.state, knowledge.TYPE), and each expert exports its spans under
|
||||
its own OTel service (floop / knowledge / ...) so Jaeger groups and colors
|
||||
by component.
|
||||
|
||||
**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
|
||||
|
||||
Reference in New Issue
Block a user