Jido.Tracing.Trace (Jido v2.3.0)

Copy Markdown View Source

Trace data helpers for signal correlation.

Provides functions to create and attach trace data to signals using the Jido.Signal.Ext.Trace extension (namespace: "correlation").

Summary

Functions

Creates a child trace from a parent trace context.

Gets trace data from a signal.

Creates a new root trace with fresh trace_id and span_id.

Attaches trace data to a signal using the correlation extension.

Functions

child_of(map, causation_id)

@spec child_of(map(), String.t()) :: map()

Creates a child trace from a parent trace context.

The child trace:

  • Inherits the same trace_id
  • Gets a new span_id
  • Has parent_span_id set to the parent's span_id
  • Has causation_id set to the provided value (typically the parent signal's id)

get(signal)

@spec get(Jido.Signal.t()) :: map() | nil

Gets trace data from a signal.

new_root()

@spec new_root() :: map()

Creates a new root trace with fresh trace_id and span_id.

put(signal, trace_data)

@spec put(Jido.Signal.t(), map()) :: {:ok, Jido.Signal.t()} | {:error, term()}

Attaches trace data to a signal using the correlation extension.