Notes to supplement understanding OpenFeature
Contents
Problem
- How do you change and set feature flags dynamically?
Options
- Store all the flag values in database fronted by a server with a REST API. Create a common client that everyone can use. Whenever a feature flag needs to be changed, the underlying data that REST API points to can be changed.
[(z) application] –> [(a) Client] —> [(b) Server/REST API] —> [(c) Database]
(a) can be client in any language (an option to choose which language would be nice) (b) can be a REST API server (an option to choose how this is implemented would be nice) (c) can be any kind of database (an option to choose the database backend would be nice)
It’d be nice to have hooks to do something before and after the flag is evaluated.
(a) can be further divided into: (i). Part which is specific to implementation of (b) (ii). Part which is independent of (b) (i), (b) and (c) together constitute a provider
The interface between (z) and (ii) is the evaluation API. Evaluation context is the additional global data you can put in for every call between (z) and (ii). You can set it when you initialize (a). Hooks is the mechanism for tweaking this evaluation context before the evaluation (i.e., (z) calls (a)) happens among other things. e.g., you can perform extra validation using hooks.
References
- https://docs.openfeature.dev/docs/reference/intro/
- https://docs.openfeature.dev/docs/category/concepts
P.S.
- I started a thread around my notes in CNCF slack here and came across a blogpost by Adam Gardner which explains OpenFeature in an easy to understand way.