evaluator

package
v5.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2024 License: Apache-2.0 Imports: 9 Imported by: 2

Documentation

Index

Constants

View Source
const (
	// Control is the treatment returned when something goes wrong
	Control = "control"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Evaluator

type Evaluator struct {
	// contains filtered or unexported fields
}

Evaluator struct is the main evaluator

func NewEvaluator

func NewEvaluator(
	splitStorage storage.SplitStorageConsumer,
	segmentStorage storage.SegmentStorageConsumer,
	eng *engine.Engine,
	logger logging.LoggerInterface,
) *Evaluator

NewEvaluator instantiates an Evaluator struct and returns a reference to it

func (*Evaluator) EvaluateDependency

func (e *Evaluator) EvaluateDependency(key string, bucketingKey *string, featureFlag string, attributes map[string]interface{}) string

EvaluateDependency SHOULD ONLY BE USED by DependencyMatcher. It's used to break the dependency cycle between matchers and evaluators.

func (*Evaluator) EvaluateFeature

func (e *Evaluator) EvaluateFeature(key string, bucketingKey *string, featureFlag string, attributes map[string]interface{}) *Result

EvaluateFeature returns a struct with the resulting treatment and extra information for the impression

func (*Evaluator) EvaluateFeatureByFlagSets added in v5.1.0

func (e *Evaluator) EvaluateFeatureByFlagSets(key string, bucketingKey *string, flagSets []string, attributes map[string]interface{}) Results

EvaluateFeatureByFlagSets returns a struct with the resulting treatment and extra information for the impression

func (*Evaluator) EvaluateFeatures

func (e *Evaluator) EvaluateFeatures(key string, bucketingKey *string, featureFlags []string, attributes map[string]interface{}) Results

EvaluateFeatures returns a struct with the resulting treatment and extra information for the impression

type Interface

type Interface interface {
	EvaluateFeature(key string, bucketingKey *string, featureFlag string, attributes map[string]interface{}) *Result
	EvaluateFeatures(key string, bucketingKey *string, featureFlags []string, attributes map[string]interface{}) Results
	EvaluateFeatureByFlagSets(key string, bucketingKey *string, flagSets []string, attributes map[string]interface{}) Results
}

Interface should be implemented by concrete treatment evaluator structs

type Result

type Result struct {
	Treatment         string
	Label             string
	EvaluationTime    time.Duration
	SplitChangeNumber int64
	Config            *string
}

Result represents the result of an evaluation, including the resulting treatment, the label for the impression, the latency and error if any

type Results

type Results struct {
	Evaluations    map[string]Result
	EvaluationTime time.Duration
}

Results represents the result of multiple evaluations at once

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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