1- OpenFeature Multi-Provider
2- ------------
1+ ## OpenFeature Multi-Provider
32
4- The Multi-Provider allows you to use multiple underlying providers as sources of flag data for the OpenFeature server SDK.
5- When a flag is being evaluated, the Multi-Provider will consult each underlying provider it is managing in order to
6- determine the final result. Different evaluation strategies can be defined to control which providers get evaluated and
3+ > [ !WARNING]
4+ > This package is deprecated.
5+ > Use [ github.com/open-feature/go-sdk/openfeature/multi] ( https://github.com/open-feature/go-sdk/tree/main/openfeature/multi ) instead.
6+
7+ The Multi-Provider allows you to use multiple underlying providers as sources of flag data for the OpenFeature server SDK.
8+ When a flag is being evaluated, the Multi-Provider will consult each underlying provider it is managing in order to
9+ determine the final result. Different evaluation strategies can be defined to control which providers get evaluated and
710which result is used.
811
9- The Multi-Provider is a powerful tool for performing migrations between flag providers, or combining multiple providers
12+ The Multi-Provider is a powerful tool for performing migrations between flag providers, or combining multiple providers
1013into a single feature flagging interface. For example:
1114
12- - ** Migration** : When migrating between two providers, you can run both in parallel under a unified flagging interface.
13- As flags are added to the new provider, the Multi-Provider will automatically find and return them, falling back to the old provider
14- if the new provider does not have
15- - ** Multiple Data Sources** : The Multi-Provider allows you to seamlessly combine many sources of flagging data, such as
16- environment variables, local files, database values and SaaS hosted feature management systems.
15+ - ** Migration** : When migrating between two providers, you can run both in parallel under a unified flagging interface.
16+ As flags are added to the new provider, the Multi-Provider will automatically find and return them, falling back to the old provider
17+ if the new provider does not have
18+ - ** Multiple Data Sources** : The Multi-Provider allows you to seamlessly combine many sources of flagging data, such as
19+ environment variables, local files, database values and SaaS hosted feature management systems.
1720
1821# Installation
1922
@@ -26,8 +29,8 @@ go get github.com/open-feature/go-sdk
2629
2730``` go
2831import (
29- " github.com/open-feature/go-sdk/openfeature"
30- mp " github.com/open-feature/go-sdk-contrib/providers/multi-provider"
32+ " github.com/open-feature/go-sdk/openfeature"
33+ mp " github.com/open-feature/go-sdk-contrib/providers/multi-provider"
3134)
3235
3336providers := make (mp.ProviderMap )
@@ -39,8 +42,8 @@ openfeature.SetProvider(provider)
3942
4043# Options
4144
42- - ` WithTimeout ` - the duration is used for the total timeout across parallel operations. If none is set it will default
43- to 5 seconds. This is not supported for ` FirstMatch ` yet, which executes sequentially
45+ - ` WithTimeout ` - the duration is used for the total timeout across parallel operations. If none is set it will default
46+ to 5 seconds. This is not supported for ` FirstMatch ` yet, which executes sequentially
4447- ` WithFallbackProvider ` - Used for setting a fallback provider for the ` Comparison ` strategy
4548- ` WithLogger ` - Provides slog support
4649
@@ -57,7 +60,7 @@ There are 3 strategies available currently:
5760
5861## First Match Strategy
5962
60- The first match strategy works by ** sequentially** calling each provider in the order that they are provided to the mutli-provider.
63+ The first match strategy works by ** sequentially** calling each provider in the order that they are provided to the mutli-provider.
6164The first provider that returns a result. It will try calling the next provider whenever it encounters a ` FLAG_NOT_FOUND `
6265error. However, if a provider returns an error other than ` FLAG_NOT_FOUND ` the provider will stop and return the default
6366value along with setting the error details if a detailed request is issued. (allow changing this behavior?)
@@ -72,7 +75,7 @@ value will be returned to the caller.
7275
7376The Comparison strategy works by calling each provider in ** parallel** . All results are collected from each provider and
7477then the resolved results are compared to each other. If they all agree then that value is returned. If not and a fallback
75- provider is specified then the fallback will be executed. If no fallback is configured then the default value will be
78+ provider is specified then the fallback will be executed. If no fallback is configured then the default value will be
7679returned. If a provider returns ` FLAG_NOT_FOUND ` that is not included in the comparison. If all providers
7780return not found then the default value is returned. Finally, if any provider returns an error other than ` FLAG_NOT_FOUND `
7881the evaluation immediately stops and that error result is returned. This strategy does NOT support ` ObjectEvaluation `
@@ -81,4 +84,4 @@ the evaluation immediately stops and that error result is returned. This strateg
8184
8285- Hooks support
8386- Event support
84- - Full slog support
87+ - Full slog support
0 commit comments