One trace's worth of spans (a request's own call tree), kept in the calling process's own
process dictionary: the same isolation boundary ForgeOpsTracker.set_user/1 and
ForgeOpsTracker.add_breadcrumb/4 already use, and for the same reason (Phoenix and Oban both
run one unit of work in one process). Not something app code normally calls directly; see
ForgeOpsTracker.span/4 and ForgeOpsTracker.record_span/5.
Nesting comes from a stack of open span ids: a span opened while another is open becomes its
child, and anything else parents under the root. A trace is sent only when its root span took at
least Configuration.trace_capture_threshold milliseconds, decided here once the root finishes,
so a fast request costs nothing on the wire.
Summary
Functions
True when the calling process has an open trace.
Ends the calling process's trace, always clearing it, and queues it for delivery when the root
took at least trace_capture_threshold milliseconds. started_at is a DateTime.
Records a span you timed yourself under the current one; a no-op outside a trace.
Times fun as a child span of whatever span is open (or of the root), returning its result.
Outside a trace it just runs fun. Recorded even if fun raises, throws or exits, which then
propagates unchanged.
Starts a fresh trace on the calling process, discarding any earlier one. A no-op (no trace
started) when track_tracing is off or the client isn't enabled for this environment.
Functions
@spec active?() :: boolean()
True when the calling process has an open trace.
@spec finish_trace(String.t(), String.t(), DateTime.t(), number()) :: :ok
Ends the calling process's trace, always clearing it, and queues it for delivery when the root
took at least trace_capture_threshold milliseconds. started_at is a DateTime.
@spec record_span(String.t(), String.t(), DateTime.t(), number(), map()) :: :ok
Records a span you timed yourself under the current one; a no-op outside a trace.
Times fun as a child span of whatever span is open (or of the root), returning its result.
Outside a trace it just runs fun. Recorded even if fun raises, throws or exits, which then
propagates unchanged.
@spec start_trace() :: :ok
Starts a fresh trace on the calling process, discarding any earlier one. A no-op (no trace
started) when track_tracing is off or the client isn't enabled for this environment.