Module ldclient

ldclient module.

Description

ldclient module

Acts as an interface to most common SDK functions: starting and stopping client instances, and evaluating feature flags for users.

Function Index

alias/2Associates two users for analytics purposes.
alias/3Associates two users for analytics purposes.
all_flags_state/1Evaluate all flags for a given user and return their values.
all_flags_state/2Evaluate all flags for a given user and given client instance.
identify/1Identify reports details about a user.
identify/2Identify reports details about a user.
initialized/1Returns whether the LaunchDarkly client has initialized.
is_offline/1Returns whether the LaunchDarkly client is in offline mode.
start_instance/1Start client with default options.
start_instance/2Start client with custom name or options.
start_instance/3Start client with custom name and options.
stop_all_instances/0Stop all client instances.
stop_instance/0Stop client instance.
stop_instance/1Stop client with the custom name.
track/3Track reports that a user has performed an event.
track/4Track reports that a user has performed an event.
track_metric/4Reports that a user has performed an event, and associates it with a numeric value.
track_metric/5Reports that a user has performed an event, and associates it with a numeric value.
variation/3Evaluate given flag key for given user.
variation/4Evaluate given flag key for given user and given client instance.
variation_detail/3Evaluate given flag key for given user.
variation_detail/4Evaluate given flag key for given user and given client instance.

Function Details

alias/2

alias(User::ldclient_user:user(), PreviousUser::ldclient_user:user()) -> ok

Associates two users for analytics purposes.

This can be helpful in the situation where a person is represented by multiple LaunchDarkly users. This may happen, for example, when a person initially logs into an application-- the person might be represented by an anonymous user prior to logging in and a different user after logging in, as denoted by a different user key.

alias/3

alias(User::ldclient_user:user(), PreviousUser::ldclient_user:user(), Tag::atom()) -> ok

Associates two users for analytics purposes.

This can be helpful in the situation where a person is represented by multiple LaunchDarkly users. This may happen, for example, when a person initially logs into an application-- the person might be represented by an anonymous user prior to logging in and a different user after logging in, as denoted by a different user key.

all_flags_state/1

all_flags_state(User::ldclient_user:user()) -> ldclient_eval:feature_flags_state()

Evaluate all flags for a given user and return their values

Evaluates all existing flags, but does not create any events as a side effect of the evaluation. It returns a map of flag keys to evaluated values.

all_flags_state/2

all_flags_state(User::ldclient_user:user(), Tag::atom()) -> ldclient_eval:feature_flags_state()

Evaluate all flags for a given user and given client instance

Evaluates all existing flags, but does not create any events as a side effect of the evaluation. It returns a map of flag keys to evaluated values.

identify/1

identify(User::ldclient_user:user()) -> ok

Identify reports details about a user

This function uses the default client instance.

identify/2

identify(User::ldclient_user:user(), Tag::atom()) -> ok

Identify reports details about a user

This is useful to report user to a specific client instance.

initialized/1

initialized(Tag::atom()) -> boolean()

Returns whether the LaunchDarkly client has initialized.

If this value is true, it means the client has succeeded at some point in connecting to LaunchDarkly and has received feature flag data. It could still have encountered a connection problem after that point, so this does not guarantee that the flags are up to date. Alternatively, it could also mean that the client is in offline mode.

If this value is false, it means the client has not yet connected to LaunchDarkly, or has permanently failed. In this state, feature flag evaluations will always return default values.

is_offline/1

is_offline(Tag::atom()) -> boolean()

Returns whether the LaunchDarkly client is in offline mode.

In some situations, you might want to stop making remote calls to LaunchDarkly and fall back to default values for your feature flags, this tells you whether only default values will be returned.

start_instance/1

start_instance(SdkKey::string()) -> ok | {error, atom(), term()}

Start client with default options

The SDK key is required to connect. Default streamer URL, storage backend and instance name default will be used.

start_instance/2

start_instance(SdkKey::string(), TagOrOptions::atom() | map()) -> ok | {error, atom(), term()}

Start client with custom name or options

When TagOrOptions is an atom, the instance is started with that name. When it's a map, it can be used to start with custom options.

start_instance/3

start_instance(SdkKey::string(), Tag::atom(), Options::map()) -> ok | {error, atom(), term()}

Start client with custom name and options

Specify both custom client name and options when starting the client.

stop_all_instances/0

stop_all_instances() -> ok

Stop all client instances

stop_instance/0

stop_instance() -> ok | {error, not_found, term()}

Stop client instance

Stops the default client instance.

stop_instance/1

stop_instance(Tag::atom()) -> ok | {error, not_found, term()}

Stop client with the custom name

This is useful if a client instance was started with a custom name.

track/3

track(Key::binary(), User::ldclient_user:user(), Data::map()) -> ok

Track reports that a user has performed an event

Custom data can be attached to the event.

track/4

track(Key::binary(), User::ldclient_user:user(), Data::map(), Tag::atom()) -> ok

Track reports that a user has performed an event

This is useful for specifying a specific client instance.

track_metric/4

track_metric(Key::binary(), User::ldclient_user:user(), Data::map(), Metric::number()) -> ok

Reports that a user has performed an event, and associates it with a numeric value.

This value is used by the LaunchDarkly experimentation feature in numeric custom metrics, and will also be returned as part of the custom event for Data Export.

Custom data can also be attached to the event.

track_metric/5

track_metric(Key::binary(), User::ldclient_user:user(), Data::map(), Metric::number(), Tag::atom()) -> ok

Reports that a user has performed an event, and associates it with a numeric value.

This value is used by the LaunchDarkly experimentation feature in numeric custom metrics, and will also be returned as part of the custom event for Data Export.

Custom data can also be attached to the event.

variation/3

variation(FlagKey::binary(), User::ldclient_user:user(), DefaultValue::ldclient_eval:result_value()) -> ldclient_eval:result_value()

Evaluate given flag key for given user

Evaluates the flag and returns the resulting variation value. The default value will be returned in case of any errors.

variation/4

variation(FlagKey::binary(), User::ldclient_user:user(), DefaultValue::ldclient_eval:result_value(), Tag::atom()) -> ldclient_eval:result_value()

Evaluate given flag key for given user and given client instance

Evaluates the flag and returns the resulting variation value. The default value will be returned in case of any errors.

variation_detail/3

variation_detail(FlagKey::binary(), User::ldclient_user:user(), DefaultValue::ldclient_eval:result_value()) -> ldclient_eval:detail()

Evaluate given flag key for given user

Evaluates the flag and returns the result detail containing the variation index, value, and reason why the specific result was chosen. The default value will be returned in case of any errors.

variation_detail/4

variation_detail(FlagKey::binary(), User::ldclient_user:user(), DefaultValue::ldclient_eval:result_value(), Tag::atom()) -> ldclient_eval:detail()

Evaluate given flag key for given user and given client instance

Evaluates the flag and returns the result detail containing the variation index, value, and reason why the specific result was chosen. The default value will be returned in case of any errors.


Generated by EDoc