ABSmartly.Context (ABSmartly v1.0.0)

Copy Markdown View Source

Summary

Functions

Returns a specification to start this module under a supervisor.

Finalizes the context and then stops its process, releasing the supervised process and everything it retains (data, attributes, assignment caches).

Supervisor shutdown budget (ms) so a context can finish its bounded final publish.

Types

t()

@type t() :: GenServer.server()

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

close(context)

custom_field_keys(context)

custom_field_value(context, experiment_name, field_name)

custom_field_value_type(context, experiment_name, field_name)

data(context)

dispose(context, opts \\ [])

Finalizes the context and then stops its process, releasing the supervised process and everything it retains (data, attributes, assignment caches).

Use this at the end of a request/session lifecycle. Disposal always releases the process: if the final publish keeps failing, it is retried up to :attempts times (default 3, with :backoff ms between attempts, default 100), after which the unpublished events are discarded, the process is stopped anyway and {:error, {:disposed_unpublished, reason}} is returned so the caller can observe that events were not delivered. Returns :ok when everything was published.

After dispose/1 the pid is dead, so inspection helpers such as is_finalized?/1 must be called before it.

experiments(context)

finalize(context)

get_attribute(context, name)

get_attributes(context)

get_unit(context, unit_type)

get_units(context)

is_closed?(context)

is_closing?(context)

is_failed?(context)

is_finalized?(context)

is_finalizing?(context)

is_ready?(context)

peek(context, experiment_name)

peek_variable_value(context, key, default_value \\ nil)

pending(context)

publish(context)

ready_error(context)

refresh(context)

refresh(context, new_data)

set_attribute(context, name, value)

set_attributes(context, attributes)

set_custom_assignment(context, experiment_name, variant)

set_custom_assignments(context, assignments)

set_data(context, data)

set_failed(context, reason)

set_override(context, experiment_name, variant)

set_overrides(context, overrides)

set_unit(context, unit_type, uid)

set_units(context, units)

shutdown_timeout(sdk_config)

Supervisor shutdown budget (ms) so a context can finish its bounded final publish.

start_link(sdk_config, data, context_config, opts \\ [])

track(context, goal_name, properties \\ nil)

treatment(context, experiment_name)

variable_keys(context)

variable_value(context, key, default_value \\ nil)

wait_until_ready(context, timeout \\ 5000)