v1alpha

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2021 License: Apache-2.0 Imports: 3 Imported by: 9

Documentation

Index

Constants

View Source
const (
	KindSLO     = "SLO"
	KindService = "Service"
)

Possible values of field kind for valid Objects.

View Source
const (
	APIVersion = "openslo/v1alpha"
)

APIVersion is a value of valid apiVersions.

Variables

This section is empty.

Functions

This section is empty.

Types

type Calendar

type Calendar struct {
	StartTime string `yaml:"startTime" validate:"required,dateWithTime" example:"2020-01-21 12:30:00"`
	TimeZone  string `yaml:"timeZone" validate:"required,timeZone" example:"America/New_York"`
}

Calendar struct represents calendar time window.

type Indicator

type Indicator struct {
	ThresholdMetric MetricSourceSpec `yaml:"thresholdMetric" validate:"required"`
}

Indicator represents integration with metric source.

type MetricSourceSpec

type MetricSourceSpec struct {
	Source    string `yaml:"source" validate:"required,alpha"`
	QueryType string `yaml:"queryType" validate:"required,alpha"`
	Query     string `yaml:"query" validate:"required"`
}

MetricSourceSpec represents the metric source.

type Objective

type Objective struct {
	ObjectiveBase   `yaml:",inline"`
	RatioMetrics    *RatioMetrics `yaml:"ratioMetrics"`
	BudgetTarget    *float64      `yaml:"target" validate:"required,numeric,gte=0,lt=1" example:"0.9"`
	TimeSliceTarget *float64      `yaml:"timeSliceTarget,omitempty" example:"0.9"`
	Operator        *string       `yaml:"op,omitempty" example:"lte"`
}

Objective represents single threshold for SLO, for internal usage.

type ObjectiveBase

type ObjectiveBase struct {
	DisplayName string  `yaml:"displayName" validate:"max=1050" example:"Good"`
	Value       float64 `yaml:"value" validate:"numeric" example:"100"`
}

ObjectiveBase base structure representing a threshold.

type OpenSLOKind

type OpenSLOKind interface {
	Kind() string
}

OpenSLOKind represents a type of object described by OpenSLO.

func Parse

func Parse(fileContent []byte, m manifest.ObjectGeneric, filename string) (OpenSLOKind, error)

Parse is responsible for parsing all structs in this apiVersion.

type RatioMetrics added in v0.3.0

type RatioMetrics struct {
	Good        MetricSourceSpec `yaml:"good" validate:"required"`
	Total       MetricSourceSpec `yaml:"total" validate:"required"`
	Incremental bool             `yaml:"incremental" example:"true"`
}

type SLO

type SLO struct {
	manifest.ObjectHeader `yaml:",inline"`
	Spec                  SLOSpec `yaml:"spec"`
}

SLO struct which mapped one to one with kind: slo yaml definition, external usage.

func (SLO) Kind

func (SLO) Kind() string

Kind returns the name of this type.

type SLOSpec

type SLOSpec struct {
	TimeWindows     []TimeWindow `yaml:"timeWindows" validate:"required,len=1,dive"`
	BudgetingMethod string       `yaml:"budgetingMethod" validate:"required,oneof=Occurrences Timeslices" example:"Occurrences"` //nolint: lll
	Description     string       `yaml:"description" validate:"max=1050" example:"Total count of server requests"`
	Indicator       *Indicator   `yaml:"indicator"`
	Service         string       `yaml:"service" validate:"required" example:"webapp-service"`
	Objectives      []Objective  `json:"objectives" validate:"required,dive"`
}

SLOSpec represents content of Spec typical for SLO Object.

type Service

type Service struct {
	manifest.ObjectHeader `yaml:",inline"`
	Spec                  ServiceSpec `yaml:"spec"`
}

Service struct which mapped one to one with kind: service yaml definition.

func (Service) Kind

func (Service) Kind() string

Kind returns the name of this type.

type ServiceSpec

type ServiceSpec struct {
	Description string `yaml:"description" validate:"max=1050" example:"Bleeding edge web app"`
}

ServiceSpec represents content of Spec typical for Service Object.

type TimeWindow

type TimeWindow struct {
	Unit      string    `yaml:"unit" validate:"required,oneof=Second Quarter Month Week Day" example:"Week"`
	Count     int       `yaml:"count" validate:"required,gt=0" example:"1"`
	IsRolling bool      `yaml:"isRolling" example:"true"`
	Calendar  *Calendar `yaml:"calendar,omitempty"`
}

TimeWindow represents content of time window.

Jump to

Keyboard shortcuts

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