Affected: All SDKs
Overview
When using the SDK to evaluate flags, you may receive a value that is unexpected. All SDK events received by LaunchDarkly are processed and then disposed of. LaunchDarkly does not keep a history of flag evaluations, and we cannot conclusively tell you why a flag was evaluated the way it did.
On the surface, the SDK isn't very transparent, and without additional tooling, it's hard to see why the SDK behaves the way it does. This article will go over adding tooling to your implementation in order to troubleshoot unexpected evaluation results.
Solution
To identify why your flags evaluate the way they do, follow these steps:
-
Implement evaluation reasons into your application. You can read more about this in our docs: Evaluation reasons.
-
Use our SDK's "evaluation reasons" feature to get the reason information. This can be exposed through logging or reporting to a logging platform.
-
Reference the following scenarios to investigate unexpected flag evaluation behavior.
Condition |
Reason |
Solution |
Resources |
If the kind you receive is one of:
and you are expecting a different kind or receiving an unexpected variation. |
The SDK is likely evaluating flags using a stale cache. |
Most SDKs have a future/promise you can use when initializing the SDK or calling the SDKs identify method. You can use this to know when the SDK has finished initializing and, you can evaluate flags using a fresh cache. Alternatively, you can use our SDK's "Monitoring SDK Status" feature to use a listener pattern to know when the SDK is ready to serve fresh flags. |
|
If the
|
The SDK is being used before it has a chance to populate the cache for the first time. | ||
If the
|
A null context was provided to the SDK. | Ensure you're providing a valid context to the SDK. | |
If the
|
The wrong variation method is being called. LaunchDarkly SDKs for type-strict languages provide several different variation methods. For example, if you have a flag that serves boolean variations and the |
Ensure you're evaluating flags using the correct method. | |
If the
|
An unexpected error occurred. | Reach out to LaunchDarkly Technical Support for assistance. |