Affected: All SDKs
Overview
This topic explains how to track feature flag evaluations in LaunchDarkly. LaunchDarkly processes and disposes of all SDK events it receives, so it does not retain a history of flag evaluations by default. However, you can use several alternative methods to capture this data externally.
Solution
You can implement one of the following options to track flag evaluations:
Option 1: Data Export
If you are on a plan that includes the Data Export add-on, you can use it to obtain a list of users who have been served a specific variation of a flag.
Here is an example of the data captured by Data Export:
To learn more, read Data Export.
Option 2: Track variation
You can retrieve flag evaluation details in your code using the EvaluationDetail
and LDUser
objects.
Here is an example of an EvaluationDetail
object:
You can use this approach to capture the user key (unique ID) and variation served and then store it for future analysis. To learn more, read Evaluation reasons.
Option 3: Use the REST API to script evaluations
You can script a solution using LaunchDarkly’s REST API to evaluate feature flags for stored users or contexts.
-
Retrieve a list of contexts for a specific project and environment:
-
Use the list of contexts to evaluate flags:
To learn more, read Evaluate flags for context instance.
Then extract the feature flag key and its corresponding _value
. Store the mapping between the user key and the served variation. You should then be able to get a list of users who have been served a particular variation.