Skip to content
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

Multi Provider for OpenFeature #255

Open
5 tasks
beeme1mr opened this issue Apr 25, 2024 · 6 comments
Open
5 tasks

Multi Provider for OpenFeature #255

beeme1mr opened this issue Apr 25, 2024 · 6 comments

Comments

@beeme1mr
Copy link
Member

beeme1mr commented Apr 25, 2024

Overview

A multi provider acts as a unified abstraction layer, allowing developers to consolidate feature flag access through a single API. With a multi provider, developers can simultaneously support multiple providers, making it easier to migrate between them.

Requirements

Tasks

Resources

Ideas

  • Flag metadata could be used to understand what provider was used to resolve the flag value
  • Debug logging could be offloaded to an optional hook
  • Extend appendix-a to include a section on the meta provider
  • Leverage the evaluation details returned by the provider.

Pseudo code

OpenFeature.setProvider(
  new MetaProvider([
    new EnvVarProvider(),
    new DbProvider(),
    new NextGenProvider3000(),
  ])
)

Questions

  • Should the meta provider live in the SDK or the contribs repo?
  • Can the meta provider support provider hooks?
  • What strategies should be supported out of the box?
  • How should we handle provider events?

Prior art

@federicobond
Copy link
Member

One key detail that came up when I did a PoC of an aggregated provider like this is how to handle provider events (and lifecycle) outside of the main provider registry (using SDK-specific, not spec terminology here).

Providers can emit events spontaneously and these events will have to be routed through the meta provider before bubbling to the main SDK event handling code, as they would belong to an unregistered provider.

It's hard to avoid this because events are necessary to properly keep track of each provider status. SDKs might want to provide a standard implementation of such a provider lifecycle manager to ease the writing of aggregated providers and ensure consistency in handling events and status changes.

@weyert
Copy link
Contributor

weyert commented Apr 26, 2024

I like the idea of this provider but I am not super excited about the name of it. It's pretty meta (🤭)

For OpenTelemetry I have a similar thing for the exporters so it sends it both to otel-collector and Stackdriver and I could this the CompositeExporter.

Maybe some naming similar to that might be more clarifying?

@maxveldink
Copy link
Member

Meta was a better name than multiple_source from my original implementation 😂 But, I do like the idea of composite and am open to other name ideas too.

The only strategy currently implemented in the Ruby contrib is first_match, which short-circuits when we get a successful resolution details match from a provider. The other one I'm immediately thinking about is one that evaluates all providers (so logging hooks can be executed) for a flag and allows specifying a precedence order. Those are the two most important use cases I can foresee.

@markphelps
Copy link

👋🏻 just throwing my two cents re: naming. I also like CompositeProvider

Another idea: MultiProvider like io.MultiReader in Go

@federicobond
Copy link
Member

federicobond commented May 4, 2024

I think we need to dig into the specific scenarios or use cases before we decide on naming because we can very well be talking about different provider implementations altogether.

For example, a CompareProvider (a provider that registers differences between the evaluation results of two different providers may be orthogonal to (and composable with) a StackProvider (a provider that returns the first match from a stack of providers.

@lukas-reining
Copy link
Member

I think we need to dig into the specific scenarios or use cases before we decide on naming because we can very well be talking about different provider implementations altogether.

I am with you @federicobond. Having this would maybe make it more clear and also delimit it from other not "in-scope" use cases.

@beeme1mr beeme1mr changed the title Meta Provider for OpenFeature Multi Provider for OpenFeature May 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants