feat: Add features module and flagpole support#84
Conversation
|
Curious to hear the choice to serialize the features from json to strings. Is that how it is done in sentry today? It seems nicer to have the features directly as json by using sentry's flagpole jsonschema and combine it into the namespace-schema here? |
Yes, currently we store feature flags as strings in postgres (the options store). When the option for a feature flag is checked it is first parsed into a dict, and the dict is then converted into objects that can perform the flag logic. I didn't know how deeply you wanted to integrate feature flags into this library. We could have a new option 'type' for feature flags that can validate against the flagpole schema. Would I'll explore the path of expanding the jsonschema and storing features as structured data. This approach was cheap to build, and I have no problems with tossing it. |
Ah right, bc we store it in the db it needs to be serialized
I think this is ideally what we would want, but I am ok with getting this in as strings first given that we can tighten up that experience later given that you've been so kind as to help us out here. That way deserialization only happens at the json later and not again for str -> dict. |
Add feature flag support to option schema. The option schema that applications generate will reference a definition that is spliced in when the schema file is processed by sentry-options. This is the first step to having feature flags stored as structured data in the options file. Part of the alternative approach to #84
This is a rough pass on adding flagpole support to sentry-options. I've intentionally tried to limit the surface area that is exposed and there is only a has() and context object currently exposed.
This has largely been generated with LLM assistance during the ai-code sprint. There are still a few gaps in test coverage in the python library that I would like to shore up.