Documentation
¶
Overview ¶
Package eppoclient provides client for eppo.cloud. Check InitClient to get started.
Index ¶
- Constants
- Variables
- type ApplicationLogger
- type AssignmentEvent
- type AssignmentLogger
- type Attributes
- type BanditActionLogger
- type BanditEvent
- type BanditResult
- type Config
- type ContextAttributes
- type EppoClient
- func (ec *EppoClient) GetBanditAction(flagKey string, subjectKey string, subjectAttributes ContextAttributes, ...) BanditResult
- func (ec *EppoClient) GetBoolAssignment(flagKey string, subjectKey string, subjectAttributes Attributes, ...) (bool, error)
- func (ec *EppoClient) GetIntegerAssignment(flagKey string, subjectKey string, subjectAttributes Attributes, ...) (int64, error)
- func (ec *EppoClient) GetJSONAssignment(flagKey string, subjectKey string, subjectAttributes Attributes, ...) (interface{}, error)
- func (ec *EppoClient) GetJSONBytesAssignment(flagKey string, subjectKey string, subjectAttributes Attributes, ...) ([]byte, error)
- func (ec *EppoClient) GetNumericAssignment(flagKey string, subjectKey string, subjectAttributes Attributes, ...) (float64, error)
- func (ec *EppoClient) GetStringAssignment(flagKey string, subjectKey string, subjectAttributes Attributes, ...) (string, error)
- func (ec *EppoClient) Initialized() <-chan struct{}
- type IAssignmentLogger
- type LruAssignmentLogger
- type LruBanditLogger
- type SDKParams
- type ScrubbingLogger
- func (s *ScrubbingLogger) Debug(args ...interface{})
- func (s *ScrubbingLogger) Error(args ...interface{})
- func (s *ScrubbingLogger) Errorf(template string, args ...interface{})
- func (s *ScrubbingLogger) Info(args ...interface{})
- func (s *ScrubbingLogger) Infof(template string, args ...interface{})
- func (s *ScrubbingLogger) Warn(args ...interface{})
- func (s *ScrubbingLogger) Warnf(template string, args ...interface{})
- type ZapLogger
- func (z *ZapLogger) Debug(args ...interface{})
- func (z *ZapLogger) Error(args ...interface{})
- func (z *ZapLogger) Errorf(template string, args ...interface{})
- func (z *ZapLogger) Info(args ...interface{})
- func (z *ZapLogger) Infof(template string, args ...interface{})
- func (z *ZapLogger) Warn(args ...interface{})
- func (z *ZapLogger) Warnf(template string, args ...interface{})
Constants ¶
const BANDIT_ENDPOINT = "/flag-config/v1/bandits"
const CONFIG_ENDPOINT = "/flag-config/v1/config"
const REQUEST_TIMEOUT_SECONDS = time.Duration(10 * time.Second)
Variables ¶
var ( ErrSubjectAllocation = errors.New("subject is not part of any allocation") ErrFlagNotEnabled = errors.New("the experiment or flag is not enabled") ErrFlagConfigurationNotFound = errors.New("flag configuration not found") ErrBanditConfigurationNotFound = errors.New("bandit configuration not found") )
Functions ¶
This section is empty.
Types ¶
type ApplicationLogger ¶
type AssignmentEvent ¶
type AssignmentEvent struct { Experiment string `json:"experiment"` FeatureFlag string `json:"featureFlag"` Allocation string `json:"allocation"` Variation string `json:"variation"` Subject string `json:"subject"` SubjectAttributes Attributes `json:"subjectAttributes,omitempty"` Timestamp string `json:"timestamp"` MetaData map[string]string `json:"metaData"` ExtraLogging map[string]string `json:"extraLogging,omitempty"` }
type AssignmentLogger ¶
type AssignmentLogger struct { }
func (*AssignmentLogger) LogAssignment ¶
func (al *AssignmentLogger) LogAssignment(event AssignmentEvent)
func (*AssignmentLogger) LogBanditAction ¶
func (al *AssignmentLogger) LogBanditAction(event BanditEvent)
type Attributes ¶
type Attributes map[string]interface{}
type BanditActionLogger ¶
type BanditActionLogger interface {
LogBanditAction(event BanditEvent)
}
BanditActionLogger is going to be merged into IAssignmentLogger in the next major version.
type BanditEvent ¶
type BanditEvent struct { FlagKey string `json:"flagKey"` BanditKey string `json:"banditKey"` Subject string `json:"subject"` Action string `json:"action,omitempty"` ActionProbability float64 `json:"actionProbability,omitempty"` OptimalityGap float64 `json:"optimalityGap,omitempty"` ModelVersion string `json:"modelVersion,omitempty"` Timestamp string `json:"timestamp"` SubjectNumericAttributes map[string]float64 `json:"subjectNumericAttributes,omitempty"` SubjectCategoricalAttributes map[string]string `json:"subjectCategoricalAttributes,omitempty"` ActionNumericAttributes map[string]float64 `json:"actionNumericAttributes,omitempty"` ActionCategoricalAttributes map[string]string `json:"actionCategoricalAttributes,omitempty"` MetaData map[string]string `json:"metaData"` }
type BanditResult ¶
type Config ¶
type Config struct { BaseUrl string SdkKey string AssignmentLogger IAssignmentLogger PollerInterval time.Duration ApplicationLogger ApplicationLogger }
type ContextAttributes ¶
func InferContextAttributes ¶
func InferContextAttributes(attrs map[string]interface{}) ContextAttributes
Tries to map generic attributes to ContextAttributes depending on attribute types. - Integer and float types are mapped to numeric attributes. - Strings and bools are mapped to categorical attributes. - Rest of types are silently dropped.
type EppoClient ¶
type EppoClient struct {
// contains filtered or unexported fields
}
EppoClient Client for eppo.cloud. Instance of this struct will be created on calling InitClient. EppoClient will then immediately start polling experiments data from Eppo.
func InitClient ¶
func InitClient(config Config) (*EppoClient, error)
InitClient is required to start polling of experiments configurations and create an instance of EppoClient, which could be used to get assignments information.
func (*EppoClient) GetBanditAction ¶
func (ec *EppoClient) GetBanditAction(flagKey string, subjectKey string, subjectAttributes ContextAttributes, actions map[string]ContextAttributes, defaultVariation string) BanditResult
func (*EppoClient) GetBoolAssignment ¶
func (ec *EppoClient) GetBoolAssignment(flagKey string, subjectKey string, subjectAttributes Attributes, defaultValue bool) (bool, error)
func (*EppoClient) GetIntegerAssignment ¶
func (ec *EppoClient) GetIntegerAssignment(flagKey string, subjectKey string, subjectAttributes Attributes, defaultValue int64) (int64, error)
func (*EppoClient) GetJSONAssignment ¶
func (ec *EppoClient) GetJSONAssignment(flagKey string, subjectKey string, subjectAttributes Attributes, defaultValue interface{}) (interface{}, error)
func (*EppoClient) GetJSONBytesAssignment ¶
func (ec *EppoClient) GetJSONBytesAssignment(flagKey string, subjectKey string, subjectAttributes Attributes, defaultValue []byte) ([]byte, error)
func (*EppoClient) GetNumericAssignment ¶
func (ec *EppoClient) GetNumericAssignment(flagKey string, subjectKey string, subjectAttributes Attributes, defaultValue float64) (float64, error)
func (*EppoClient) GetStringAssignment ¶
func (ec *EppoClient) GetStringAssignment(flagKey string, subjectKey string, subjectAttributes Attributes, defaultValue string) (string, error)
func (*EppoClient) Initialized ¶ added in v6.1.0
func (ec *EppoClient) Initialized() <-chan struct{}
Returns a channel that gets closed after client has been *successfully* initialized.
It is recommended to apply a timeout to initialization as otherwise it may hang up indefinitely.
select { case <-client.Initialized(): case <-time.After(5 * time.Second): }
type IAssignmentLogger ¶
type IAssignmentLogger interface {
LogAssignment(event AssignmentEvent)
}
func NewAssignmentLogger ¶
func NewAssignmentLogger() IAssignmentLogger
func NewLruAssignmentLogger ¶
func NewLruAssignmentLogger(logger IAssignmentLogger, cacheSize int) (IAssignmentLogger, error)
func NewLruBanditLogger ¶
func NewLruBanditLogger(logger IAssignmentLogger, cacheSize int) (IAssignmentLogger, error)
type LruAssignmentLogger ¶
type LruAssignmentLogger struct {
// contains filtered or unexported fields
}
func (*LruAssignmentLogger) LogAssignment ¶
func (lal *LruAssignmentLogger) LogAssignment(event AssignmentEvent)
func (*LruAssignmentLogger) LogBanditAction ¶
func (lal *LruAssignmentLogger) LogBanditAction(event BanditEvent)
type LruBanditLogger ¶
type LruBanditLogger struct {
// contains filtered or unexported fields
}
func (*LruBanditLogger) LogAssignment ¶
func (logger *LruBanditLogger) LogAssignment(event AssignmentEvent)
func (*LruBanditLogger) LogBanditAction ¶
func (logger *LruBanditLogger) LogBanditAction(event BanditEvent)
type ScrubbingLogger ¶
type ScrubbingLogger struct {
// contains filtered or unexported fields
}
ScrubbingLogger is an ApplicationLogger that scrubs sensitive information from logs
func NewScrubbingLogger ¶
func NewScrubbingLogger(innerLogger ApplicationLogger) *ScrubbingLogger
func (*ScrubbingLogger) Debug ¶
func (s *ScrubbingLogger) Debug(args ...interface{})
func (*ScrubbingLogger) Error ¶
func (s *ScrubbingLogger) Error(args ...interface{})
func (*ScrubbingLogger) Errorf ¶
func (s *ScrubbingLogger) Errorf(template string, args ...interface{})
func (*ScrubbingLogger) Info ¶
func (s *ScrubbingLogger) Info(args ...interface{})
func (*ScrubbingLogger) Infof ¶
func (s *ScrubbingLogger) Infof(template string, args ...interface{})
func (*ScrubbingLogger) Warn ¶
func (s *ScrubbingLogger) Warn(args ...interface{})
func (*ScrubbingLogger) Warnf ¶
func (s *ScrubbingLogger) Warnf(template string, args ...interface{})
type ZapLogger ¶
type ZapLogger struct {
// contains filtered or unexported fields
}
ZapLogger The default logger for the Eppo SDK
func NewZapLogger ¶
Source Files
¶
- applicationlogger.go
- assignmentlogger.go
- banditmodel.go
- client.go
- config.go
- configresponse.go
- configuration.go
- configurationrequestor.go
- configurationstore.go
- errors.go
- evalbandits.go
- evalflags.go
- httpclient.go
- initclient.go
- lruassignmentlogger.go
- lrubanditlogger.go
- poller.go
- rules.go
- shard.go
- version.go