tdeekens / flopflip

🎚Flip or flop features in your React application in real-time backed by flag provider of your choice 🚦
https://techblog.commercetools.com/embracing-real-time-feature-toggling-in-your-react-application-a5e6052716a9
MIT License
402 stars 40 forks source link

Improve the `getAll` flags to get real traffic data #69

Closed Kerumen closed 6 years ago

Kerumen commented 6 years ago

On the 2 feature-flags services offered by the library (launchdarkly and split.io) they have the notion of an "used" flag. A flag which received traffic during the last few days. It's great because it helps remove dead code and flag which are not used anymore. On flopflip, we require all the flags (because the library is designed like this) so we can't have the "real" traffic data. Even if a flag is unused we won't know it.

I think we should try to find a way to improve this.

tdeekens commented 6 years ago

Yeah. Nice idea. Maybe an opt-in for „lazy“ loading flags when defaultFlags are passed. Maybe also another adapter configuration so that they fetch flags more lazily. How would that work for splitio from their SDK side of things?

Kerumen commented 6 years ago

I think (but it should be confirmed) that the names() call doesn't account for traffic but only when you do the getTreatment() call. So instead of calling getTreatment for all the flags, we can try to call it only when it's required.

tdeekens commented 6 years ago

...but "required" would mean calling it lazily on each flag "request"? I'd have to think of a way do go about that as the current setup manages all flags but could be able to populate the store once each flag has been requested by a feature toggling component.

tdeekens commented 6 years ago

I will close this due to inactivity. I tried to come up with a way in the current architecture of flopflip to enable this but am failing at that. I will keep this in mind whenever other users have similar requests. Thanks a lot for the suggestion!