Processing context and trace context¶
Before a route sees an assignment, the node builds a processing context from it and binds a trace context around it. The processing context is everything the route and the reports need, read once from the envelope; the trace context is the correlation every record the assignment produces will carry. This page is both, so a report or a log line can be traced back to the fields it was built from.
What preparation reads and builds¶
flowchart LR
subgraph ENV["ASSIGNMENT ENVELOPE"]
direction TB
AB["assignment block<br/>ids, attempt, fence, generation"]
PS["policy snapshot"]
PL["payload<br/>control_plane_task"]
end
subgraph CTX["PROCESSING CONTEXT"]
direction TB
I["Identity and fence"]
D["Policy digest"]
K["Assignment kind"]
X["Execution key and dedupe result"]
end
subgraph TRC["TRACE CONTEXT, bound for the assignment"]
direction TB
T["workspace, run, node,<br/>assignment, trace, registration"]
end
AB --> I
PS --> D
PL --> K
I --> X
I --> T
The context is built once and handed to the route, so every report the route makes carries the fence and generation the envelope arrived with. The trace context is bound around the whole of the assignment's handling, so every event, log and status it produces is correlated without the route adding anything.
The processing context¶
Preparation runs in a fixed order, and a route receives what it produced:
- The identity is read from the assignment block.
- The policy snapshot digest is resolved.
- The control-plane task is read from the payload, and the assignment kind is resolved from it. See The execution router.
- The local claim is taken. See Lease acquisition, dedupe, and finalize.
- The trace context is bound.
- The execution record is opened, and a terminal record ends handling as a replay. See Idempotency and dedupe contracts.
The context the route receives:
| Field | Source |
|---|---|
assignment_id, assignment_key, run_id, node_id, attempt |
The assignment block |
fence_token |
The assignment block, stamped at claim |
observed_generation |
The assignment's generation, at least 1 |
trace_id |
The assignment's trace_id, or run_id when it has none |
idempotency_key |
The assignment block |
policy_digest |
The policy snapshot digest |
control_plane_task, control_task_kind |
The payload's control_plane_task and its kind |
assignment_kind |
The explicit deployment, build, publication, secret, observability, model or operator kind in assignment.assignment_kind |
execution_idempotency_key |
Derived from the idempotency contract |
should_execute |
False when the execution record is already terminal |
fence_token and observed_generation are the two fields every status report
carries back, and the control plane checks both. A report built from this
context is therefore judged against the claim the assignment arrived under. See
Status lifecycle and reporting.
The trace context¶
The trace context is six fields:
workspace_uuid the assignment's workspace
run_id, node_id, assignment_id
trace_id the assignment's trace, or run_id
dataplane_registration_uuid this node's current registration
It is bound to the node's observability for the assignment, and every status,
event and log the assignment produces is stamped from it. A status payload that
names no workspace takes the trace context's workspace_uuid, so a report is
always attributable to a workspace.
trace_id is the identifier the control plane issued, carried unchanged into
every record. dataplane_registration_uuid identifies which registration of
the node produced the record, so records from a node before and after a restart
are told apart. See
The correlation tuple.