Internal module. Not part of TraceGuard's public API: it may change in
any release. Use the functions in TraceGuard instead.
Turns a finished TraceGuard.Context into a diagnostic report.
The pipeline is fixed and runs entirely in the request process when the request completes:
- Order events by time (see "Timestamps" in
TraceGuard.EventCollector), then by sequence number. - Convert monotonic timestamps into microsecond offsets from the start of the request.
- Sanitize every value into a JSON-safe term: strings are truncated, structs, PIDs, references, functions and tuples are replaced by descriptive placeholders, and atom keys become strings.
- Redact sensitive keys recursively and scrub the exception message.
Only the result of step 4 ever leaves this module, so nothing unredacted is
stored or exported. The report structure is documented in
docs/architecture.md and TraceGuard.report().
Summary
Functions
Builds the redacted, JSON-safe report for a completed request.
Builds a failure description from a caught kind/reason/stacktrace.
Functions
@spec build(TraceGuard.Context.t(), integer() | nil, TraceGuard.Config.t()) :: map()
Builds the redacted, JSON-safe report for a completed request.
status is the final HTTP status (or nil when unknown).
@spec failure( atom(), term(), Exception.stacktrace(), String.t(), TraceGuard.Config.t() ) :: map()
Builds a failure description from a caught kind/reason/stacktrace.
The raw exception is reduced immediately to plain data: module name,
message, HTTP status mapping and a stacktrace without function arguments.
Message scrubbing and truncation happen later, in build/3.