Class EvaluationEvent
java.lang.Object
com.azure.spring.cloud.feature.management.models.EvaluationEvent
Event tracking the evaluation of a feature flag. This class captures information about
a feature flag evaluation, including which user evaluated it, whether it was enabled,
which variant was returned (if any), and the reason for the variant assignment.
-
Constructor Summary
ConstructorsConstructorDescriptionEvaluationEvent(FeatureDefinition feature) Creates an Evaluation Event for the given feature. -
Method Summary
Modifier and TypeMethodDescriptionGets the feature flag that was evaluated.Gets the reason why a particular variant was assigned during this evaluation.getUser()Gets the identifier of the user who evaluated the feature flag.Gets the variant that was assigned during this feature flag evaluation.booleanDetermines whether the feature flag was enabled for this evaluation.setEnabled(boolean enabled) Sets whether the feature flag was enabled for this evaluation.setReason(VariantAssignmentReason reason) Sets the reason why a particular variant was assigned during this evaluation.Sets the identifier of the user who evaluated the feature flag.setVariant(Variant variant) Sets the variant that was assigned during this feature flag evaluation.
-
Constructor Details
-
EvaluationEvent
Creates an Evaluation Event for the given feature. This constructor initializes a new evaluation event with the specified feature flag, while setting default values for other properties.- Parameters:
feature- The feature flag that is being evaluated
-
-
Method Details
-
getFeature
Gets the feature flag that was evaluated.- Returns:
- the feature flag associated with this evaluation event
-
getUser
Gets the identifier of the user who evaluated the feature flag. This is useful for targeting specific users with features and for analytics tracking.- Returns:
- the user identifier associated with this evaluation
-
setUser
Sets the identifier of the user who evaluated the feature flag. This allows tracking which user accessed a particular feature.- Parameters:
user- the user identifier to associate with this evaluation- Returns:
- the updated EvaluationEvent instance for method chaining
-
isEnabled
public boolean isEnabled()Determines whether the feature flag was enabled for this evaluation. This indicates the result of the evaluation process for the feature flag.- Returns:
- true if the feature flag was enabled, false otherwise
-
setEnabled
Sets whether the feature flag was enabled for this evaluation. This allows recording the result of the feature flag evaluation process.- Parameters:
enabled- true to mark the feature as enabled, false otherwise- Returns:
- the updated EvaluationEvent instance for method chaining
-
getVariant
Gets the variant that was assigned during this feature flag evaluation. This is relevant for feature flags that support multiple variants rather than just being enabled or disabled.- Returns:
- the variant assigned for this evaluation, or null if no variant was assigned
-
setVariant
Sets the variant that was assigned during this feature flag evaluation. This allows recording which specific variant of a feature flag was selected when multiple variants are supported.- Parameters:
variant- the variant to associate with this evaluation- Returns:
- the updated EvaluationEvent instance for method chaining
-
getReason
Gets the reason why a particular variant was assigned during this evaluation. This helps track the decision-making process behind the variant selection and can be useful for debugging and analytics.- Returns:
- the reason for the variant assignment
-
setReason
Sets the reason why a particular variant was assigned during this evaluation. This documents the logic behind why a specific variant was chosen, which can be useful for troubleshooting and analytics purposes.- Parameters:
reason- the reason for the variant assignment- Returns:
- the updated EvaluationEvent instance for method chaining
-