base

package
v0.8.33 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2022 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Overview

Package base provides the core definitions and primitives for Iter8 experiment and experimeent tasks.

Index

Constants

View Source
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"
	// SampleMetricType corresponds to a Sample metric type
	SampleMetricType MetricType = "Sample"

	// CountAggregator corresponds to aggregation of type count
	CountAggregator AggregationType = "count"
	// MeanAggregator corresponds to aggregation of type mean
	MeanAggregator AggregationType = "mean"
	// StddevAggregator corresponds to aggregation of type stddev
	StdDevAggregator AggregationType = "stddev"
	// MinAggregator corresponds to aggregation of type min
	MinAggregator AggregationType = "min"
	// MaxAggregator corresponds to aggregation of type max
	MaxAggregator AggregationType = "max"
	// PercentileAggregator corresponds to aggregation of type max
	PercentileAggregator AggregationType = "percentile"
	// PercentileAggregatorPrefix corresponds to prefix for percentiles
	PercentileAggregatorPrefix = "p"
)
View Source
const (
	// AssessTaskName is the name of the task this file implements
	AssessTaskName = "assess-app-versions"
)
View Source
const (
	// CollectGRPCTaskName is the name of this task which performs load generation and metrics collection for gRPC services.
	CollectGRPCTaskName = "gen-load-and-collect-metrics-grpc"
)
View Source
const (
	// CollectHTTPTaskName is the name of this task which performs load generation and metrics collection.
	CollectHTTPTaskName = "gen-load-and-collect-metrics-http"
)
View Source
const (
	// RunTaskName is the name of the run task which performs running of a shell script.
	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 NormalizeMetricName added in v0.8.29

func NormalizeMetricName(m string) (string, error)

NormalizeMetricName normalizes percentile values in metric names

func StringPointer added in v0.8.8

func StringPointer(s string) *string

StringPointer takes string as input, creates a new variable with the input value, and returns a pointer to the variable

func Uniq added in v0.8.30

func Uniq(list interface{}) []interface{}

Uniq deduplicates a list We have switched from uniq to Uniq, since we want to use it in other packages

Types

type AggregationType added in v0.8.29

type AggregationType string

AggregationType identifies the type of the metric aggregator.

type Experiment

type Experiment struct {
	// Tasks is the sequence of tasks that constitute this experiment
	Tasks ExperimentSpec
	// Result is the current results from this experiment.
	// The experiment may not have completed in which case results may be partial.
	Result *ExperimentResult
}

Experiment specification and result

func (*Experiment) InitResults

func (e *Experiment) InitResults()

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

type ExperimentSpec added in v0.8.29

type ExperimentSpec []Task

ExperimentSpec is the experiment spec

func (*ExperimentSpec) UnmarshalJSON added in v0.8.29

func (s *ExperimentSpec) UnmarshalJSON(data []byte) error

UnmarshallJSON will unmarshal an experiment spec from bytes

type HistBucket added in v0.8.29

type HistBucket struct {
	Lower float64 `json:"lower" yaml:"lower"`
	Upper float64 `json:"upper" yaml:"upper"`
	Count uint64  `json:"count" yaml:"count"`
}

HistBucket is a single bucket in a histogram

type Insights

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

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

	// NonHistMetricValues:
	// 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.
	// this struct is meant exclusively for metrics of type other than histogram
	NonHistMetricValues []map[string][]float64 `json:"nonHistMetricValues,omitempty" yaml:"nonHistMetricValues,omitempty"`

	// HistMetricValues:
	// the outer slice must be the same length as the number of app versions
	// the map key must match name of a histogram metric in MetricsInfo
	// the inner slice contains the list of all observed histogram buckets for a given version and given metric; value [i]["foo/bar"][k] is the [k]th observed bucket for version [i] for the hist metric `bar` under backend `foo`.
	HistMetricValues []map[string][]HistBucket `json:"histMetricValues,omitempty" yaml:"histMetricValues,omitempty"`

	// SLOs involved in this experiment
	SLOs []SLO `json:"SLOs,omitempty" yaml:"SLOs,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"`
}

Insights records the number of versions in this experiment, metric values and SLO indicators for each version, metrics metadata for all metrics, and SLO definitions for all SLOs

func (*Insights) GetMetricsInfo added in v0.8.30

func (in *Insights) GetMetricsInfo(nm string) (*MetricMeta, error)

GetMetricsInfo gets metric meta for the given normalized metric name

func (*Insights) ScalarMetricValue added in v0.8.29

func (in *Insights) ScalarMetricValue(i int, m string) *float64

ScalarMetricValue gets the value of the given scalar metric for the given version

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"`
}

MetricMeta describes a metric

type MetricType

type MetricType string

MetricType identifies the type of the metric.

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"`

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

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

SLO is a service level objective

type Task

type Task interface {

	// Run this task
	Run(exp *Experiment) error
	// contains filtered or unexported methods
}

Task is an object that can be run

type TaskMeta added in v0.8.29

type TaskMeta struct {
	// Task is the name of the task
	Task *string `json:"task,omitempty" yaml:"task,omitempty"`
	// Run is the script used in a run task
	// Specify either Task or Run but not both
	Run *string `json:"run,omitempty" yaml:"run,omitempty"`
	// If is the condition used to determine if this task needs to run.
	If *string `json:"if,omitempty" yaml:"if,omitempty"`
}

this is embedded within each task

Directories

Path Synopsis
Package log provides primitives for logging.
Package log provides primitives for logging.

Jump to

Keyboard shortcuts

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