The BilldogEng server SDK client for Elixir.
Engagement suite for server-side use: Analytics, Feature Flags (remote + local evaluation), Surveys (data API), Messaging dispatch, and LLM tracing.
Quickstart
{:ok, bd} = BilldogEng.new("bd_test_xxx", local_evaluation: true)
BilldogEng.capture(bd, "user-123", "order_completed", %{"revenue" => 49.99})
on? = BilldogEng.is_feature_enabled(bd, "new_checkout", "user-123")
BilldogEng.shutdown(bd)The client holds two supervising-free GenServers — one for the analytics
batch queue, one for the feature-flag definition cache. Call shutdown/1 to
flush remaining events and stop the background flush timer.
Summary
Functions
Alias one distinct id to another. Emits $create_alias.
Capture an event for a user. Batched; flushed per the configured policy.
Capture an LLM trace span. See BilldogEng.Llm.capture_trace/2.
Dispatch a message. See BilldogEng.Messaging.dispatch/2.
Flush queued analytics events now.
Evaluate all known flags for a user.
Get a flag value: boolean, variant key string, or nil if unknown.
Get a flag's payload (variant config), local mode.
Set group properties. Emits $groupidentify.
Set person properties. Emits $identify.
Whether a flag is enabled for the user.
Construct a client.
Like new/2 but raises on error.
Number of events currently queued (test/observability aid).
Reload local flag definitions (local mode).
Inject flag definitions directly, bypassing the network (advanced/tests).
Flush remaining events and stop the background flush timer.
Types
@type t() :: %BilldogEng{ analytics: pid(), api_key: String.t(), flags: pid(), transport: BilldogEng.Transport.config() }
Functions
Alias one distinct id to another. Emits $create_alias.
Capture an event for a user. Batched; flushed per the configured policy.
@spec capture_trace( t(), keyword() ) :: {:ok, term()} | {:error, BilldogEng.Error.t()}
Capture an LLM trace span. See BilldogEng.Llm.capture_trace/2.
@spec dispatch_message( t(), keyword() ) :: {:ok, term()} | {:error, BilldogEng.Error.t()}
Dispatch a message. See BilldogEng.Messaging.dispatch/2.
@spec flush(t()) :: :ok | {:error, BilldogEng.Error.t()}
Flush queued analytics events now.
Evaluate all known flags for a user.
Get a flag value: boolean, variant key string, or nil if unknown.
Get a flag's payload (variant config), local mode.
Set group properties. Emits $groupidentify.
Set person properties. Emits $identify.
Whether a flag is enabled for the user.
Construct a client.
Options
:host— base URL (default"https://api.billdog.io/v1"):flush_at— batch size that triggers a flush (default20):flush_interval— background flush cadence in ms (default10_000):max_queue_size— max queued events before oldest are dropped (default1000):gzip— gzip large request bodies (defaulttrue):local_evaluation— enable local feature-flag evaluation (defaultfalse):request_timeout— per-request timeout in ms (default10_000):max_retries— retry attempts for 5xx/network errors (default3):group_type_index— map of group-type → positional index0..4:enable_logging— emit verbose diagnostics (defaultfalse):sleep_fn— injectable sleep (tests)
Like new/2 but raises on error.
@spec queue_length(t()) :: non_neg_integer()
Number of events currently queued (test/observability aid).
@spec reload_feature_flag_definitions(t()) :: :ok
Reload local flag definitions (local mode).
Inject flag definitions directly, bypassing the network (advanced/tests).
@spec shutdown(t()) :: :ok | {:error, BilldogEng.Error.t()}
Flush remaining events and stop the background flush timer.