Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: erroneous warning about prop overwrite (open-feature#924)
When adding flagdProperties to the context in preparation for evaluation return a new context so that it doesn't affect any references to the current context. Without this change: ``` $ make run make run-flagd cd flagd; go run main.go start -f file:../config/samples/example_flags.flagd.json ______ __ ________ _______ ______ /_____/\ /_/\ /_______/\ /______/\ /_____/\ \::::_\/_\:\ \ \::: _ \ \\::::__\/__\:::_ \ \ \:\/___/\\:\ \ \::(_) \ \\:\ /____/\\:\ \ \ \ \:::._\/ \:\ \____\:: __ \ \\:\\_ _\/ \:\ \ \ \ \:\ \ \:\/___/\\:.\ \ \ \\:\_\ \ \ \:\/.:| | \_\/ \_____\/ \__\/\__\/ \_____\/ \____/_/ 2023-09-18T19:16:39.581-0700 info cmd/start.go:117 flagd version: dev (HEAD), built at: unknown {"component": "start"} 2023-09-18T19:16:39.581-0700 info file/filepath_sync.go:37 Starting filepath sync notifier {"component": "sync", "sync": "filepath"} 2023-09-18T19:16:39.582-0700 info flag-evaluation/connect_service.go:203 metrics and probes listening at 8014 {"component": "service"} 2023-09-18T19:16:39.582-0700 info file/filepath_sync.go:66 watching filepath: ../config/samples/example_flags.flagd.json {"component": "sync", "sync": "filepath"} 2023-09-18T19:16:39.582-0700 info flag-evaluation/connect_service.go:183 Flag Evaluation listening at [::]:8013 {"component": "service"} 2023-09-18T19:16:41.258-0700 warn eval/json_evaluator.go:368 overwriting $flagd properties in the context {"component": "evaluator", "evaluator": "json"} 2023-09-18T19:16:41.259-0700 warn eval/json_evaluator.go:368 overwriting $flagd properties in the context {"component": "evaluator", "evaluator": "json"} 2023-09-18T19:16:41.259-0700 warn eval/legacy_fractional_evaluation.go:35 fractionalEvaluation is deprecated, please use fractional, see: https://flagd.dev/concepts/#migrating-from-legacy-fractionalevaluation 2023-09-18T19:16:41.259-0700 warn eval/json_evaluator.go:368 overwriting $flagd properties in the context {"component": "evaluator", "evaluator": "json"} ``` With this change: ``` $ make run make run-flagd cd flagd; go run main.go start -f file:../config/samples/example_flags.flagd.json ______ __ ________ _______ ______ /_____/\ /_/\ /_______/\ /______/\ /_____/\ \::::_\/_\:\ \ \::: _ \ \\::::__\/__\:::_ \ \ \:\/___/\\:\ \ \::(_) \ \\:\ /____/\\:\ \ \ \ \:::._\/ \:\ \____\:: __ \ \\:\\_ _\/ \:\ \ \ \ \:\ \ \:\/___/\\:.\ \ \ \\:\_\ \ \ \:\/.:| | \_\/ \_____\/ \__\/\__\/ \_____\/ \____/_/ 2023-09-18T19:20:29.011-0700 info cmd/start.go:117 flagd version: dev (HEAD), built at: unknown {"component": "start"} 2023-09-18T19:20:29.012-0700 info file/filepath_sync.go:37 Starting filepath sync notifier {"component": "sync", "sync": "filepath"} 2023-09-18T19:20:29.013-0700 info flag-evaluation/connect_service.go:203 metrics and probes listening at 8014 {"component": "service"} 2023-09-18T19:20:29.013-0700 info flag-evaluation/connect_service.go:183 Flag Evaluation listening at [::]:8013 {"component": "service"} 2023-09-18T19:20:29.014-0700 info file/filepath_sync.go:66 watching filepath: ../config/samples/example_flags.flagd.json {"component": "sync", "sync": "filepath"} 2023-09-18T19:20:32.784-0700 warn eval/legacy_fractional_evaluation.go:35 fractionalEvaluation is deprecated, please use fractional, see: https://flagd.dev/concepts/#migrating-from-legacy-fractionalevaluation ``` Signed-off-by: Craig Pastro <[email protected]> Co-authored-by: Todd Baert <[email protected]>
- Loading branch information