Skip to content

Observability trace layer

Every record a node produces about its own work has to say which assignment, run and trace it belongs to, and none of it may carry a secret. The observability trace layer holds the trace context for the assignment the node is processing, so every metric and log it emits carries that context without each caller restating it. The trace and audit serializer turns events, logs and attestations into sequenced, redacted, content-addressed envelopes before any copy is written. This page covers the trace context, the metrics and logs the layer keeps, the serializer, and how the node's records relate to the kernel's telemetry for the same run.

From a caller to an envelope

flowchart TB
  subgraph TL["TRACE LAYER, xratud.trace_context.v1"]
    direction TB
    CTX[("Bound context<br/>workspace, run, node,<br/>assignment, trace, registration")]
    MT[("Metrics<br/>up to 4096")]
    LG[("Logs<br/>up to 4096")]
    CTX --> MT
    CTX --> LG
  end
  subgraph SZ["SERIALIZER, xratud.trace_audit.v1"]
    direction TB
    RD{{"Redact keys and strings"}}
    SQ["Sequence<br/>seq per process"]
    ID["event_id<br/>SHA-256 of the record"]
    RD --> SQ --> ID
  end
  AH["Assignment handling"]
  PS["Payload store<br/>then mux and audit spool"]
  HB["Heartbeat<br/>trace_runtime"]
  AH -->|"bind per assignment"| CTX
  AH -->|"event, log, attestation"| RD
  ID --> PS
  TL --> HB

Two parts, two jobs: the trace layer knows which work a record is about, and the serializer makes the record safe and identifiable before it goes anywhere.

The trace context

The node binds the context when it starts processing an assignment:

workspace_uuid
run_id, node_id, assignment_id
trace_id                      the assignment's trace, or run_id when it has none
dataplane_registration_uuid
project_name, project_version when the assignment names a project

Fields with no value are left out. The context is replaced, never merged, when the next assignment is bound, so a record cannot carry one assignment's run and another's trace. See Processing context and trace context and The correlation tuple.

Metrics and logs

A metric has a name, a value and labels; a log has a level, a message and details. Each is stamped with the bound context and the time, and kept in its own buffer of up to 4096 entries, the oldest giving way first. Names the node emits include:

xratud.assignment.status.emit           per status report, labelled by action
xratud.assignment.attestation.appended  per dependency attestation

The layer's state is reported in every heartbeat as trace_runtime: the number of metrics and logs buffered and the context currently bound. See Cycle summary and heartbeat projection.

The serializer

The serializer produces three record types, each xratud.trace_audit.v1:

record_type Carries
event event_type and a payload
log level, message and details
attestation attestation_type and the attestation document

Every record carries seq, a number that rises by one for each record the process serializes, emitted_at_epoch_ms, and the correlation fields. An event or log without a run_id and a node_id is refused. trace_id falls back to the run_id.

The event_id is the SHA-256 of the canonical record, so two copies of one record have one identity wherever they end up. The object in your bucket is named by the event_id, the audit spool entry carries it, and the control plane's record reaches it through the object's reference.

Redaction runs first. A key naming a secret, token, password, API key, authorization, private key, ciphertext, a remote reference, manager locator, resolver subject, grant identifier, external-version identifier or audit correlation has its value replaced with ***redacted***, at any depth. Strings are rewritten when they contain a bearer token, a key=value credential, a secret:// reference or an sk- key, and a string over 16 KiB is truncated. Because redaction happens before the record exists, the bucket object and the control plane's record are redacted alike. See Event log envelopes.

The node's records and the kernel's journal

A run produces records in two places, and each describes what that place saw:

Node records Kernel telemetry journal
Describes The node's handling of the assignment: admission, gates, status, delivery The run itself: every capability transition, object, effect, policy decision and validation
Ordered by The serializer's seq The journal's sequence, which the kernel's relay assigns
Integrity event_id per record; the audit spool's hash chain The journal's hash chain, sealed by the kernel
Leaves as Metadata records and bucket objects A sealed collection: body to your bucket, metadata to the control plane

Both carry the same run_id and trace_id, so a run's node records and its kernel journal join on those fields. Ordering within the run comes from the kernel's journal sequence, never from comparing timestamps across processes. See Payload store runtime.