AuroraMeter. Schema. Event
(Aurora Meter v1.0.0)
View Source
One recorded usage fact.
Two kinds of row live here, and they are not the same thing.
A row written by AuroraMeter.track/4 for a feature listed in the legacy
durable_features carries no caller identity: a retry after an uncertain
write inserts a second row, and nothing reads the table for billing. Those
rows are given a derived event_id of "legacy:" <> id by
mix aurora_meter.events.backfill, so the schema can require an identity
without discarding history.
A row written by the V1 durable path carries the caller's own event_id,
unique per tenant, and a payload_hash that separates a retry of the same
fact from a different fact reusing the identity.
The field named inserted_at
It is the instant this node wrote the row, not the instant the usage
happened. The usage instant is occurred_at, which the caller supplies. The
Ecto field keeps the name inserted_at because a query written against 0.4.x
(where: e.inserted_at >= ^since) must keep compiling; the public read
struct AuroraMeter.Event exposes the same column as recorded_at, which is
what it is.
seq
An identity column assigned by a Postgres sequence at insert time. It is the
only sound scan order this table has: id is a random v4 UUID, so a forward
keyset scan ordered by it can miss a row committed by a transaction that
started earlier, and inserted_at is an application clock reading rather
than a commit order. Never write it; Ecto is told not to.
Summary
Types
@type t() :: %AuroraMeter.Schema.Event{ __meta__: term(), attribution: term(), dimensions: term(), event_id: term(), feature: term(), id: term(), inserted_at: term(), kind: term(), metadata: term(), occurred_at: term(), original_event_id: term(), payload_hash: term(), period_source: term(), period_start: term(), plan_id: term(), plan_version: term(), quantity: term(), seq: term(), tenant_key: term() }