Analytics client: capture/identify/groupIdentify/alias + batching.
Events accumulate in an in-memory queue (held in this GenServer) and are
flushed as a single batched POST to /ingest-events when:
- the queue reaches
flush_at, - the background timer fires every
flush_interval, or flush/1/shutdown/1is called.
A failed flush re-queues its batch (front of the queue) so events are never
lost on a single transient failure; the BilldogEng.Transport also retries
with backoff before a flush is considered failed.
Mirrors the Node SDK analytics.ts.
Summary
Functions
Alias one distinct id to another. Emits $create_alias.
Capture an arbitrary event for a user. Batched per the configured policy.
Returns a specification to start this module under a supervisor.
Force-flush the queue immediately. Blocks until the in-flight batch settles.
Set properties on a group. Emits $groupidentify.
Set person properties. Emits $identify.
Current number of queued (not-yet-flushed) events.
Flush remaining events and stop the background timer.
Functions
Alias one distinct id to another. Emits $create_alias.
Capture an arbitrary event for a user. Batched per the configured policy.
Returns a specification to start this module under a supervisor.
See Supervisor.
@spec flush(pid()) :: :ok | {:error, BilldogEng.Error.t()}
Force-flush the queue immediately. Blocks until the in-flight batch settles.
Set properties on a group. Emits $groupidentify.
Set person properties. Emits $identify.
@spec queue_length(pid()) :: non_neg_integer()
Current number of queued (not-yet-flushed) events.
@spec shutdown(pid()) :: :ok | {:error, BilldogEng.Error.t()}
Flush remaining events and stop the background timer.