Lucerna.Reporting (Lucerna v0.0.1-alpha.0)

Fire-and-forget outbound delivery: experiment exposures batched to POST /sdk/v1/events, identify payloads sent one-by-one to POST /sdk/v1/people/identify.

Nothing here may ever slow or break a caller: record/2 and identify/2 are async casts (no-ops even against a dead process), dedupe and batching happen in this process, and failed deliveries drop on the floor — both endpoints ingest idempotently, so anything resent later is harmless and anything dropped is one lost data point, not an error loop. Identify keeps the last successfully sent payload and skips exact resends (a failed send leaves it unchanged, so the next identify is the retry).

Exposure delivery happens on the refresh cadence, immediately once enough events are pending, on Lucerna.flush/1, and on shutdown — terminate/2 drains the queue under the child-spec shutdown: 2_000. Identify delivers on receipt; because the mailbox is serial, a Lucerna.flush/1 call returns only after every identify cast before it has been attempted.

Telemetry: [:lucerna, :reporting, :flush] (%{count: n}) per delivered exposure batch, [:lucerna, :reporting, :error] (%{error: e}) per failed delivery of either kind.

Summary

Functions

Returns a specification to start this module under a supervisor.

Queues one identify payload for delivery to People: async, never raises. Validation happened in Lucerna.identify/2; this side only delivers.

Queues one event from the read path: async, never raises — against a dead or never-started Reporting process the cast is a no-op.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

identify(reporting_name, payload)

@spec identify(atom(), map()) :: :ok

Queues one identify payload for delivery to People: async, never raises. Validation happened in Lucerna.identify/2; this side only delivers.

record(reporting_name, event)

@spec record(atom(), map()) :: :ok

Queues one event from the read path: async, never raises — against a dead or never-started Reporting process the cast is a no-op.