experimentstore

package
v0.0.0-...-e01fbee Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const Name = "clutch.service.chaos.experimentation.store"

Variables

This section is empty.

Functions

func New

func New(_ *any.Any, logger *zap.Logger, scope tally.Scope) (service.Service, error)

New returns a new NewExperimentStore instance.

func NewRunDetails

func NewRunDetails(run *ExperimentRun, config *ExperimentConfig, transformer *Transformer, now time.Time) (*experimentation.ExperimentRunDetails, error)

func NewRunListView

func NewRunListView(run *ExperimentRun, config *ExperimentConfig, transformer *Transformer, now time.Time) (*experimentation.ListViewItem, error)

func StatusToString

func StatusToString(status experimentation.Experiment_Status) string

func TimeToPropertyDateValue

func TimeToPropertyDateValue(t *time.Time) (*experimentation.Property_DateValue, error)

Types

type CreateOrGetExperimentResult

type CreateOrGetExperimentResult struct {
	Experiment *Experiment
	Origin     experimentationv1.CreateOrGetExperimentResponse_Origin
}

type Experiment

type Experiment struct {
	Run    *ExperimentRun
	Config *ExperimentConfig
}

func (Experiment) Proto

type ExperimentConfig

type ExperimentConfig struct {
	Id string
	// TODO(Augustyniak): Remove Config property once all of its existing usages are removed. Use Message property instead.
	Config  *any.Any
	Message proto.Message
}

func NewExperimentConfig

func NewExperimentConfig(id string, stringifedData string) (*ExperimentConfig, error)

func (*ExperimentConfig) CreateProperties

func (ec *ExperimentConfig) CreateProperties() ([]*experimentationv1.Property, error)

type ExperimentRun

type ExperimentRun struct {
	Id                string
	StartTime         time.Time
	EndTime           *time.Time
	CancellationTime  *time.Time
	CreationTime      time.Time
	TerminationReason string
}

func (*ExperimentRun) CreateProperties

func (er *ExperimentRun) CreateProperties(now time.Time) ([]*experimentationv1.Property, error)

func (*ExperimentRun) Status

type ExperimentSpecification

type ExperimentSpecification struct {
	RunId     string
	ConfigId  string
	StartTime time.Time
	EndTime   *time.Time
	Config    *any.Any
}

func NewExperimentSpecification

func NewExperimentSpecification(ced *experimentationv1.CreateExperimentData, now time.Time) (*ExperimentSpecification, error)

New returns a new experimentationSpecification instance.

type Storer

type Storer interface {
	CreateExperiment(context.Context, *ExperimentSpecification) (*Experiment, error)
	CreateOrGetExperiment(context.Context, *ExperimentSpecification) (*CreateOrGetExperimentResult, error)
	CancelExperimentRun(ctx context.Context, id string, reason string) error
	GetExperiments(ctx context.Context, configType string, status experimentation.GetExperimentsRequest_Status) ([]*Experiment, error)
	GetExperimentRunDetails(ctx context.Context, id string) (*experimentation.ExperimentRunDetails, error)
	GetListView(ctx context.Context) ([]*experimentation.ListViewItem, error)
	RegisterTransformation(transformation Transformation) error
	Close()
}

Storer stores experiment data

type Transformation

type Transformation struct {
	ConfigTypeUrl   string
	ConfigTransform func(config *ExperimentConfig) ([]*experimentation.Property, error)
	RunTransform    func(run *ExperimentRun, config *ExperimentConfig) ([]*experimentation.Property, error)
}

type Transformer

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

func NewTransformer

func NewTransformer(logger *zap.SugaredLogger) Transformer

func (*Transformer) CreateProperties

func (tr *Transformer) CreateProperties(run *ExperimentRun, config *ExperimentConfig) ([]*experimentation.Property, error)

func (*Transformer) Register

func (tr *Transformer) Register(transformation Transformation) error

Jump to

Keyboard shortcuts

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