run span that roots it when none exists.
resolve_trace_contextreads the lineage a run already has: an explicit pair in its config, an explicit parent paired with the ambient deposit’s trace, or the ambient deposit. It never mints one.begin_run_tracekeeps that lineage, or opens onerunspan (a child of the live span, or the root of a new trace) and returns aRunTraceRootwhosestep()makes it current and deposits it for one step of the run. A lineage the config names is made current and deposited the same way; one inherited from the ambient deposit stays deposited and is made current by nothing here.open_run_traceholds a run kept in one block inside its lineage.open_lineage_spanopens one named span continuing a lineage handed over explicitly.
input_, given when it opens) and its output
(RunTraceRoot.record_output, given when the run ends), both encoded by the writer as every
other recorded payload. A kept lineage opens no span and records neither: the run is a step of a
trace whose root carries its own input and output.
Every writer member called here is fail-safe, so the openers raise nothing but
InvalidRunTraceError for a config they refuse.
InvalidRunTraceError
tai42_kit.monitoring.run_trace.InvalidRunTraceError
RunTraceRoot
tai42_kit.monitoring.run_trace.RunTraceRoot
run span it opened, if any.
step() makes the span (with no span, the lineage) current and deposits the lineage for one step of the run;
enter and exit it in the same context, never across a yield a consumer drives. record_output() records
the run’s output and end() ends the span.
Attributes
Members
step
tai42_kit.monitoring.run_trace.RunTraceRoot.step
record_output
tai42_kit.monitoring.run_trace.RunTraceRoot.record_output
output as the held span’s output; a no-op when no span is held or it has ended.
Parameters
fail
tai42_kit.monitoring.run_trace.RunTraceRoot.fail
error on the held span at ERROR.
Parameters
end
tai42_kit.monitoring.run_trace.RunTraceRoot.end
begin_run_trace
tai42_kit.monitoring.run_trace.begin_run_trace
RunTraceRoot.step, one inherited from the ambient deposit is left as it is.
Otherwise one run span opens with input_ as its input, a child of the live span or, with none live, the
root of a new trace, and is current only inside RunTraceRoot.step. context is None when nothing
records.
Parameters
open_lineage_span
tai42_kit.monitoring.run_trace.open_lineage_span
name with input_ as a child of parent, current and deposited for the block.
The block records its output on the yielded root; the span ends on exit.
Parameters
open_run_trace
tai42_kit.monitoring.run_trace.open_run_trace
begin_run_trace, current and deposited.
The block records the run’s output on the yielded root; a raise is recorded on it before it ends. Never hold
it across a yield a consumer drives; an async generator uses begin_run_trace and binds step()
per step.
Parameters
resolve_trace_context
tai42_kit.monitoring.run_trace.resolve_trace_context
config and the ambient deposit; None when it has none.
An explicit configurable[MONITORING_TRACE_ID_KEY] needs configurable[MONITORING_PARENT_SPAN_ID_KEY]
beside it. An explicit parent alone pairs with the ambient deposit’s trace. Else the ambient deposit. Pure.
A trace id that is not 32 lower-hex (not all zeros), a parent that is not 16 lower-hex (not all zeros), a trace
without a parent, or a parent with no trace to pair with is refused with InvalidRunTraceError. An empty
explicit trace id reads as absent.
Parameters

