Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ContextKey ¶
type ContextKey string
ContextKey is a type that represents a key in a Golang context
const ( // ExperimentEngineKey represents the key for the experiment engine name, stored in the context ExperimentEngineKey ContextKey = "experimentEngineKey" )
type ExperimentRunner ¶
type ExperimentRunner interface {
// GetTreatmentForRequest is a method that is called by the Turing Router for each request it receives to retrieve
// an appropriate treatment for it
GetTreatmentForRequest(
header http.Header,
payload []byte,
options GetTreatmentOptions,
) (*Treatment, error)
// RegisterMetricsCollector is a method that should only be called on startup of the experiment runner to register
// the metrics collector of the Turing Router (to be called just after the experiment runner has been initialised)
RegisterMetricsCollector(
collector metrics.Collector,
metricsRegistrationHelper MetricsRegistrationHelper,
) error
}
ExperimentRunner is the generic interface for generating experiment configs for a given request
func NewInterceptRunner ¶
func NewInterceptRunner( name string, runner ExperimentRunner, interceptors ...Interceptor, ) ExperimentRunner
type GetTreatmentOptions ¶
type GetTreatmentOptions struct {
TuringRequestID string
}
type Interceptor ¶
type Interceptor interface {
BeforeDispatch(ctx context.Context) context.Context
AfterCompletion(ctx context.Context, err error)
}
Interceptor interface is used to define concrete interceptors whose methods will be run before and after a single fetch treatment call
type MetricsRegistrationHelper ¶
type MetricsRegistrationHelper interface {
// Register is a method that should be called within ExperimentRunner.RegisterMetricsCollector to register
// additional metrics that the experiment engine requires on the metrics collector of the Turing Router
Register(metrics []instrumentation.Metric) error
}
MetricsRegistrationHelper is the generic interface for the Turing router to register additional metrics needed by the experiment engine
Click to show internal directories.
Click to hide internal directories.