Skip to content

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: bbland1 <104288486+bbland1@users.noreply.github.com>
…ders

Signed-off-by: bbland1 <104288486+bbland1@users.noreply.github.com>
Signed-off-by: bbland1 <104288486+bbland1@users.noreply.github.com>
…ize of the providers

Signed-off-by: bbland1 <104288486+bbland1@users.noreply.github.com>
Signed-off-by: bbland1 <104288486+bbland1@users.noreply.github.com>
Signed-off-by: bbland1 <104288486+bbland1@users.noreply.github.com>
Signed-off-by: bbland1 <104288486+bbland1@users.noreply.github.com>
Signed-off-by: bbland1 <104288486+bbland1@users.noreply.github.com>
Signed-off-by: bbland1 <104288486+bbland1@users.noreply.github.com>
Signed-off-by: bbland1 <104288486+bbland1@users.noreply.github.com>
Signed-off-by: bbland1 <104288486+bbland1@users.noreply.github.com>
Signed-off-by: bbland1 <104288486+bbland1@users.noreply.github.com>
Signed-off-by: Maks Osowski <maks@google.com>
Signed-off-by: bbland1 <104288486+bbland1@users.noreply.github.com>
…feature#638)

Signed-off-by: Maks Osowski <maks@google.com>
Signed-off-by: bbland1 <104288486+bbland1@users.noreply.github.com>
Signed-off-by: OpenFeature Bot <109696520+openfeaturebot@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Signed-off-by: bbland1 <104288486+bbland1@users.noreply.github.com>
open-feature#639)

Signed-off-by: aimuz <mr.imuz@gmail.com>
Co-authored-by: aimuz <mr.imuz@gmail.com>
Signed-off-by: bbland1 <104288486+bbland1@users.noreply.github.com>
Signed-off-by: Thomas Poignant <thomas.poignant@gofeatureflag.org>
Signed-off-by: bbland1 <104288486+bbland1@users.noreply.github.com>
Signed-off-by: OpenFeature Bot <109696520+openfeaturebot@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Signed-off-by: bbland1 <104288486+bbland1@users.noreply.github.com>
Signed-off-by: bbland1 <104288486+bbland1@users.noreply.github.com>
Signed-off-by: bbland1 <104288486+bbland1@users.noreply.github.com>
Signed-off-by: bbland1 <104288486+bbland1@users.noreply.github.com>
…r struct made

Signed-off-by: bbland1 <104288486+bbland1@users.noreply.github.com>
Signed-off-by: bbland1 <104288486+bbland1@users.noreply.github.com>
Signed-off-by: bbland1 <104288486+bbland1@users.noreply.github.com>
Signed-off-by: bbland1 <104288486+bbland1@users.noreply.github.com>
…where it should be when strategies pushed

Signed-off-by: bbland1 <104288486+bbland1@users.noreply.github.com>
…e used to define custom strategies

Signed-off-by: bbland1 <104288486+bbland1@users.noreply.github.com>
…rategies similar to TS and passing that type into the provider

Signed-off-by: bbland1 <104288486+bbland1@users.noreply.github.com>
Signed-off-by: OpenFeature Bot <109696520+openfeaturebot@users.noreply.github.com>
Signed-off-by: Raphael Wigoutschnigg <raphael.wigoutschnigg@dynatrace.com>
jblacker added 24 commits April 23, 2025 21:34
Signed-off-by: Jordan Blacker <jblacker@justworks.com>
Signed-off-by: Jordan Blacker <jblacker@justworks.com>
Signed-off-by: Jordan Blacker <jblacker@justworks.com>
Signed-off-by: Jordan Blacker <jblacker@justworks.com>
Signed-off-by: Jordan Blacker <jblacker@justworks.com>
Signed-off-by: Jordan Blacker <jblacker@justworks.com>
- 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 <jblacker@justworks.com>
Signed-off-by: Jordan Blacker <jblacker@justworks.com>
Signed-off-by: Jordan Blacker <jblacker@justworks.com>
Signed-off-by: Jordan Blacker <jblacker@justworks.com>
Signed-off-by: Jordan Blacker <jblacker@justworks.com>
Signed-off-by: Jordan Blacker <jblacker@justworks.com>
Signed-off-by: Jordan Blacker <jblacker@justworks.com>
Also fixed some synchronization issues while I was at it

Signed-off-by: Jordan Blacker <jblacker@justworks.com>
Signed-off-by: Jordan Blacker <jblacker@justworks.com>
Signed-off-by: Jordan Blacker <jblacker@justworks.com>
Signed-off-by: Jordan Blacker <jblacker@justworks.com>
- Rewrote using multiple go-routines & channels instead of a mutex
- Added tests
- Added timeout functionality & option

Signed-off-by: Jordan Blacker <jblacker@justworks.com>
Signed-off-by: Jordan Blacker <jblacker@justworks.com>
Signed-off-by: Jordan Blacker <jblacker@justworks.com>
Signed-off-by: Jordan Blacker <jblacker@justworks.com>
Signed-off-by: Jordan Blacker <jblacker@justworks.com>
Signed-off-by: Jordan Blacker <jblacker@justworks.com>
Signed-off-by: Jordan Blacker <jblacker@justworks.com>
@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.