DoubleEntryLedger.Utils.Traceable protocol (double_entry_ledger v0.3.0)

View Source

Builds 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

t()

All the types that implement this protocol.

Types

t()

@type t() :: term()

All the types that implement this protocol.

Functions

changeset_metadata(schema, changeset)

@spec changeset_metadata(t(), Ecto.Changeset.t()) :: map()

metadata(schema)

@spec metadata(t()) :: map()

metadata(schema, schema_or_error)

@spec metadata(t(), Ecto.Schema.t()) :: map()