docs(ADR): propose support for flag set selection#1634
Conversation
✅ Deploy Preview for polite-licorice-3db33c ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
549b8af to
5894df6
Compare
Signed-off-by: Alexandra Oberaigner <alexandra.oberaigner@dynatrace.com>
5894df6 to
7956e94
Compare
aepfli
left a comment
There was a problem hiding this comment.
Thank you! This looks good to me. I do think that this is the next logical step for evolving flagd. Currently the retro fitted approach is errornous, and I am still wondering that a few bugs have not been reported by now.
|
|
||
| We don't want to support merging of flag sets, due to implementation efforts & potential confusing behaviour of the | ||
| merge strategy. | ||
| Therefore, we propose for the initial implementation, `flagSetId`s must be unique across different sources or the configuration is considered invalid. |
There was a problem hiding this comment.
Which source will be considered as invalid? The same order as merging sources today?
There was a problem hiding this comment.
My naive thought was just to act as if an invalid configuration was loaded in this case - so if we're starting up initially, we'd exit with an error code, and if we got into this state with a change after already being in a running state, the change would have no effect and an error would be logged with every update until the error is corrected.
There was a problem hiding this comment.
We could prepare for different configurable merge strategies, with initially implementing a fail-fast strategy, or use the current merge strategy (last one wins).
| .build()); | ||
| ```` | ||
|
|
||
| * With the proposed solution the `flagSetId` should be passed to the builder as selector argument instead of the source. |
There was a problem hiding this comment.
Same comments as in #1610 (comment)
If we really want to stay with simple syntax, we should consider using something new, like flagSetSelector, instead of selector.
There was a problem hiding this comment.
flagd is only one implementation of the proto/API - the selector selects flag sets with this proposal, but another implementation could use the selector to select something else (maybe it could even be an expression), so I'm hesitant to explicitly bind it to the flag-set concept.
There was a problem hiding this comment.
We could also think about not introducing flagSets, but instead make selectors explicit.
E.g., something like this:
{
"$schema": "https://flagd.dev/schema/v1/selectors.json",
"selectors": {
"my-project-1": {
"metadata": {
...
},
"flags": {
"my-flag-1": {
"metadata": {
...
},
...
},
...
},
"$evaluators": {
...
}
},
"my-project-2": {
...
}
}
}With this, we'd keep our flagd vocabulary.
| ### Consequences | ||
|
|
||
| * Good, because it decouples flag sets from the sources | ||
| * Good, because we will refactor the flagd storage layer (which is currently storing duplicate data & difficult to |
There was a problem hiding this comment.
I think this is another problem. IMO the storage needs to be refactored because it mixes the interface and the in-memory impl, which makes the in-memory storage the only possible storage to use at the point.
| understand) | ||
| * Good, because we can support backwards compatibility with the v0 schema | ||
| * Good, because the "null" flag set is logically treated as any other flag set, reducing overall implementation complexity. | ||
| * Bad, because there's additional complexity to support this new config schema as well as the current. |
There was a problem hiding this comment.
The semantics of selector will also change, and the change happens mostly on the server (source) side, so the clients can have unexpected results with the same config.
There was a problem hiding this comment.
This is true, I will add that.
There was a problem hiding this comment.
There was a problem hiding this comment.
But it could also be done in a non-breaking way.
Flagd could still treat the source value as flagSetId/selector if the file content adheres to the v0/flags schema
There was a problem hiding this comment.
True, so this becomes a question of tech debt and code complexity.
There was a problem hiding this comment.
Reading through this ADR and thinking about it it seems to me that this is quite specific to the implementation of the flagd Sync server but the decisions here will impact the interface that the provider needs to use. The challenge here is that there will be other Sync server implementations.
Thus, I would strongly suggest we start from the provider side. What is the intended developer and product experience for consumption of flags using flagd providers? If we believe that some sort of "flags namespace / flags set" concept is needed, then we should design the provider interface that makes it a first class citizen. Then, Sync API implementations will have a good spec and each can figure out how to support that.
We could still keep the selector() field, but we should probably define some rules for the semantics of it. Or perhaps, we should create a schema for it that has some fields as required and then some mechanism for custom extensions? Or, we could create additional methods in the provider, like flagSetSelector().
WDYT?
Co-authored-by: Simon Schrottner <simon.schrottner@dynatrace.com> Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
| understand) | ||
| * Good, because we can support backwards compatibility with the v0 schema | ||
| * Good, because the "null" flag set is logically treated as any other flag set, reducing overall implementation complexity. | ||
| * Bad, because there's additional complexity to support this new config schema as well as the current. |
There was a problem hiding this comment.
But it could also be done in a non-breaking way.
Flagd could still treat the source value as flagSetId/selector if the file content adheres to the v0/flags schema
| .build()); | ||
| ```` | ||
|
|
||
| * With the proposed solution the `flagSetId` should be passed to the builder as selector argument instead of the source. |
There was a problem hiding this comment.
We could also think about not introducing flagSets, but instead make selectors explicit.
E.g., something like this:
{
"$schema": "https://flagd.dev/schema/v1/selectors.json",
"selectors": {
"my-project-1": {
"metadata": {
...
},
"flags": {
"my-flag-1": {
"metadata": {
...
},
...
},
...
},
"$evaluators": {
...
}
},
"my-project-2": {
...
}
}
}With this, we'd keep our flagd vocabulary.
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
| * make sure to still support static syncs | ||
|
|
There was a problem hiding this comment.
@tangenti could you outline some of your other ideas? I'm interested in your proposals here (specifically 1. and 2.).
For our internal teams' specific purposes, we need some way of logically restricting/scoping the flags a particular client can evaluate, assuming all flags are coming from a single source. I'm open to other suggestions.
| .resolverType(Config.Evaluator.IN_PROCESS) | ||
| .host("localhost") | ||
| .port(8015) | ||
| .selector("myFlags.json") |
There was a problem hiding this comment.
Question: Would this selector be set to my-project-1 if someone were to only want to evaluate the flags under the flag set of my-project-1 in the example above which calls out the new schema structure?
|
Flag sets are just namespaces for flags, right? Not understanding why a user wants them. |
@justinabrahms Flagd might provide flags for completely different applications, with each flag having its own set flags, that should be isolated from those of other applications. even if they share the same flag keys. |
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
|
Merging this as rejected in favor of https://github.com/open-feature/flagd/blob/main/docs/architecture-decisions/duplicate-flag-keys.md |
The ADR proposes a different approach to solve the problems stated in #1634. It's quite concise and simple at the point, assuming the reviewers already have the context from the original discussions. Will add more details after the initial feedback and inputs. --------- Signed-off-by: Hugo Huang <lorqor@gmail.com>
The goal of this decision document is to establish flag sets as a first class concept in
flagd, and support the dynamic addition/update/removal of flag sets at runtime.See document for all justifications and background.
@dominikhaska @tangenti @cupofcat
Alternative proposal here: #1644 (comment)