base

package
v0.8.7 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// AssessTaskName is the name of the task this file implements
	AssessTaskName = "assess-app-versions"
)
View Source
const (
	CollectTaskName = "gen-load-and-collect-metrics"
)
View Source
const (
	RunTaskName = "run"
)

Variables

This section is empty.

Functions

func CompletePath

func CompletePath(prefix string, suffix string) string

CompletePath is a helper function for converting file paths, specified relative to the caller of this function, into absolute ones. CompletePath is useful in tests and enables deriving the absolute path of experiment YAML files.

func GetIf

func GetIf(t Task) *string

func GetPayloadBytes

func GetPayloadBytes(url string) ([]byte, error)

GetPayloadBytes downloads payload from URL and returns a byte slice

Types

type Experiment

type Experiment struct {
	// Tasks is the sequence of tasks that constitute this experiment
	Tasks  []TaskSpec        `json:"tasks" yaml:"tasks"`
	Result *ExperimentResult `json:"result" yaml:"result"`
}

Experiment specification and result

func (*Experiment) InitResults

func (e *Experiment) InitResults()

func (*Experiment) SLOs

func (exp *Experiment) SLOs() bool

SLOs returns true if all versions satisfy SLOs

func (*Experiment) SLOsBy

func (exp *Experiment) SLOsBy(version int) bool

SLOsBy returns true if version satisfies SLOs

type ExperimentResult

type ExperimentResult struct {
	// StartTime is the time when the experiment run started
	StartTime time.Time `json:"startTime" yaml:"startTime"`

	// NumCompletedTasks is the number of completed tasks
	NumCompletedTasks int `json:"numCompletedTasks" yaml:"numCompletedTasks"`

	// Failure is true if any of its tasks failed
	Failure bool `json:"failure" yaml:"failure"`

	// Insights produced in this experiment
	Insights *Insights `json:"insights,omitempty" yaml:"insights,omitempty"`
}

ExperimentResult defines the current results from the experiment

func (*ExperimentResult) InitInsights

func (r *ExperimentResult) InitInsights(n int, it []InsightType)

type InsightType

type InsightType string

InsightType identifies the type of insight

const (
	// InsightTypeHistMetrics indicates histogram metrics are collected during this experiment
	InsightTypeHistMetrics InsightType = "HistMetrics"

	// InsightTypeMetrics indicates metrics are collected during this experiment
	InsightTypeMetrics InsightType = "Metrics"

	// InsightTypeSLO indicatse SLOs are validated during this experiment
	InsightTypeSLO InsightType = "SLOs"
)

type Insights

type Insights struct {
	// NumVersions is the number of app versions detected by Iter8
	NumVersions int `json:"numVersions" yaml:"numVersions"`

	// InsightInfo identifies the types of insights produced by this experiment
	InsightTypes []InsightType `json:"insightTypes,omitempty" yaml:"insightTypes,omitempty"`

	// MetricsInfo identifies the metrics involved in this experiment
	MetricsInfo map[string]MetricMeta `json:"metricsInfo,omitempty" yaml:"metricsInfo,omitempty"`

	// SLOs involved in this experiment
	SLOs []SLO `json:"SLOs,omitempty" yaml:"SLOs,omitempty"`

	// MetricValues:
	// the outer slice must be the same length as the number of app versions
	// the map key must match name of a metric in MetricsInfo
	// the inner slice contains the list of all observed metric values for given version and given metric; float value [i]["foo/bar"][k] is the [k]th observation for version [i] for the metric bar under backend foo.
	MetricValues []map[string][]float64 `json:"metricValues,omitempty" yaml:"metricValues,omitempty"`

	// SLOsSatisfied:
	// the outer slice must be of the same length as SLOs
	// the length of the inner slice must be the number of app versions
	// the boolean value at [i][j] indicate if SLO [i] is satisfied by version [j]
	SLOsSatisfied [][]bool `json:"SLOsSatisfied,omitempty" yaml:"SLOsSatisfied,omitempty"`

	// SLOsSatisfiedBy is the subset of versions that satisfy all SLOs
	// every integer in this slice must be in the range 0 to NumVersions - 1 (inclusive)
	SLOsSatisfiedBy []int `json:"SLOsSatisfiedBy,omitempty" yaml:"SLOsSatisfiedBy,omitempty"`
}

Insights is a structure to contain experiment insights

type MetricMeta

type MetricMeta struct {
	Description string     `json:"description" yaml:"description"`
	Units       *string    `json:"units,omitempty" yaml:"units,omitempty"`
	Type        MetricType `json:"type" yaml:"type"`
	XMin        *float64   `json:"xmin" yaml:"xmin"`
	XMax        *float64   `json:"xmax" yaml:"xmax"`
	NumBuckets  *int       `json:"numBuckets" yaml:"numBuckets"`
}

MetricMeta describes a metric

type MetricType

type MetricType string

MetricType identifies the type of the metric.

const (
	// CounterMetricType corresponds to Prometheus Counter metric type
	CounterMetricType MetricType = "Counter"

	// GaugeMetricType corresponds to Prometheus Gauge metric type
	GaugeMetricType MetricType = "Gauge"

	// HistogramMetricType corresponds to a Histogram metric type
	HistogramMetricType MetricType = "Histogram"
)

type SLO

type SLO struct {
	// Metric is the fully qualified metric name (i.e., in the backendName/metricName format)
	Metric string `json:"metric" yaml:"metric" validate:"gt=0,required"`

	// UpperLimit is the maximum acceptable value of the metric.
	UpperLimit *float64 `json:"upperLimit,omitempty" yaml:"upperLimit,omitempty" validate:"required_without=LowerLimit"`

	// LowerLimit is the minimum acceptable value of the metric.
	LowerLimit *float64 `json:"lowerLimit,omitempty" yaml:"lowerLimit,omitempty" validate:"required_without=UpperLimit"`
}

SLO is a service level objective

type Task

type Task interface {
	Run(exp *Experiment) error
	GetName() string
}

Task is an object that can be run

func MakeAssess

func MakeAssess(t *TaskSpec) (Task, error)

MakeAssess constructs an asessTask out of a task spec

func MakeCollect

func MakeCollect(t *TaskSpec) (Task, error)

MakeCollect constructs a CollectTask out of a collect task spec

func MakeRun

func MakeRun(t *TaskSpec) (Task, error)

MakeRun constructs a RunTask out of a run task spec

type TaskSpec

type TaskSpec struct {
	With map[string]interface{} `json:"with,omitempty" yaml:"with,omitempty"`
	// contains filtered or unexported fields
}

TaskSpec has information needed to construct a Task

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳