You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<sub>Implemented: ✅ | In-progress: ⚠️ | Not implemented yet: ❌</sub>
111
112
@@ -142,6 +143,63 @@ Once the provider has been registered, the status can be tracked using [events](
142
143
In some situations, it may be beneficial to register multiple providers in the same application.
143
144
This is possible using [domains](#domains), which is covered in more detail below.
144
145
146
+
#### Multi-Provider
147
+
148
+
The Multi-Provider allows you to use multiple underlying providers as sources of flag data for the OpenFeature web SDK. When a flag is being evaluated, the Multi-Provider will consult each underlying provider it is managing in order to determine the final result. Different evaluation strategies can be defined to control which providers get evaluated and which result is used.
149
+
150
+
The Multi-Provider is a powerful tool for performing migrations between flag providers, or combining multiple providers into a single feature flagging interface. For example:
151
+
152
+
-**Migration**: When migrating between two providers, you can run both in parallel under a unified flagging interface. As flags are added to the new provider, the Multi-Provider will automatically find and return them, falling back to the old provider if the new provider does not have the flag.
153
+
-**Multiple Data Sources**: The Multi-Provider allows you to seamlessly combine many sources of flagging data, such as environment variables, local files, database values and SaaS hosted feature management systems.
By default, the Multi-Provider will evaluate all underlying providers in order and return the first successful result. If a provider indicates it does not have a flag (FLAG_NOT_FOUND error code), then it will be skipped and the next provider will be evaluated.
170
+
171
+
##### Evaluation Strategies
172
+
173
+
The Multi-Provider comes with three strategies out of the box:
174
+
175
+
-**FirstMatchStrategy** (default): Evaluates all providers in order and returns the first successful result. Providers that indicate FLAG_NOT_FOUND error will be skipped and the next provider will be evaluated.
176
+
-**FirstSuccessfulStrategy**: Evaluates all providers in order and returns the first successful result. Any error will cause that provider to be skipped.
177
+
-**ComparisonStrategy**: Evaluates all providers sequentially. If every provider returns a successful result with the same value, then that result is returned. Otherwise, the result returned by the configured "fallback provider" will be used.
The Multi-Provider supports tracking events across multiple providers, allowing you to send analytics events to all configured providers simultaneously:
194
+
195
+
```ts
196
+
// Tracked events will be sent to all providers by default
197
+
client.track('user-conversion', {
198
+
value: 99.99,
199
+
currency: 'USD'
200
+
});
201
+
```
202
+
145
203
### Flag evaluation flow
146
204
147
205
When a new provider is added to OpenFeature client the following process happens:
@@ -442,10 +442,12 @@ Built a new hook? [Let us know](https://github.com/open-feature/openfeature.dev/
442
442
### Multi-Provider
443
443
444
444
> [!NOTE]
445
-
> The Multi-Provider feature is currently experimental. Hooks and events are not supported at the moment.
445
+
> The Multi-Provider feature is currently experimental.
446
446
447
447
The Multi-Provider enables the use of multiple underlying feature flag providers simultaneously, allowing different providers to be used for different flag keys or based on specific evaluation strategies.
448
448
449
+
The Multi-Provider supports provider hooks and executes them in accordance with the OpenFeature specification. Each provider's hooks are executed with context isolation, ensuring that context modifications by one provider's hooks do not affect other providers.
450
+
449
451
#### Basic Usage
450
452
451
453
```csharp
@@ -523,23 +525,20 @@ The Multi-Provider supports two evaluation modes:
523
525
524
526
#### Limitations
525
527
526
-
-**Hooks are not supported**: Multi-Provider does not currently support hook registration or execution
527
-
-**Events are not supported**: Provider events are not propagated from underlying providers
528
-
-**Experimental status**: The API may change in future releases
528
+
-**Experimental status**: The API may change in future releases
529
529
530
530
For a complete example, see the [AspNetCore sample](https://github.com/open-feature/dotnet-sdk/blob/main/samples/AspNetCore/README.md) which demonstrates Multi-Provider usage.
531
531
532
532
### Dependency Injection
533
533
534
534
> [!NOTE]
535
-
> The OpenFeature.DependencyInjection and OpenFeature.Hosting packages are currently experimental. They streamline the integration of OpenFeature within .NET applications, allowing for seamless configuration and lifecycle management of feature flag providers using dependency injection and hosting services.
535
+
> The OpenFeature.Hosting package is currently experimental. The Hosting package streamlines the integration of OpenFeature within .NET applications, allowing for seamless configuration and lifecycle management of feature flag providers using dependency injection and hosting services.
536
536
537
537
#### Installation
538
538
539
-
To set up dependency injection and hosting capabilities for OpenFeature, install the following packages:
539
+
To set up dependency injection and hosting capabilities for OpenFeature, install the following package:
0 commit comments