experiments

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 10, 2023 License: MIT Imports: 12 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientOption

type ClientOption func(c *ExperimentClient)

func WithErrorLogger

func WithErrorLogger(l Logger) ClientOption

func WithLogger

func WithLogger(l Logger) ClientOption

func WithToken

func WithToken(token string) ClientOption

type Config

type Config struct {
	// Host A/B Test server host
	Host string
}

type ExperimentClient

type ExperimentClient struct {
	// Host A/B Test server host
	Host string
	// Token the request header Authorization
	Token string

	// Environment control the sdk shoud get which environment data .
	// Valid value is daily, prepub,product
	Environment string

	// APIClient invoke api to connect to the A/B Test Server
	APIClient *api.APIClient

	// Logger specifies a logger used to report internal changes within the writer
	Logger Logger

	// ErrorLogger is the logger to report errors
	ErrorLogger Logger
	// contains filtered or unexported fields
}

func NewExperimentClient

func NewExperimentClient(host, environment string, opts ...ClientOption) (*ExperimentClient, error)

func (*ExperimentClient) CheckIfFlowCtrlPlanTargetIsEnabled

func (e *ExperimentClient) CheckIfFlowCtrlPlanTargetIsEnabled(env string, targetId int, currentTimestamp int64) bool

func (*ExperimentClient) GetFlowCtrlPlanMetaList

func (e *ExperimentClient) GetFlowCtrlPlanMetaList(env string, currentTimestamp int64) []model.FlowCtrlPlan

func (*ExperimentClient) GetFlowCtrlPlanTargetList

func (e *ExperimentClient) GetFlowCtrlPlanTargetList(env, sceneName string, currentTimestamp int64) map[int]model.FlowCtrlPlanTargets

func (*ExperimentClient) GetFlowCtrlPlanTargetTraffic

func (e *ExperimentClient) GetFlowCtrlPlanTargetTraffic(env, sceneName string, idList ...string) []FlowCtrlPlanTargetTraffic

func (*ExperimentClient) GetSceneParams

func (e *ExperimentClient) GetSceneParams(sceneName string) model.SceneParams

func (*ExperimentClient) LoadExperimentData

func (e *ExperimentClient) LoadExperimentData()

LoadExperimentData specifies a function to load data from A/B Test Server

func (*ExperimentClient) LoadSceneFlowCtrlPlansData

func (e *ExperimentClient) LoadSceneFlowCtrlPlansData()

LoadSceneFlowCtrlPlansData specifies a function to load flow ctrl plan data from A/B Test Server

func (*ExperimentClient) LoadSceneParamsData

func (e *ExperimentClient) LoadSceneParamsData()

LoadSceneParamsData specifies a function to load param data from A/B Test Server

func (*ExperimentClient) MatchExperiment

func (e *ExperimentClient) MatchExperiment(sceneName string, experimentContext *model.ExperimentContext) *model.ExperimentResult

MatchExperiment specifies to find match experiment by the ExperimentContext If not find the scene return error or return ExperimentResult

func (*ExperimentClient) Validate

func (e *ExperimentClient) Validate() error

Validate check the ExperimentClient value

type FlowCtrlPlanTargetTraffic

type FlowCtrlPlanTargetTraffic struct {
	ItemOrExpId   string  `json:"item_or_exp_id"`
	PlanId        int     `json:"plan_id"`
	TargetId      int     `json:"target_id"`
	TargetTraffic float64 `json:"target_traffic"`
	PlanTraffic   float64 `json:"plan_traffic"`
}

type Logger

type Logger interface {
	Printf(string, ...interface{})
}

Logger interface API for log.Logger

type LoggerFunc

type LoggerFunc func(string, ...interface{})

func (LoggerFunc) Printf

func (f LoggerFunc) Printf(msg string, args ...interface{})

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL