View Source Flagsmith.Client.Analytics.Processor (flagsmith_engine v0.1.1)

Link to this section Summary

Functions

Starts and links a gen_server represented by this module, using a Flagsmith.Configuration.t/0 as the basis to derive its registration name and inner details.

Given a Flagsmith.Schemas.Features.FeatureState.t/0 or Flagsmith.Schemas.Features.Feature.t/0 or Flagsmith.Schemas.Flag.t/0 and an Flagsmith.Schemas.Environment.t/0 or Flagsmith.Configuration.t/0 add or increment the call count for feature id to be reported to the analytics endpoint. If :enable_analytics in the configuration value of the environment isn't true it's a no op and returns (:noop), otherwise if the feature/flag doesn't have an id it returns an error.

Returns the pid of Analytics.Processor process related to a given environment key, or :undefined if one can't be found.

Link to this section Types

Specs

Specs

environment_key() :: String.t()

Specs

Specs

identity_id() :: String.t() | non_neg_integer()
Link to this type

processor_identifier()

View Source

Specs

processor_identifier() :: {Flagsmith.Client.Analytics.Processor, String.t()}

Link to this section Functions

Specs

start_link(Flagsmith.Configuration.t()) :: {:ok, pid()}

Starts and links a gen_server represented by this module, using a Flagsmith.Configuration.t/0 as the basis to derive its registration name and inner details.

Specs

track(feature_type(), env_or_config()) ::
  :ok | :noop | {:error, {:invalid_feature, term()}}

Given a Flagsmith.Schemas.Features.FeatureState.t/0 or Flagsmith.Schemas.Features.Feature.t/0 or Flagsmith.Schemas.Flag.t/0 and an Flagsmith.Schemas.Environment.t/0 or Flagsmith.Configuration.t/0 add or increment the call count for feature id to be reported to the analytics endpoint. If :enable_analytics in the configuration value of the environment isn't true it's a no op and returns (:noop), otherwise if the feature/flag doesn't have an id it returns an error.

Otheriwse it automatically starts a process for the given environment key in case one is not running.

It's a non-blocking operation.

Link to this function

whereis(environment_key)

View Source

Specs

whereis(environment_key()) :: :undefined | pid()

Returns the pid of Analytics.Processor process related to a given environment key, or :undefined if one can't be found.