Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: open-feature/go-sdk-contrib
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 76560f12c9862316b0ca5a1e429a5111306ba709
Choose a base ref
..
head repository: open-feature/go-sdk-contrib
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 05b9c11dc4723f0c80fae78e8bf03f83e7018fda
Choose a head ref
6 changes: 3 additions & 3 deletions providers/go-feature-flag/pkg/controller/goff_api.go
Original file line number Diff line number Diff line change
@@ -22,8 +22,8 @@ type GoFeatureFlagApiOptions struct {
// (This feature is available only if you are using GO Feature Flag relay proxy v1.7.0 or above)
// Default: null
APIKey string
// Metadata (optional) If we set metadata, it will be sent with every data collection requests along with the events.
Metadata map[string]interface{}
// ExporterMetadata (optional) If we set metadata, it will be sent with every data collection requests along with the events.
ExporterMetadata map[string]interface{}
}

type GoFeatureFlagAPI struct {
@@ -44,7 +44,7 @@ func (g *GoFeatureFlagAPI) CollectData(events []model.FeatureEvent) error {

reqBody := model.DataCollectorRequest{
Events: events,
Meta: g.options.Metadata,
Meta: g.options.ExporterMetadata,
}

jsonData, err := json.Marshal(reqBody)
12 changes: 6 additions & 6 deletions providers/go-feature-flag/pkg/controller/goff_api_test.go
Original file line number Diff line number Diff line change
@@ -28,9 +28,9 @@ func Test_CollectDataAPI(t *testing.T) {
name: "Valid api call",
wantErr: assert.NoError,
options: controller.GoFeatureFlagApiOptions{
Endpoint: "http://localhost:1031",
APIKey: "",
Metadata: map[string]interface{}{"openfeature": true, "provider": "go"},
Endpoint: "http://localhost:1031",
APIKey: "",
ExporterMetadata: map[string]interface{}{"openfeature": true, "provider": "go"},
},
events: []model.FeatureEvent{
{
@@ -75,9 +75,9 @@ func Test_CollectDataAPI(t *testing.T) {
name: "Valid api call with API Key",
wantErr: assert.NoError,
options: controller.GoFeatureFlagApiOptions{
Endpoint: "http://localhost:1031",
APIKey: "my-key",
Metadata: map[string]interface{}{"openfeature": true, "provider": "go"},
Endpoint: "http://localhost:1031",
APIKey: "my-key",
ExporterMetadata: map[string]interface{}{"openfeature": true, "provider": "go"},
},
events: []model.FeatureEvent{
{
8 changes: 4 additions & 4 deletions providers/go-feature-flag/pkg/provider.go
Original file line number Diff line number Diff line change
@@ -62,10 +62,10 @@ func NewProviderWithContext(ctx context.Context, options ProviderOptions) (*Prov
options.ExporterMetadata["openfeature"] = true

goffAPI := controller.NewGoFeatureFlagAPI(controller.GoFeatureFlagApiOptions{
Endpoint: options.Endpoint,
HTTPClient: options.HTTPClient,
APIKey: options.APIKey,
Metadata: options.ExporterMetadata,
Endpoint: options.Endpoint,
HTTPClient: options.HTTPClient,
APIKey: options.APIKey,
ExporterMetadata: options.ExporterMetadata,
})
dataCollectorManager := controller.NewDataCollectorManager(
goffAPI,