Skip to main content

Module trace_ctx

Module trace_ctx 

Source
Expand description

W3C trace-context propagation across the outbox boundary.

End-to-end tracing in makod crosses an asynchronous store boundary: an inbound HTTP request (AS4 push, REST ingest, ERP command) produces outbox messages that a worker delivers minutes later on a different task. A span cannot survive that hop — but the W3C traceparent string can.

The transport layer scopes the inbound request’s traceparent header into the TRACEPARENT task-local; every OutboxMessage created inside that scope — by materialise_outbox or OutboxMessage::new — captures it into its persisted trace_context field. Delivery workers then inject it into outbound HTTP requests (ERP webhook traceparent header and the CloudEvents traceparent extension), closing the chain:

inbound traceparent ─▶ task-local ─▶ outbox row ─▶ outbound traceparent

Statics§

TRACEPARENT
The W3C traceparent value of the request currently being processed.

Functions§

current
The traceparent of the current task scope, if one was propagated.