indicator

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2019 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

func ApplyPatches

func ApplyPatches(patches []Patch, documentBytes []byte) ([]byte, error)

func MatchDocument

func MatchDocument(criteria Match, documentBytes []byte) bool

func MetadataFromYAML added in v0.7.15

func MetadataFromYAML(reader io.ReadCloser) (map[string]string, error)

func OverrideMetadata

func OverrideMetadata(overrideMetadata map[string]string) func(options *readOptions)

func ParseMetadata

func ParseMetadata(input string) map[string]string

func SkipMetadataInterpolation

func SkipMetadataInterpolation(options *readOptions)

Types

type Alert

type Alert struct {
	For  string `yaml:"for"`
	Step string `yaml:"step"`
}

type ChartType

type ChartType string
const (
	StepChart   ChartType = "step"
	BarChart    ChartType = "bar"
	StatusChart ChartType = "status"
	QuotaChart  ChartType = "quota"
)

func (*ChartType) Validate added in v0.8.1

func (chartType *ChartType) Validate(idx int) []error

type Document

type Document struct {
	APIVersion string            `yaml:"apiVersion"`
	Product    Product           `yaml:"product"`
	Metadata   map[string]string `yaml:"metadata"`
	Indicators []Indicator       `yaml:"indicators"`
	Layout     Layout            `yaml:"layout"`
}

func DocumentFromYAML added in v0.7.15

func DocumentFromYAML(reader io.ReadCloser) (Document, error)

func ProcessDocument

func ProcessDocument(patches []Patch, documentBytes []byte) (Document, []error)

func ReadFile

func ReadFile(indicatorsFile string, opts ...ReadOpt) (Document, error)

func (Document) GetIndicator added in v0.7.11

func (document Document) GetIndicator(name string) (Indicator, bool)

func (*Document) Interpolate added in v0.8.1

func (document *Document) Interpolate()

func (*Document) OverrideMetadata added in v0.8.1

func (document *Document) OverrideMetadata(overrides map[string]string)

func (Document) UID added in v0.7.10

func (document Document) UID() string

func (*Document) Validate added in v0.8.1

func (document *Document) Validate(supportedApiVersion ...string) []error

type Indicator

type Indicator struct {
	Name          string            `yaml:"name"`
	PromQL        string            `yaml:"promql"`
	Thresholds    []Threshold       `yaml:"thresholds,omitempty"`
	Alert         Alert             `yaml:"alert"`
	ServiceLevel  *ServiceLevel     `yaml:"serviceLevel"`
	Documentation map[string]string `yaml:"documentation,omitempty"`
	Presentation  Presentation      `yaml:"presentation"`
}

func (*Indicator) Validate added in v0.8.1

func (indicator *Indicator) Validate(idx int, apiVersion string) []error

type Layout

type Layout struct {
	Title       string    `yaml:"title"`
	Description string    `yaml:"description"`
	Sections    []Section `yaml:"sections"`
	Owner       string    `yaml:"owner"`
}

type Match

type Match struct {
	Name     *string
	Version  *string
	Metadata map[string]string
}

type OperatorType

type OperatorType int
const (
	Undefined OperatorType = iota
	LessThan
	LessThanOrEqualTo
	EqualTo
	NotEqualTo
	GreaterThanOrEqualTo
	GreaterThan
)

func GetComparatorFromString

func GetComparatorFromString(operator string) OperatorType

type Patch

type Patch struct {
	APIVersion string
	Match      Match
	Operations []patch.OpDefinition
}

func PatchFromYAML added in v0.7.15

func PatchFromYAML(reader io.ReadCloser) (Patch, error)

func ReadPatchFile

func ReadPatchFile(patchFile string) (Patch, error)

type Presentation

type Presentation struct {
	ChartType    ChartType `yaml:"chartType"`
	CurrentValue bool      `yaml:"currentValue"`
	Frequency    int64     `yaml:"frequency"`
	Labels       []string  `yaml:"labels"`
	Units        string    `yaml:"units"`
}

type Product

type Product struct {
	Name    string `yaml:"name"`
	Version string `yaml:"version"`
}

func ProductFromYAML added in v0.7.15

func ProductFromYAML(reader io.ReadCloser) (Product, error)

type ReadOpt

type ReadOpt func(options *readOptions)

type Section

type Section struct {
	Title       string   `yaml:"title"`
	Description string   `yaml:"description"`
	Indicators  []string `yaml:"indicators"`
}

type ServiceLevel added in v0.7.11

type ServiceLevel struct {
	Objective float64 `yaml:"objective"`
}

type Threshold

type Threshold struct {
	Level    string       `yaml:"level"`
	Operator OperatorType `yaml:"operator"`
	Value    float64      `yaml:"value"`
}

func (*Threshold) GetComparator

func (t *Threshold) GetComparator() string

func (*Threshold) GetComparatorAbbrev

func (t *Threshold) GetComparatorAbbrev() string

func (*Threshold) UnmarshalYAML added in v0.8.1

func (t *Threshold) UnmarshalYAML(unmarshal func(v interface{}) error) error

Jump to

Keyboard shortcuts

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