Affected: All SDKs
Symptoms
-
A flag removed from the codebase is still showing evaluations.
Cause
-
If the flag is not using a JS-based SDK: A
variation
call with the explicit name of the flag is being called. -
If the flag is using a JS-based SDK: The JS SDK (and JS-based SDKs, such as React versions 2.26 and earlier) is making an
allFlags
call (oruseFlags
hook in React SDK) to get flag values for all flags available to client-side SDKs in the specified environment. TheallFlags
method will send a feature event to LD. This would be the equivalent of callingvariation
for every flag.
Solution
For non-JS-based SDKs:
- Search the flag name in any non-main codebase in testing or isolated machines.
For JS-based SDKs:
-
Make the flag unavailable to client-side SDKs in the flag Settings tab.
-
Configure
sendEventsOnlyForVariation
totrue
in the client-side SDK. When this option is set totrue
, analytics events will only be sent whenvariation
is called. To configure this option, reference sendEventsOnlyForVariation. -
If there are still evaluations, search for the flag name in any non-main codebase.
Strategies for easier flag cleanup:
It can be difficult to tell where the flag is being evaluated in your code, but if you have attributes showing where the flag evaluation occurred, it will make it easier to know where to look. For example, you could include the current application in the context, but if you need more information regarding where the evaluation is occurring, you can add as much information as needed. Once you're including this information, there are two different ways of viewing this:
- The Data Export feature enables the ability to export flag evaluation event data to a supported destination. With this export, you can choose to parse the data however you see fit. Read Data Export to learn more.
- Viewing the Live Events tab can help give real-time insight into the events your application is sending to LaunchDarkly. Read Live Events to learn more.