Giter Site home page Giter Site logo

bucketeer-io / go-server-sdk Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 3.0 318 KB

Bucketeer Server-side SDK for Go

Home Page: https://docs.bucketeer.io/sdk/server-side/go

License: Apache License 2.0

Makefile 1.06% Go 98.94%
ab-testing feature-flags go sdk server-side trunk-based-development

go-server-sdk's Introduction

Bucketeer Server-side SDK for Go

Bucketeer is an open-source platform created by CyberAgent to help teams make better decisions, reduce deployment lead time and release risk through feature flags. Bucketeer offers advanced features like dark launches and staged rollouts that perform limited releases based on user attributes, devices, and other segments.

Getting started using Bucketeer SDK.

Installation

See our documentation to install the SDK.

Contributing

We would ❤️ for you to contribute to Bucketeer and help improve it! Anyone can use and enjoy it!

Please follow our contribution guide here.

Setup

Install the prerequisite tools

Install the dependencies

make deps

Development

SDK

Generate mocks

make mockgen

Format

make fmt

Lint

make lint

Build

make build

Run unit tests

make test

Run unit tests to get coverage

make coverage

Run e2e tests

make e2e API_KEY=<API_KEY> HOST=<HOST> PORT=<PORT>

# e.g.
make e2e API_KEY="xxxxxxxx" HOST="api-dev.bucketeer.jp" PORT=443

Example

Go to the example directory.

cd example

Build

make build

Start the example server

make start TAG=<TAG> API_KEY=<API_KEY> HOST=<HOST> PORT=<PORT> \
    ENABLE_DEBUG_LOG=<ENABLE_DEBUG_LOG> FEATURE_ID=<FEATURE_ID> GOAL_ID=<GOAL_ID>

# e.g.
make start TAG="go-server" API_KEY="xxxxxxxx" HOST="api.example.com" PORT="443" \
    ENABLE_DEBUG_LOG="false" FEATURE_ID="go-example-1" GOAL_ID="go-example-goal-1"

Send requests to the example server

# variation
# e.g.
curl --cookie "user_id=user-1" http://localhost:8080/variation

# track
# e.g.
curl -X POST --cookie "user_id=user-1" http://localhost:8080/track

If you want to use a published SDK instead of a local one, you can change the go.mod in the example directory.

Please check the SDK releases

go-server-sdk's People

Contributors

mura-s avatar bucketeer-bot avatar cre8ivejp avatar ono-max avatar s-h1129 avatar github-actions[bot] avatar kakcy avatar masaaania avatar kentakozuka avatar

Stargazers

 avatar

Watchers

James Cloos avatar OIZUMI Asuka avatar

go-server-sdk's Issues

test: add for cases for e2e test

To ensure the stability of the SDK, we must add more cases for e2e tests like in the other client SDKs.
We must test all the interfaces using different flags and conditions.

Proposal for Interface

import "context"

type Tracker interface {
	Track(goalID string, value float64)
}

type Client interface {
	BoolVariation(ctx context.Context, tag string, def bool) (bool, Tracker)
	Int64Variation(ctx context.Context, tag string, def int64) (int64, Tracker)
	Float64Variation(ctx context.Context, tag string, def float64) (float64, Tracker)
	StringVariation(ctx context.Context, tag string, def string) (string, Tracker)
	JSONVariation(ctx context.Context, tag string, dst interface{}) Tracker
}

type key int

const (
	keyUserID key = iota
	keyAttribute
)

func NewContext(ctx context.Context, userID string, attr map[string]string) context.Context {
	ctx = context.WithValue(ctx, keyUserID, userID)
	return context.WithValue(ctx, keyAttribute, attr)
}

feat: evaluate the user in the sdk instead of the backend

The current architecture when the get variation interface is called. It requests the evaluation directly from the server.
This approach is more straightforward but may introduce latency. Also, this could lead to infra-cost issues because it could evaluate the same user many times in a short time, even if the flag didn't change.

We should consider implementing the evaluation logic in the SDK to implement a cache similar to the client SDK.
This would improve the latency issues and reduce the requests to the server drastically, reducing the infra-cost.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.