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
* feat: implement MultiProvider class with placeholder methods for feature resolution
Signed-off-by: André Silva <[email protected]>
* feat: add BaseEvaluationStrategy and MultiProvider classes for multi-provider feature flag evaluation
Signed-off-by: André Silva <[email protected]>
* feat: implement MultiProvider methods for feature flag resolution using evaluation strategy
Signed-off-by: André Silva <[email protected]>
* feat: add ComparisonStrategy, FirstMatchStrategy, and FirstSuccessfulStrategy classes for feature flag evaluation
Signed-off-by: André Silva <[email protected]>
* feat: implement EvaluateAsync method in FirstMatchStrategy for type-specific feature resolution
Signed-off-by: André Silva <[email protected]>
* feat: enhance error handling in FirstMatchStrategy for feature flag resolution
Signed-off-by: André Silva <[email protected]>
* feat: implement EvaluateAsync method in FirstSuccessfulStrategy for multi-type feature resolution
Signed-off-by: André Silva <[email protected]>
* feat: refactor feature resolution strategies to use EvaluateAsync method for improved multi-provider support
Signed-off-by: André Silva <[email protected]>
* Removed ComparisonStrategy.cs
Signed-off-by: André Silva <[email protected]>
* feat: add unit tests for FirstMatchStrategy and FirstSuccessfulStrategy to enhance multi-provider support
Signed-off-by: André Silva <[email protected]>
* feat: add unit tests for FirstSuccessfulStrategy to validate multi-provider evaluation logic
Signed-off-by: André Silva <[email protected]>
* feat: add unit tests for MultiProvider and ProviderExtensions to validate multi-provider functionality
Signed-off-by: André Silva <[email protected]>
* feat: add unit tests for MultiProvider to validate functionality and strategy delegation
Signed-off-by: André Silva <[email protected]>
* fix: update GetMetadata method to return non-nullable Metadata type
Signed-off-by: André Silva <[email protected]>
* feat: implement ShutdownAsync method to gracefully shut down all providers
Signed-off-by: André Silva <[email protected]>
* feat: implement InitializeAsync method to initialize all providers
Signed-off-by: André Silva <[email protected]>
* Move to Extensions folder
Signed-off-by: André Silva <[email protected]>
* test: add initialization and shutdown tests for MultiProvider
Signed-off-by: André Silva <[email protected]>
* fix: enhance ShutdownAsync to handle exceptions from multiple providers
Signed-off-by: André Silva <[email protected]>
* feat: implement ComparisonStrategy for evaluating provider values with fallback and mismatch handling
Signed-off-by: André Silva <[email protected]>
* feat: add constructor to MultiProvider for default evaluation strategy
Signed-off-by: André Silva <[email protected]>
* refactor: update ComparisonStrategy and MultiProviderTests for improved clarity and consistency
Signed-off-by: André Silva <[email protected]>
* refactor: rename namespaces from OpenFeature.Extensions.MultiProvider to OpenFeature.Providers.MultiProvider
Signed-off-by: André Silva <[email protected]>
* Removed old files
Signed-off-by: André Silva <[email protected]>
* feat: add multi-provider support with evaluation strategies
Signed-off-by: André Silva <[email protected]>
* Revert "Move to Extensions folder"
This reverts commit 9ffd149.
Signed-off-by: André Silva <[email protected]>
* refactor: use 'this' keyword for clarity in constructors across multiple models
Signed-off-by: André Silva <[email protected]>
* fix: add missing space in ProviderStatus exception handling for consistency
Signed-off-by: André Silva <[email protected]>
* feat: enhance ProviderResolutionResult to include exception details in resolution results
Signed-off-by: André Silva <[email protected]>
* feat: add error collection method and refine ProviderError to use Exception type
Signed-off-by: André Silva <[email protected]>
* refactor: simplify error handling in FirstMatchStrategy and FirstSuccessfulStrategy
Signed-off-by: André Silva <[email protected]>
* test: add unit tests for FirstSuccessfulStrategy behavior and result determination
Signed-off-by: André Silva <[email protected]>
* test: add unit tests for FirstMatchStrategy behavior and result determination
Signed-off-by: André Silva <[email protected]>
* test: simplify tests
Signed-off-by: André Silva <[email protected]>
* test: add unit tests for ComparisonStrategy RunMode behavior
Signed-off-by: André Silva <[email protected]>
* test: add unit tests for ComparisonStrategy functionality
Signed-off-by: André Silva <[email protected]>
* test: add unit tests for ProviderEntry, ProviderStatus, and RegisteredProvider classes
Signed-off-by: André Silva <[email protected]>
* test: add unit tests for FinalResult and ProviderError classes
Signed-off-by: André Silva <[email protected]>
* test: add unit tests for ProviderExtensions functionality
Signed-off-by: André Silva <[email protected]>
* test: add unit tests for MultiProvider functionality
Signed-off-by: André Silva <[email protected]>
* test: add unit tests for BaseEvaluationStrategy functionality
Signed-off-by: André Silva <[email protected]>
* test: add multi-provider endpoint and evaluation logic
Signed-off-by: André Silva <[email protected]>
* refactor: update RegisteredProvider to use internal access modifiers and enhance status management; add unit test for SetStatus method
Signed-off-by: André Silva <[email protected]>
* docs: add Multi-Provider section to README with usage examples and evaluation strategies
Signed-off-by: André Silva <[email protected]>
* refactor: change properties in StrategyPerProviderContext to use read-only accessors
Signed-off-by: André Silva <[email protected]>
* docs: update summary comments in FirstMatchStrategy and FirstSuccessfulStrategy to clarify provider evaluation order
Signed-off-by: André Silva <[email protected]>
* Refactor StrategyEvaluationContext to use generic types
Signed-off-by: André Silva <[email protected]>
* refactor: simplify flag resolution logic in EvaluateAsync method
Signed-off-by: André Silva <[email protected]>
* refactor: replace hardcoded provider name with constant in MultiProvider strategies
Signed-off-by: André Silva <[email protected]>
* refactor: Rename Exception property to Error in ProviderStatus class
Signed-off-by: André Silva <[email protected]>
* feat: Improved the thread safety for Multiprovider.
Signed-off-by: André Silva <[email protected]>
* fix: Update exception object name in MultiProvider tests
Signed-off-by: André Silva <[email protected]>
* fix: Update ObjectDisposedException object name in MultiProvider tests
Signed-off-by: André Silva <[email protected]>
* fix: Remove volatile modifier from status fields in RegisteredProvider and MultiProvider
Signed-off-by: André Silva <[email protected]>
* docs: Clarify evaluation strategy parameter description in MultiProvider constructor
Signed-off-by: André Silva <[email protected]>
* fix: Update shutdown logic to allow shutdown in Ready or Fatal status and add corresponding tests
Signed-off-by: André Silva <[email protected]>
* refactor: Move fallback provider resolution logic to a more appropriate location in ComparisonStrategy
Signed-off-by: André Silva <[email protected]>
* fix: Simplify multi-provider endpoint response and improve error handling
Signed-off-by: André Silva <[email protected]>
* fix: Improve dispose pattern handling in MultiProvider to ensure correct async initialization and shutdown
Signed-off-by: André Silva <[email protected]>
* fix: Mark _disposed as volatile to ensure thread-safe access in async methods
Signed-off-by: André Silva <[email protected]>
* fix: Update MultiProvider to implement IAsyncDisposable and improve dispose pattern handling
Signed-off-by: André Silva <[email protected]>
---------
Signed-off-by: André Silva <[email protected]>
Copy file name to clipboardExpand all lines: README.md
+92-1Lines changed: 92 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -113,7 +113,8 @@ Want to contribute a new sample? See our [CONTRIBUTING](CONTRIBUTING.md) guide!
113
113
| ✅ | [Shutdown](#shutdown) | Gracefully clean up a provider during application shutdown. |
114
114
| ✅ | [Transaction Context Propagation](#transaction-context-propagation) | Set a specific [evaluation context](https://openfeature.dev/docs/reference/concepts/evaluation-context) for a transaction (e.g. an HTTP request or a thread). |
115
115
| ✅ | [Extending](#extending) | Extend OpenFeature with custom providers and hooks. |
116
-
| 🔬 | [DependencyInjection](#dependency-injection) | Integrate OpenFeature with .NET's dependency injection for streamlined provider setup. |
116
+
| 🔬 | [Multi-Provider](#multi-provider) | Use multiple feature flag providers simultaneously with configurable evaluation strategies. |
117
+
| 🔬 | [DependencyInjection](#dependency-injection) | Integrate OpenFeature with .NET's dependency injection for streamlined provider setup. |
@@ -433,6 +434,96 @@ Hooks support passing per-evaluation data between that stages using `hook data`.
433
434
434
435
Built a new hook? [Let us know](https://github.com/open-feature/openfeature.dev/issues/new?assignees=&labels=hook&projects=&template=document-hook.yaml&title=%5BHook%5D%3A+) so we can add it to the docs!
435
436
437
+
### Multi-Provider
438
+
439
+
> [!NOTE]
440
+
> The Multi-Provider feature is currently experimental. Hooks and events are not supported at the moment.
441
+
442
+
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.
443
+
444
+
#### Basic Usage
445
+
446
+
```csharp
447
+
using OpenFeature.Providers.MultiProvider;
448
+
using OpenFeature.Providers.MultiProvider.Models;
449
+
using OpenFeature.Providers.MultiProvider.Strategies;
// Use normally - the multi-provider will handle delegation
465
+
var client = Api.Instance.GetClient();
466
+
var flagValue = await client.GetBooleanValueAsync("my-flag", false);
467
+
```
468
+
469
+
#### Evaluation Strategies
470
+
471
+
The Multi-Provider supports different evaluation strategies that determine how multiple providers are used:
472
+
473
+
##### FirstMatchStrategy (Default)
474
+
475
+
Evaluates providers sequentially and returns the first result that is not "flag not found". If any provider returns an error, that error is returned immediately.
476
+
477
+
```csharp
478
+
var multiProvider = new MultiProvider(providerEntries, new FirstMatchStrategy());
479
+
```
480
+
481
+
##### FirstSuccessfulStrategy
482
+
483
+
Evaluates providers sequentially and returns the first successful result, ignoring errors. Only if all providers fail will errors be returned.
484
+
485
+
```csharp
486
+
var multiProvider = new MultiProvider(providerEntries, new FirstSuccessfulStrategy());
487
+
```
488
+
489
+
##### ComparisonStrategy
490
+
491
+
Evaluates all providers in parallel and compares results. If values agree, returns the agreed value. If they disagree, returns the fallback provider's value (or first provider if no fallback is specified) and optionally calls a mismatch callback.
492
+
493
+
```csharp
494
+
// Basic comparison
495
+
var multiProvider = new MultiProvider(providerEntries, new ComparisonStrategy());
496
+
497
+
// With fallback provider
498
+
var multiProvider = new MultiProvider(providerEntries,
499
+
new ComparisonStrategy(fallbackProvider: provider1));
500
+
501
+
// With mismatch callback
502
+
var multiProvider = new MultiProvider(providerEntries,
503
+
new ComparisonStrategy(onMismatch: (mismatchDetails) => {
0 commit comments