MetrixWire.Context (MetrixWire v0.2.2)

Copy Markdown View Source

Process-dictionary holder for the "current trace".

A Phoenix/Plug request runs in a single process, and Ecto/Finch telemetry is emitted in the CALLER process — so storing the active trace in the process dictionary correctly correlates every span to the request that issued it, with zero cross-request leakage on concurrent, per-request processes.

Summary

Functions

Clear the active trace.

The active trace for this process, or nil.

Set the active trace for this process.

Update the active trace with fun (a Trace.t -> Trace.t), storing the result. No-op when there's no active trace. Never throws.

Functions

clear()

Clear the active trace.

current()

The active trace for this process, or nil.

put(trace)

Set the active trace for this process.

update(fun)

Update the active trace with fun (a Trace.t -> Trace.t), storing the result. No-op when there's no active trace. Never throws.