Jido.Exec.ContextPropagator behaviour (Jido Action v2.3.0)

View Source

Behaviour for propagating process-local runtime context across supervised work.

Implementations can capture ambient caller state in capture/0, attach it in a child process with attach/1, and clean up in detach/1.

This is intentionally backend-agnostic so packages such as jido_otel can bridge tracing context without jido_action depending on a specific observability library.

Summary

Types

Opaque token returned by attach/1 and passed to detach/1.

Opaque context captured in the parent process.

Callbacks

Attaches previously captured context in the child process.

Captures process-local runtime context in the caller process.

Cleans up any state created by attach/1.

Types

attached_ctx()

@type attached_ctx() :: term()

Opaque token returned by attach/1 and passed to detach/1.

captured_ctx()

@type captured_ctx() :: term()

Opaque context captured in the parent process.

Callbacks

attach(captured_ctx)

@callback attach(captured_ctx()) :: attached_ctx()

Attaches previously captured context in the child process.

capture()

@callback capture() :: captured_ctx()

Captures process-local runtime context in the caller process.

detach(attached_ctx)

@callback detach(attached_ctx()) :: :ok

Cleans up any state created by attach/1.