DoubleEntryLedger.Utils.Traceable protocol (double_entry_ledger v0.4.0)
View SourceBuilds structured metadata maps for logging and tracing ledger operations.
Implementations focus on command-centric structs (commands and command maps) while accepting
related domain entities or errors to enrich the metadata. Keys are prefixed with event_*
for backward compatibility with existing log consumers, but values describe command activity.
The metadata includes a trace_context field that propagates the consumer-supplied
distributed tracing context (e.g. W3C traceparent/tracestate) into Logger metadata,
enabling correlation with upstream request spans.
Summary
Types
@type t() :: term()
All the types that implement this protocol.
Functions
@spec changeset_metadata(t(), Ecto.Changeset.t()) :: map()
@spec metadata(t(), Ecto.Schema.t()) :: map()