v1alpha

package
v0.0.0-...-4b62505 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Copyright © 2022 OpenSLO Team

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

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

func Parse

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

Parse is responsible for parsing all structs in this apiVersion.

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 Metadata

type Metadata struct {
	Name        string `yaml:"name" validate:"required" example:"name"`
	DisplayName string `yaml:"displayName,omitempty" validate:"omitempty,min=0,max=63" example:"Prometheus Source"`
}

Metadata represents part of object which is is common for all available Objects, for internal usage.

type MetadataHolder

type MetadataHolder struct {
	Metadata Metadata `yaml:"metadata"`
}

MetadataHolder is an intermediate structure that can provides metadata related field to other structures.

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 ObjectGeneric

type ObjectGeneric struct {
	ObjectHeader `yaml:",inline"`
}

ObjectGeneric represents struct to which every Objects is parsable Specific types of Object have different structures as Spec.

type ObjectHeader

type ObjectHeader struct {
	manifest.ObjectHeader `yaml:",inline"`
	Kind                  string `yaml:"kind" validate:"required,oneof=Service SLO AlertNotificationTarget" example:"kind"`
	MetadataHolder        `yaml:",inline"`
}

ObjectHeader is a header for all objects.

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 RatioMetrics

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

RatioMetrics base struct for ratio metrics.

type SLO

type SLO struct {
	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 {
	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