flipt-io / flipt

Enterprise-ready, GitOps enabled, CloudNative feature management solution
https://flipt.io
GNU General Public License v3.0
3.65k stars 201 forks source link

[FEATURE]: Event trigger when flag changes state #2327

Open ericvdberge opened 11 months ago

ericvdberge commented 11 months ago

Problem

Hello Flipt team,

I started using the flipt docker container together with the C# GRPC SDK. I have a database and a redis cache configured in my C# API and added some feature flags. After testing some usecases, I missed a feature that I would like to request.

Use-case: I had a simple feature switch that switches between fetching 10 or 5 items at a time depending on the feature switch. I have redis configured for that route. The problem is that the feature switch does nothing because the cache takes over.

Ideal Solution

It would be nice to be able to listen for an event when a flag state is changed. This could not only be nice to invalidate cache, but also do something with e-mailing, logging insights before and after switching flag state, etc.

Search

Additional Context

No response

GeorgeMac commented 11 months ago

Morning @ericvdberge ! Great suggestion. Pushing state to clients is something we’ve talked about before. Can definitely see the value there.

Just to clarify in your example. When you say you use Redis, you are referring to in your own application? As opposed to using Redis as a cache backend for Flipt? Or am I mistaken?

ericvdberge commented 11 months ago

hi @GeorgeMac, Yes indeed. Redis is within my own application and not within Flipt.

markphelps commented 9 months ago

@ericvdberge sorry for the long delay in response time. Until we have a better solution, I was wondering if you would be able to leverage our webhook functionality for invalidating cached flags in your application: https://www.flipt.io/docs/configuration/auditing/webhooks

SuddenGunter commented 3 months ago

also would be cool to have it exposed as open feature provider_configuration_changed event https://openfeature.dev/docs/reference/concepts/events/#provider_configuration_changed if possible

markphelps commented 3 months ago

@SuddenGunter we could likely do this more easily with our client side sdks especially once we implement https://github.com/flipt-io/flipt-client-sdks/issues/294

would that work ?

SuddenGunter commented 3 weeks ago

it should work, but the idea (at least in our use-case) was to try to stick to open-feature SDK as much as possible in the application code :)