feat: Add the file-based override source - #224
Draft
kinyoklion wants to merge 1 commit into
Draft
kinyoklion wants to merge 1 commit into
kinyoklion wants to merge 1 commit into
Conversation
The OVERRIDE specification defines a file-based override source that reads override entries from one or more local files and reloads them when the files change. FileOverrides.source() provides it, configured through DataSystemBuilder.overrides(...). The source accepts the file data source document format (flags, flagValues, segments) in JSON or YAML, merges the files in the configured order with the configured duplicate keys handling (fail by default, or ignore all but the first), and keeps the versions that the documents specify. A flagValues entry becomes a flag that is off and serves the value as its single variation. Change detection is polling (the default, one second by default and at minimum) or watching. A configured file that does not exist contributes no overrides. A file that exists but cannot be read or parsed fails that reload, keeps the last good overrides, logs the failure, and is retried. The initial load completes during client construction. Every applied change is logged at Info with the overrides in effect and what each file supplied. Missing file paths, a null change detection mode, or a null poll interval fail client construction. Flag overrides are currently experimental and subject to change.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This adds the file-based override source that the OVERRIDE specification defines, as
FileOverrides.source()in the integrations package, configured throughDataSystemBuilder.overrides(...):The source reads one or more JSON or YAML files in the file data source document format (
flags,flagValues,segments) in the configured order. AflagValuesentry becomes a flag that is off and serves the value as its single variation, so it evaluates with theOFFreason kind. Entries keep the versions that the documents specify.duplicateKeysHandling:FAIL(the default) fails the reload when the same key appears in more than one file;IGNOREkeeps the entry from the first configured file.changeDetection:POLLING(the default) examines each file's modification time and size on an interval;WATCHINGuses file system notifications. The two are alternatives.pollInterval: one second by default and at minimum; a smaller value is raised to the minimum with a warning.The source is built on the shared file infrastructure from the earlier change (
FileDataReloader,FileDataPoller,FileDataWatcher, and theDataLoaderoptions). Flag overrides are currently experimental and subject to change.This PR depends on the override layer and the file data reliability changes and is based on the events branch (rlamb/overrides-java-override-events); retarget it to feat/overrides once that branch merges.