Chronicle. Event
(chronicle v0.1.1)
Copy Markdown
A single immutable audit fact.
Events are deliberately not Ecto-specific.
Actor, tenant, and subject are references: exactly a type and an id. A
reference identifies, it does not describe — anything else about the party or
the thing belongs in data or metadata.
data is what this event asserts, supplied at the call site. metadata is
ambient: it is inherited from Chronicle.Context and merged into every event
raised while that context is in scope, so a request or job attaches its
provenance once rather than at every call. Neither is queried; filter on the
indexed columns — type, actor, tenant, subject, correlation, outcome, time.
Summary
Types
@type outcome() :: :unknown | :success | :failure | String.t()
@type t() :: %Chronicle.Event{ action: String.t() | nil, actor: map() | nil, correlation_id: String.t() | nil, data: map(), duration_us: non_neg_integer() | nil, error: map() | nil, group_id: String.t() | nil, id: String.t(), metadata: map(), occurred_at: DateTime.t(), outcome: outcome(), sequence: non_neg_integer() | nil, subject: map() | nil, tenant: map() | nil, type: String.t() }