-
Notifications
You must be signed in to change notification settings - Fork 87
Closed
Labels
Description
Observed behavior
flagd supports selectors, so separate flags into different buckets, eg. each file source, http source, etc, is its own selector.
If flagd is started with multiple sources, the selector
param can be used to evaluate/sync only the set of flags from the source in question:
Example
{
"flags": {
"flagb": {
"state": "ENABLED",
"variants": {
"foo": "foo",
"bar": "bar"
},
"defaultVariant": "foo"
}
},
"metadata": {
"flagSetId": "b"
}
}
{
"flags": {
"flaga": {
"state": "ENABLED",
"variants": {
"foo": "foo",
"bar": "bar"
},
"defaultVariant": "foo"
}
},
"metadata": {
"flagSetId": "a"
}
}
start flagd with those two files as sources:
docker run \
--rm -it \
--name flagd \
-p 8015:8015 \
-v $(pwd):/flags \
ghcr.io/open-feature/flagd:latest start \
--uri file:./flags/a.json \
--uri file:./flags/b.json
for a.json
grpcurl -import-path <path-to-sync-proto-dir> -proto sync.proto -plaintext -d '{"selector":"./flags/b.json"}' localhost:8015 flagd.sync.v1.FlagSyncService/FetchAllFlags
and for b.json
grpcurl -import-path <path-to-sync-proto-dir> -proto sync.proto -plaintext -d '{"selector":"./flags/a.json"}' localhost:8015 flagd.sync.v1.FlagSyncService/FetchAllFlags
and for both (no selector):
grpcurl -import-path <path-to-sync-proto-dir> -proto sync.proto -plaintext localhost:8015 flagd.sync.v1.FlagSyncService/FetchAllFlags
This is effective, however, it requires API users to have knowledge of the sources, and means that if a source location is changed, often, application code needs to be changed accordingly (brittle!).
Instead, the selector should work on a logical identifier for a flag set, the flagSetId, which can be maintained separately from the source.
Definition of Done:
- flagSetId is used to select flag sets, not the source
- updated documentation
- discuss whether or not this should be done in a non-breaking way
aepfli
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Pending