Skip to content

Commit c3871c8

Browse files
erkasahidvelji
andauthored
docs(multi-provider): deprecate multiprovider package in favor of go-sdk/openfeature/multi (#792)
Signed-off-by: Roman Dmytrenko <[email protected]> Co-authored-by: Sahid Velji <[email protected]>
1 parent 805823f commit c3871c8

File tree

4 files changed

+33
-20
lines changed

4 files changed

+33
-20
lines changed

providers/multi-provider/README.md

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,22 @@
1-
OpenFeature Multi-Provider
2-
------------
1+
## OpenFeature Multi-Provider
32

4-
The Multi-Provider allows you to use multiple underlying providers as sources of flag data for the OpenFeature server SDK.
5-
When a flag is being evaluated, the Multi-Provider will consult each underlying provider it is managing in order to
6-
determine the final result. Different evaluation strategies can be defined to control which providers get evaluated and
3+
> [!WARNING]
4+
> This package is deprecated.
5+
> Use [github.com/open-feature/go-sdk/openfeature/multi](https://github.com/open-feature/go-sdk/tree/main/openfeature/multi) instead.
6+
7+
The Multi-Provider allows you to use multiple underlying providers as sources of flag data for the OpenFeature server SDK.
8+
When a flag is being evaluated, the Multi-Provider will consult each underlying provider it is managing in order to
9+
determine the final result. Different evaluation strategies can be defined to control which providers get evaluated and
710
which result is used.
811

9-
The Multi-Provider is a powerful tool for performing migrations between flag providers, or combining multiple providers
12+
The Multi-Provider is a powerful tool for performing migrations between flag providers, or combining multiple providers
1013
into a single feature flagging interface. For example:
1114

12-
- **Migration**: When migrating between two providers, you can run both in parallel under a unified flagging interface.
13-
As flags are added to the new provider, the Multi-Provider will automatically find and return them, falling back to the old provider
14-
if the new provider does not have
15-
- **Multiple Data Sources**: The Multi-Provider allows you to seamlessly combine many sources of flagging data, such as
16-
environment variables, local files, database values and SaaS hosted feature management systems.
15+
- **Migration**: When migrating between two providers, you can run both in parallel under a unified flagging interface.
16+
As flags are added to the new provider, the Multi-Provider will automatically find and return them, falling back to the old provider
17+
if the new provider does not have
18+
- **Multiple Data Sources**: The Multi-Provider allows you to seamlessly combine many sources of flagging data, such as
19+
environment variables, local files, database values and SaaS hosted feature management systems.
1720

1821
# Installation
1922

@@ -26,8 +29,8 @@ go get github.com/open-feature/go-sdk
2629

2730
```go
2831
import (
29-
"github.com/open-feature/go-sdk/openfeature"
30-
mp "github.com/open-feature/go-sdk-contrib/providers/multi-provider"
32+
"github.com/open-feature/go-sdk/openfeature"
33+
mp "github.com/open-feature/go-sdk-contrib/providers/multi-provider"
3134
)
3235

3336
providers := make(mp.ProviderMap)
@@ -39,8 +42,8 @@ openfeature.SetProvider(provider)
3942

4043
# Options
4144

42-
- `WithTimeout` - the duration is used for the total timeout across parallel operations. If none is set it will default
43-
to 5 seconds. This is not supported for `FirstMatch` yet, which executes sequentially
45+
- `WithTimeout` - the duration is used for the total timeout across parallel operations. If none is set it will default
46+
to 5 seconds. This is not supported for `FirstMatch` yet, which executes sequentially
4447
- `WithFallbackProvider` - Used for setting a fallback provider for the `Comparison` strategy
4548
- `WithLogger` - Provides slog support
4649

@@ -57,7 +60,7 @@ There are 3 strategies available currently:
5760

5861
## First Match Strategy
5962

60-
The first match strategy works by **sequentially** calling each provider in the order that they are provided to the mutli-provider.
63+
The first match strategy works by **sequentially** calling each provider in the order that they are provided to the mutli-provider.
6164
The first provider that returns a result. It will try calling the next provider whenever it encounters a `FLAG_NOT_FOUND`
6265
error. However, if a provider returns an error other than `FLAG_NOT_FOUND` the provider will stop and return the default
6366
value along with setting the error details if a detailed request is issued. (allow changing this behavior?)
@@ -72,7 +75,7 @@ value will be returned to the caller.
7275

7376
The Comparison strategy works by calling each provider in **parallel**. All results are collected from each provider and
7477
then the resolved results are compared to each other. If they all agree then that value is returned. If not and a fallback
75-
provider is specified then the fallback will be executed. If no fallback is configured then the default value will be
78+
provider is specified then the fallback will be executed. If no fallback is configured then the default value will be
7679
returned. If a provider returns `FLAG_NOT_FOUND` that is not included in the comparison. If all providers
7780
return not found then the default value is returned. Finally, if any provider returns an error other than `FLAG_NOT_FOUND`
7881
the evaluation immediately stops and that error result is returned. This strategy does NOT support `ObjectEvaluation`
@@ -81,4 +84,4 @@ the evaluation immediately stops and that error result is returned. This strateg
8184

8285
- Hooks support
8386
- Event support
84-
- Full slog support
87+
- Full slog support

providers/multi-provider/go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// Deprecated: use github.com/open-feature/go-sdk/openfeature/multi instead.
12
module github.com/open-feature/go-sdk-contrib/providers/multi-provider
23

34
go 1.24.0
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/*
2+
Package multiprovider implements a multi-provider for OpenFeature.
3+
4+
Deprecated: use github.com/open-feature/go-sdk/openfeature/multi instead.
5+
*/
6+
package multiprovider

providers/multi-provider/pkg/providers.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@ import (
44
"context"
55
"errors"
66
"fmt"
7-
"github.com/open-feature/go-sdk-contrib/providers/multi-provider/pkg/strategies"
8-
"golang.org/x/sync/errgroup"
97
"log/slog"
108
"maps"
119
"slices"
1210
"sync"
1311
"time"
1412

13+
"github.com/open-feature/go-sdk-contrib/providers/multi-provider/pkg/strategies"
14+
"golang.org/x/sync/errgroup"
15+
1516
mperr "github.com/open-feature/go-sdk-contrib/providers/multi-provider/pkg/errors"
1617

1718
of "github.com/open-feature/go-sdk/openfeature"
@@ -99,6 +100,8 @@ func (m ProviderMap) buildMetadata() of.Metadata {
99100
}
100101

101102
// NewMultiProvider returns the unified interface of multiple providers for interaction.
103+
//
104+
// Deprecated: Use multi.NewProvider() from github.com/open-feature/go-sdk/openfeature/multi instead.
102105
func NewMultiProvider(providerMap ProviderMap, evaluationStrategy EvaluationStrategy, options ...Option) (*MultiProvider, error) {
103106
if len(providerMap) == 0 {
104107
return nil, errors.New("providerMap cannot be nil or empty")

0 commit comments

Comments
 (0)