indicator

package
v0.7.5 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2019 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ChartTypes = []ChartType{StepChart, BarChart}

Functions

func ApplyPatches

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

func MatchDocument

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

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)

func Validate

func Validate(document Document) []error

Types

type Alert

type Alert struct {
	For  string
	Step string
}

type ChartType

type ChartType string
const (
	StepChart ChartType = "step"
	BarChart  ChartType = "bar"
)

type Document

type Document struct {
	APIVersion string
	Product    Product
	Metadata   map[string]string
	Indicators []Indicator
	Layout     Layout
}

func ProcessDocument

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

func ReadFile

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

func ReadIndicatorDocument

func ReadIndicatorDocument(yamlBytes []byte, opts ...ReadOpt) (Document, error)

type Indicator

type Indicator struct {
	Name          string
	PromQL        string
	Thresholds    []Threshold
	Alert         Alert
	Documentation map[string]string
	Presentation  *Presentation
}

type Layout

type Layout struct {
	Title       string
	Description string
	Sections    []Section
	Owner       string
}

type Match

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

type OperatorType

type OperatorType int
const (
	LessThan OperatorType = iota
	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 ReadPatchBytes

func ReadPatchBytes(yamlBytes []byte) (Patch, error)

func ReadPatchFile

func ReadPatchFile(patchFile string) (Patch, error)

type Presentation

type Presentation struct {
	ChartType
	CurrentValue bool
	Frequency    time.Duration
	Labels       []string
}

type Product

type Product struct {
	Name    string
	Version string
}

type ReadOpt

type ReadOpt func(options *readOptions)

type Section

type Section struct {
	Title       string
	Description string
	Indicators  []Indicator
}

type Threshold

type Threshold struct {
	Level    string
	Operator OperatorType
	Value    float64
}

func (*Threshold) GetComparator

func (e *Threshold) GetComparator() string

func (*Threshold) GetComparatorAbbrev

func (e *Threshold) GetComparatorAbbrev() string

Jump to

Keyboard shortcuts

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