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

[FSSDK-8584] chore: prepare for release v2.0.0 #386

Merged
merged 5 commits into from
Jan 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions CHANGELOG.MD
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,60 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
## [Unreleased]
Changes that have landed but are not yet released.

## [2.0.0] - January 19th, 2024

### New Features

The 2.0.0 release introduces a new primary feature, [Advanced Audience Targeting]( https://docs.developers.optimizely.com/feature-experimentation/docs/optimizely-data-platform-advanced-audience-targeting) enabled through integration with [Optimizely Data Platform (ODP)](https://docs.developers.optimizely.com/optimizely-data-platform/docs) ([#350](https://github.com/optimizely/go-sdk/pull/350), [#353](https://github.com/optimizely/go-sdk/pull/353), [#354](https://github.com/optimizely/go-sdk/pull/354), [#355](https://github.com/optimizely/go-sdk/pull/355)).

You can use ODP, a high-performance [Customer Data Platform (CDP)]( https://www.optimizely.com/optimization-glossary/customer-data-platform/), to easily create complex real-time segments (RTS) using first-party and 50+ third-party data sources out of the box. You can create custom schemas that support the user attributes important for your business, and stitch together user behavior done on different devices to better understand and target your customers for personalized user experiences. ODP can be used as a single source of truth for these segments in any Optimizely or 3rd party tool.

With ODP accounts integrated into Optimizely projects, you can build audiences using segments pre-defined in ODP. The SDK will fetch the segments for given users and make decisions using the segments. For access to ODP audience targeting in your Feature Experimentation account, please contact your Optimizely Customer Success Manager.

This version includes the following changes:

* New API added to `OptimizelyUserContext`:

- `FetchQualifiedSegments()`: this API will retrieve user segments from the ODP server. The fetched segments will be used for audience evaluation. The fetched data will be stored in the local cache to avoid repeated network delays.

- When an `OptimizelyUserContext` is created, the SDK will automatically send an identify request to the ODP server to facilitate observing user activities.

* New APIs added to `OptimizelyClient`:

- `SendOdpEvent()`: customers can build/send arbitrary ODP events that will bind user identifiers and data to user profiles in ODP.

For details, refer to our documentation pages:

* [Advanced Audience Targeting](https://docs.developers.optimizely.com/feature-experimentation/docs/optimizely-data-platform-advanced-audience-targeting)

* [Server SDK Support](https://docs.developers.optimizely.com/feature-experimentation/v1.0/docs/advanced-audience-targeting-for-server-side-sdks)

* [Initialize Go SDK](https://docs.developers.optimizely.com/feature-experimentation/docs/initialize-sdk-go)

* [OptimizelyUserContext Go SDK](https://docs.developers.optimizely.com/feature-experimentation/docs/optimizelyusercontext-go)

* [Advanced Audience Targeting segment qualification methods](https://docs.developers.optimizely.com/feature-experimentation/v1.0/docs/advanced-audience-targeting-segment-qualification-methods-go)

* [Send Optimizely Data Platform data using Advanced Audience Targeting](https://docs.developers.optimizely.com/feature-experimentation/v1.0/docs/send-odp-data-using-advanced-audience-targeting-go)

### Breaking Changes

* ODPManager in the SDK is enabled by default. Unless an ODP account is integrated into the Optimizely projects, most ODPManager functions will be ignored. If needed, ODPManager can be disabled when `OptimizelyClient` is instantiated.
* Minimum golang version changed from 1.13 to 1.21.0. ([#369](https://github.com/optimizely/go-sdk/pull/369), [#380](https://github.com/optimizely/go-sdk/pull/380))

### Bug Fixes
* Logged correct error message in HTTP requests. ([#374](https://github.com/optimizely/go-sdk/pull/374))
* Stopped all tickers to prevent goroutine leak. ([#375](https://github.com/optimizely/go-sdk/pull/375)).
* Client is closed gracefully to dispatch queued events. ([#376](https://github.com/optimizely/go-sdk/pull/376))
* Convert warning into error log for SyncConfig failure. ([#383](https://github.com/optimizely/go-sdk/pull/383))

### Functionality Enhancement
* Github issue template is updated. ([#379](https://github.com/optimizely/go-sdk/pull/379))
* Helper function for passing notification center is added. ([#381](https://github.com/optimizely/go-sdk/pull/381))
* OpenTelemetry tracing support is added. ([#385](https://github.com/optimizely/go-sdk/pull/385))
- New ClientOptionFunc `WithTracer()` is added to initiate `OptimizelyClient` with OpenTelemetry tracer.
- New method `WithTraceContext()` is added to `OptimizelyClient` to set the trace context before calling APIs.

## [1.8.5] - October 5th, 2023

* Fixed a bug in the HTTP Requester logging. Now correct error message is logged. ([#374](https://github.com/optimizely/go-sdk/pull/374))
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright 2016-2017, Optimizely, Inc. and contributors
Copyright 2016 Optimizely, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
32 changes: 21 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,26 @@ Refer to the [Go SDK's developer documentation](https://docs.developers.optimize

### Requirements

Requires Golang version 1.19 or higher.
Requires Golang version:

| SDK Version | Required Golang Version |
|--------------|--------------------------|
| v2.0.0 | 1.21.0 or higher |
| < v2.0.0 | 1.13 or higher |


### Install the SDK

#### Install from github:

```$sh
go get github.com/optimizely/go-sdk
go get github.com/optimizely/go-sdk/v2
```

#### Install from source:
```$sh
go get github.com/optimizely/go-sdk
cd $GOPATH/src/github.com/optimizely/go-sdk
go get github.com/optimizely/go-sdk/v2
cd $GOPATH/src/github.com/optimizely/go-sdk/v2
go install
```

Expand All @@ -44,23 +50,23 @@ module mymodule
go 1.21.0

require (
github.com/optimizely/go-sdk v2.0.0-beta
github.com/optimizely/go-sdk/v2 v2.0.0
mikechu-optimizely marked this conversation as resolved.
Show resolved Hide resolved
)
```

If you are already using `go.mod` in your application you can run the following:

```
go mod edit -require github.com/optimizely/[email protected]-beta
go mod edit -require github.com/optimizely/go-sdk/v2@v2.0.0
```

NOTE:
```$sh
go get github.com/optimizely/go-sdk/...
go get github.com/optimizely/go-sdk/v2/...
```
or
```$sh
go get github.com/optimizely/go-sdk/pkg
go get github.com/optimizely/go-sdk/v2/pkg
```
will install it as a package to pkg directory, rather than src directory. It could be useful for future development and vendoring.

Expand All @@ -72,8 +78,8 @@ See the example file in examples/main.go.
### Initialization

```
import optly "github.com/optimizely/go-sdk"
import "github.com/optimizely/go-sdk/client"
import optly "github.com/optimizely/go-sdk/v2"
import "github.com/optimizely/go-sdk/v2/client"

// Simple one-line initialization with the SDK key   
optlyClient, err := optly.Client("SDK_KEY")   
Expand All @@ -87,7 +93,7 @@ optlyClient, err = optimizelyFactory.Client()
### Make Decisions
```
import (
optly "github.com/optimizely/go-sdk"
optly "github.com/optimizely/go-sdk/v2"
)

// instantiate a client
Expand Down Expand Up @@ -161,6 +167,10 @@ sync
Copyright (c) 2009 The Go Authors. All rights reserved.
https://github.com/golang/sync/blob/master/LICENSE

opentelemetry-go
Copyright The OpenTelemetry Authors
License (Apache-2.0): https://github.com/open-telemetry/opentelemetry-go/blob/main/LICENSE

### Other Optimizely SDKs

- Agent - https://github.com/optimizely/agent
Expand Down
6 changes: 3 additions & 3 deletions examples/benchmark/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import (

"github.com/pkg/profile"

"github.com/optimizely/go-sdk/pkg/client"
"github.com/optimizely/go-sdk/pkg/decision"
"github.com/optimizely/go-sdk/pkg/entities"
"github.com/optimizely/go-sdk/v2/pkg/client"
"github.com/optimizely/go-sdk/v2/pkg/decision"
"github.com/optimizely/go-sdk/v2/pkg/entities"
mikechu-optimizely marked this conversation as resolved.
Show resolved Hide resolved
)

func stressTest() {
Expand Down
8 changes: 4 additions & 4 deletions examples/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import (
"fmt"
"time"

optimizely "github.com/optimizely/go-sdk"
"github.com/optimizely/go-sdk/pkg/client"
"github.com/optimizely/go-sdk/pkg/event"
"github.com/optimizely/go-sdk/pkg/logging"
optimizely "github.com/optimizely/go-sdk/v2"
"github.com/optimizely/go-sdk/v2/pkg/client"
"github.com/optimizely/go-sdk/v2/pkg/event"
"github.com/optimizely/go-sdk/v2/pkg/logging"
)

func main() {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/optimizely/go-sdk
module github.com/optimizely/go-sdk/v2

go 1.21.0

Expand Down
4 changes: 2 additions & 2 deletions optimizely.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
package optimizely

import (
"github.com/optimizely/go-sdk/pkg/client"
"github.com/optimizely/go-sdk/pkg/entities"
"github.com/optimizely/go-sdk/v2/pkg/client"
"github.com/optimizely/go-sdk/v2/pkg/entities"
)

// Client returns an OptimizelyClient instantiated with the given key and options
Expand Down
28 changes: 14 additions & 14 deletions pkg/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,20 @@ import (

"github.com/hashicorp/go-multierror"

"github.com/optimizely/go-sdk/pkg/config"
"github.com/optimizely/go-sdk/pkg/decide"
"github.com/optimizely/go-sdk/pkg/decision"
pkgReasons "github.com/optimizely/go-sdk/pkg/decision/reasons"
"github.com/optimizely/go-sdk/pkg/entities"
"github.com/optimizely/go-sdk/pkg/event"
"github.com/optimizely/go-sdk/pkg/logging"
"github.com/optimizely/go-sdk/pkg/notification"
"github.com/optimizely/go-sdk/pkg/odp"
pkgOdpSegment "github.com/optimizely/go-sdk/pkg/odp/segment"
pkgOdpUtils "github.com/optimizely/go-sdk/pkg/odp/utils"
"github.com/optimizely/go-sdk/pkg/optimizelyjson"
"github.com/optimizely/go-sdk/pkg/tracing"
"github.com/optimizely/go-sdk/pkg/utils"
"github.com/optimizely/go-sdk/v2/pkg/config"
"github.com/optimizely/go-sdk/v2/pkg/decide"
"github.com/optimizely/go-sdk/v2/pkg/decision"
pkgReasons "github.com/optimizely/go-sdk/v2/pkg/decision/reasons"
"github.com/optimizely/go-sdk/v2/pkg/entities"
"github.com/optimizely/go-sdk/v2/pkg/event"
"github.com/optimizely/go-sdk/v2/pkg/logging"
"github.com/optimizely/go-sdk/v2/pkg/notification"
"github.com/optimizely/go-sdk/v2/pkg/odp"
pkgOdpSegment "github.com/optimizely/go-sdk/v2/pkg/odp/segment"
pkgOdpUtils "github.com/optimizely/go-sdk/v2/pkg/odp/utils"
"github.com/optimizely/go-sdk/v2/pkg/optimizelyjson"
"github.com/optimizely/go-sdk/v2/pkg/tracing"
"github.com/optimizely/go-sdk/v2/pkg/utils"
)

const (
Expand Down
24 changes: 12 additions & 12 deletions pkg/client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,18 @@ import (
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/suite"

"github.com/optimizely/go-sdk/pkg/config"
"github.com/optimizely/go-sdk/pkg/decide"
"github.com/optimizely/go-sdk/pkg/decision"
"github.com/optimizely/go-sdk/pkg/entities"
"github.com/optimizely/go-sdk/pkg/event"
"github.com/optimizely/go-sdk/pkg/logging"
"github.com/optimizely/go-sdk/pkg/notification"
"github.com/optimizely/go-sdk/pkg/odp"
"github.com/optimizely/go-sdk/pkg/odp/segment"
pkgOdpUtils "github.com/optimizely/go-sdk/pkg/odp/utils"
"github.com/optimizely/go-sdk/pkg/tracing"
"github.com/optimizely/go-sdk/pkg/utils"
"github.com/optimizely/go-sdk/v2/pkg/config"
"github.com/optimizely/go-sdk/v2/pkg/decide"
"github.com/optimizely/go-sdk/v2/pkg/decision"
"github.com/optimizely/go-sdk/v2/pkg/entities"
"github.com/optimizely/go-sdk/v2/pkg/event"
"github.com/optimizely/go-sdk/v2/pkg/logging"
"github.com/optimizely/go-sdk/v2/pkg/notification"
"github.com/optimizely/go-sdk/v2/pkg/odp"
"github.com/optimizely/go-sdk/v2/pkg/odp/segment"
pkgOdpUtils "github.com/optimizely/go-sdk/v2/pkg/odp/utils"
"github.com/optimizely/go-sdk/v2/pkg/tracing"
"github.com/optimizely/go-sdk/v2/pkg/utils"
)

func ValidProjectConfigManager() *MockProjectConfigManager {
Expand Down
24 changes: 12 additions & 12 deletions pkg/client/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,18 @@ import (
"errors"
"time"

"github.com/optimizely/go-sdk/pkg/config"
"github.com/optimizely/go-sdk/pkg/decide"
"github.com/optimizely/go-sdk/pkg/decision"
"github.com/optimizely/go-sdk/pkg/event"
"github.com/optimizely/go-sdk/pkg/logging"
"github.com/optimizely/go-sdk/pkg/metrics"
"github.com/optimizely/go-sdk/pkg/notification"
"github.com/optimizely/go-sdk/pkg/odp"
pkgUtils "github.com/optimizely/go-sdk/pkg/odp/utils"
"github.com/optimizely/go-sdk/pkg/registry"
"github.com/optimizely/go-sdk/pkg/tracing"
"github.com/optimizely/go-sdk/pkg/utils"
"github.com/optimizely/go-sdk/v2/pkg/config"
"github.com/optimizely/go-sdk/v2/pkg/decide"
"github.com/optimizely/go-sdk/v2/pkg/decision"
"github.com/optimizely/go-sdk/v2/pkg/event"
"github.com/optimizely/go-sdk/v2/pkg/logging"
"github.com/optimizely/go-sdk/v2/pkg/metrics"
"github.com/optimizely/go-sdk/v2/pkg/notification"
"github.com/optimizely/go-sdk/v2/pkg/odp"
pkgUtils "github.com/optimizely/go-sdk/v2/pkg/odp/utils"
"github.com/optimizely/go-sdk/v2/pkg/registry"
"github.com/optimizely/go-sdk/v2/pkg/tracing"
"github.com/optimizely/go-sdk/v2/pkg/utils"
)

// OptimizelyFactory is used to customize and construct an instance of the OptimizelyClient.
Expand Down
28 changes: 14 additions & 14 deletions pkg/client/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,20 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"

"github.com/optimizely/go-sdk/pkg/config"
"github.com/optimizely/go-sdk/pkg/decide"
"github.com/optimizely/go-sdk/pkg/decision"
"github.com/optimizely/go-sdk/pkg/event"
"github.com/optimizely/go-sdk/pkg/metrics"
"github.com/optimizely/go-sdk/pkg/notification"
"github.com/optimizely/go-sdk/pkg/odp"
"github.com/optimizely/go-sdk/pkg/odp/cache"
pkgOdpEvent "github.com/optimizely/go-sdk/pkg/odp/event"
pkgOdpSegment "github.com/optimizely/go-sdk/pkg/odp/segment"
pkgOdpUtils "github.com/optimizely/go-sdk/pkg/odp/utils"
"github.com/optimizely/go-sdk/pkg/registry"
"github.com/optimizely/go-sdk/pkg/tracing"
"github.com/optimizely/go-sdk/pkg/utils"
"github.com/optimizely/go-sdk/v2/pkg/config"
"github.com/optimizely/go-sdk/v2/pkg/decide"
"github.com/optimizely/go-sdk/v2/pkg/decision"
"github.com/optimizely/go-sdk/v2/pkg/event"
"github.com/optimizely/go-sdk/v2/pkg/metrics"
"github.com/optimizely/go-sdk/v2/pkg/notification"
"github.com/optimizely/go-sdk/v2/pkg/odp"
"github.com/optimizely/go-sdk/v2/pkg/odp/cache"
pkgOdpEvent "github.com/optimizely/go-sdk/v2/pkg/odp/event"
pkgOdpSegment "github.com/optimizely/go-sdk/v2/pkg/odp/segment"
pkgOdpUtils "github.com/optimizely/go-sdk/v2/pkg/odp/utils"
"github.com/optimizely/go-sdk/v2/pkg/registry"
"github.com/optimizely/go-sdk/v2/pkg/tracing"
"github.com/optimizely/go-sdk/v2/pkg/utils"
)

type MockRequester struct {
Expand Down
12 changes: 6 additions & 6 deletions pkg/client/fixtures_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ package client
import (
"fmt"

"github.com/optimizely/go-sdk/pkg/config"
"github.com/optimizely/go-sdk/pkg/decide"
"github.com/optimizely/go-sdk/pkg/decision"
"github.com/optimizely/go-sdk/pkg/entities"
"github.com/optimizely/go-sdk/pkg/event"
"github.com/optimizely/go-sdk/pkg/notification"
"github.com/optimizely/go-sdk/v2/pkg/config"
"github.com/optimizely/go-sdk/v2/pkg/decide"
"github.com/optimizely/go-sdk/v2/pkg/decision"
"github.com/optimizely/go-sdk/v2/pkg/entities"
"github.com/optimizely/go-sdk/v2/pkg/event"
"github.com/optimizely/go-sdk/v2/pkg/notification"
"github.com/stretchr/testify/mock"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/client/optimizely_decision.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
package client

import (
"github.com/optimizely/go-sdk/pkg/optimizelyjson"
"github.com/optimizely/go-sdk/v2/pkg/optimizelyjson"
)

// OptimizelyDecision defines the decision returned by decide api.
Expand Down
2 changes: 1 addition & 1 deletion pkg/client/optimizely_decision_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"errors"
"testing"

"github.com/optimizely/go-sdk/pkg/optimizelyjson"
"github.com/optimizely/go-sdk/v2/pkg/optimizelyjson"

"github.com/stretchr/testify/suite"
)
Expand Down
8 changes: 4 additions & 4 deletions pkg/client/optimizely_user_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ import (
"errors"
"sync"

"github.com/optimizely/go-sdk/pkg/decide"
pkgDecision "github.com/optimizely/go-sdk/pkg/decision"
"github.com/optimizely/go-sdk/pkg/entities"
pkgOdpSegment "github.com/optimizely/go-sdk/pkg/odp/segment"
"github.com/optimizely/go-sdk/v2/pkg/decide"
pkgDecision "github.com/optimizely/go-sdk/v2/pkg/decision"
"github.com/optimizely/go-sdk/v2/pkg/entities"
pkgOdpSegment "github.com/optimizely/go-sdk/v2/pkg/odp/segment"
)

// OptimizelyUserContext defines user contexts that the SDK will use to make decisions for.
Expand Down
Loading
Loading