EvaluationExposureKey
public struct EvaluationExposureKey : Hashable
Identifies the evaluation result a hook is about to be told about, so that an EvaluationExposureDeduper can recognize
a repeat of it.
This struct is not stable, and not subject to any backwards compatibility guarantees or semantic versioning. It is experimental. Which components make up the identity of an evaluation is the most likely part to be revised, so a deduper subclass that reasons about them may need to change with it.
Two evaluations are the same exposure when every component here matches. The value is included directly rather than
inferred from the variation and version: those are the identity LaunchDarkly uses to bucket summary events, but neither
by itself guarantees that the payload is unchanged. The environment is a component because a hook set on LDConfig is
one instance shared by the clients for every environment in secondaryMobileKeys, and so is its deduper. It is
identified by a hash of the mobile key rather than by the key itself, so that a hook cannot read the credential out of
what it is told, and rather than by the configured environment name, which is arbitrary metadata that is always
"default" for the primary environment.
The components describe the result the evaluation returns, which is how the SDK identifies an evaluation on analytics events too. An evaluation the SDK has no flag data for returns the default value, and so is described by that value with no variation and no version, the same identity it summarizes such an evaluation under. Evaluations made before the client has flags are of that kind, as are evaluations of a flag that does not exist, so the data arriving changes the value, variation, and version, and the hook is told about the flag again rather than waiting out a window. A flag whose data carries no value, which is what a flag that is off without an off variation has, likewise returns the default value and is described by it, under the flag’s own variation and version. The environment is never unknown this way: it is derived from the configuration, so it is fixed before the client it belongs to evaluates anything.
The reason the SDK gives for a result is not a component, so neither is the experiment membership drawn from it. A prerequisite that starts failing to the variation an experiment had been choosing leaves the value, the variation, and the version unchanged while moving the flag out of that experiment, and the evaluations that follow are repeats here. The analytics the SDK sends are untouched by any of this, each carrying its own reason, so what LaunchDarkly attributes to an experiment does not depend on the window; a hook that reads the reason itself is what can miss such a change until the window elapses.
-
Identifies the environment the evaluation was made against, for comparison only: the mobile key is hashed so that a hook is not handed the credential, and the hash the SDK uses is not part of its contract. All that is guaranteed is that two evaluations made against the same environment give the same value, and evaluations made against different environments do not.
Declaration
Swift
public let mobileKeyHash: String -
The key of the flag that was evaluated.
Declaration
Swift
public let flagKey: LDFlagKey -
The value the evaluation returns, which is the default value if the flag was not found.
Declaration
Swift
public let value: LDValue -
The index of the variation the result came from, or
nilif the evaluation did not resolve to one.Declaration
Swift
public let variation: Int? -
The flag version reported on events, or
nilif the flag was not found.Declaration
Swift
public let flagVersion: Int? -
The fully qualified key of the evaluation context.
Declaration
Swift
public let fullyQualifiedContextKey: String -
Declaration
Parameters
mobileKeyHashA hash of the mobile key of the environment the evaluation was made against.
flagKeyThe key of the flag that was evaluated.
valueThe value the evaluation returns, which is the default value if the flag was not found. Defaults to null; prefer stating it, since the variation and version do not by themselves distinguish one result from another.
variationThe index of the variation the result came from.
flagVersionThe flag version reported on events.
fullyQualifiedContextKeyThe fully qualified key of the evaluation context.
View on GitHub