Skip to content

feat: Implement Multiprovider #668

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

jblacker
Copy link
Contributor

This PR

Adds an implementation of multi-provider for combining multiple providers into a single provider.

Related Issues

Implements #599

Notes

I implemented this based on the JavaScript version of the OpenFeature SDK. More strategies can be added at any time. Additionally, I branched off of @bbland1 so some of their commits are also part of this branch.

Follow-up Tasks

  • Implement Hooks support (although the inner provider's hooks will still be triggered)
  • Implement proper eventing support
  • Finish implementing slog support

How to test

Create multiple FeatureProviders and pass them to the NewMultiProvider method along with a strategy and any options.
Verify the results are as expected based on the strategy.

bbland1 and others added 30 commits March 8, 2025 18:40
Signed-off-by: OpenFeature Bot <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Signed-off-by: bbland1 <[email protected]>
Signed-off-by: OpenFeature Bot <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Signed-off-by: bbland1 <[email protected]>
…where it should be when strategies pushed

Signed-off-by: bbland1 <[email protected]>
…e used to define custom strategies

Signed-off-by: bbland1 <[email protected]>
…rategies similar to TS and passing that type into the provider

Signed-off-by: bbland1 <[email protected]>
jblacker added 24 commits April 23, 2025 21:34
Signed-off-by: Jordan Blacker <[email protected]>
- Rename UniqueNameProvider -> NamedProvider: More accurate description of type as it's not enforced
- Updated signature of NewMultiProvider function: Using a map enforces unique names, use options pattern & config object for future extension
- Relocated NamedProvider to strategies as it's not needed externally
- Update shape of MultiProvider: Added logging, made all fields private, used map internally
- Moved aggregate-errors into errors package
- Added alias for ProviderMap shape & added helper functions
- Use pointers since we're passing stuff around and want to avoid unnecessary clones of objects & extra garbage collection
- Updated other various signatures throughout as needed
- Update tests & remove tests that no longer apply

Signed-off-by: Jordan Blacker <[email protected]>
Signed-off-by: Jordan Blacker <[email protected]>
Also fixed some synchronization issues while I was at it

Signed-off-by: Jordan Blacker <[email protected]>
- Rewrote using multiple go-routines & channels instead of a mutex
- Added tests
- Added timeout functionality & option

Signed-off-by: Jordan Blacker <[email protected]>
Signed-off-by: Jordan Blacker <[email protected]>
Signed-off-by: Jordan Blacker <[email protected]>
@jblacker jblacker force-pushed the 599/implement-multi-provider branch from c61f457 to ff0f81f Compare April 24, 2025 01:34
@jblacker
Copy link
Contributor Author

Closing due to the branch being screwy. Reopened as #669

@jblacker jblacker closed this Apr 24, 2025
@jblacker jblacker deleted the 599/implement-multi-provider branch April 24, 2025 02:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.