checks

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2021 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AlertsCheckName = "alerts/count"
)
View Source
const (
	AnnotationCheckName = "alerts/annotation"
)
View Source
const (
	ByCheckName = "promql/by"
)
View Source
const (
	ComparisonCheckName = "promql/comparison"
)
View Source
const (
	CostCheckName = "query/cost"
)
View Source
const (
	LabelCheckName = "rule/label"
)
View Source
const (
	RateCheckName = "promql/rate"
)
View Source
const (
	RejectCheckName = "rule/reject"
)
View Source
const (
	SeriesCheckName = "query/series"
)
View Source
const (
	SyntaxCheckName = "promql/syntax"
)
View Source
const (
	TemplateCheckName = "alerts/template"
)
View Source
const (
	WithoutCheckName = "promql/without"
)

Variables

Functions

This section is empty.

Types

type AlertsCheck

type AlertsCheck struct {
	// contains filtered or unexported fields
}

func NewAlertsCheck

func NewAlertsCheck(name, uri string, timeout, lookBack, step, resolve time.Duration) AlertsCheck

func (AlertsCheck) Check

func (c AlertsCheck) Check(rule parser.Rule) (problems []Problem)

func (AlertsCheck) String

func (c AlertsCheck) String() string

type AnnotationCheck

type AnnotationCheck struct {
	// contains filtered or unexported fields
}

func NewAnnotationCheck

func NewAnnotationCheck(key string, valueRe *regexp.Regexp, isReguired bool, severity Severity) AnnotationCheck

func (AnnotationCheck) Check

func (c AnnotationCheck) Check(rule parser.Rule) (problems []Problem)

func (AnnotationCheck) String

func (c AnnotationCheck) String() string

type ByCheck

type ByCheck struct {
	// contains filtered or unexported fields
}

func NewByCheck

func NewByCheck(nameRegex *regexp.Regexp, label string, keep bool, severity Severity) ByCheck

func (ByCheck) Check

func (c ByCheck) Check(rule parser.Rule) (problems []Problem)

func (ByCheck) String

func (c ByCheck) String() string

type ComparisonCheck

type ComparisonCheck struct {
	// contains filtered or unexported fields
}

func NewComparisonCheck

func NewComparisonCheck(severity Severity) ComparisonCheck

func (ComparisonCheck) Check

func (c ComparisonCheck) Check(rule parser.Rule) (problems []Problem)

func (ComparisonCheck) String

func (c ComparisonCheck) String() string

type CostCheck

type CostCheck struct {
	// contains filtered or unexported fields
}

func NewCostCheck

func NewCostCheck(name, uri string, timeout time.Duration, bps, maxSeries int, severity Severity) CostCheck

func (CostCheck) Check

func (c CostCheck) Check(rule parser.Rule) (problems []Problem)

func (CostCheck) String

func (c CostCheck) String() string

type LabelCheck

type LabelCheck struct {
	// contains filtered or unexported fields
}

func NewLabelCheck

func NewLabelCheck(key string, valueRe *regexp.Regexp, isReguired bool, severity Severity) LabelCheck

func (LabelCheck) Check

func (c LabelCheck) Check(rule parser.Rule) (problems []Problem)

func (LabelCheck) String

func (c LabelCheck) String() string

type Problem

type Problem struct {
	Fragment string
	Lines    []int
	Reporter string
	Text     string
	Severity Severity
}

func (Problem) LineRange

func (p Problem) LineRange() (int, int)

type RateCheck

type RateCheck struct {
	// contains filtered or unexported fields
}

func NewRateCheck

func NewRateCheck(name, uri string, timeout time.Duration) RateCheck

func (RateCheck) Check

func (c RateCheck) Check(rule parser.Rule) (problems []Problem)

func (RateCheck) String

func (c RateCheck) String() string

type Reject

type Reject struct {
	// contains filtered or unexported fields
}

func NewRejectCheck

func NewRejectCheck(l, a bool, k, v *regexp.Regexp, s Severity) Reject

func (Reject) Check

func (c Reject) Check(rule parser.Rule) (problems []Problem)

func (Reject) String

func (c Reject) String() string

type RuleChecker

type RuleChecker interface {
	String() string
	Check(rule parser.Rule) []Problem
}

type SeriesCheck

type SeriesCheck struct {
	// contains filtered or unexported fields
}

func NewSeriesCheck

func NewSeriesCheck(name, uri string, timeout time.Duration, severity Severity) SeriesCheck

func (SeriesCheck) Check

func (c SeriesCheck) Check(rule parser.Rule) (problems []Problem)

func (SeriesCheck) String

func (c SeriesCheck) String() string

type Severity

type Severity int

Severity of the problem reported

const (
	// Information doesn't count as a problem, it's a comment
	Information Severity = iota

	// Warning is not consider an error
	Warning

	// Bug is an error that should be corrected
	Bug

	// Fatal is a problem with linting content
	Fatal
)

func ParseSeverity

func ParseSeverity(s string) (Severity, error)

func (Severity) String

func (s Severity) String() string

type SyntaxCheck

type SyntaxCheck struct {
}

func NewSyntaxCheck

func NewSyntaxCheck() SyntaxCheck

func (SyntaxCheck) Check

func (c SyntaxCheck) Check(rule parser.Rule) (problems []Problem)

func (SyntaxCheck) String

func (c SyntaxCheck) String() string

type TemplateCheck

type TemplateCheck struct {
	// contains filtered or unexported fields
}

func NewTemplateCheck

func NewTemplateCheck(severity Severity) TemplateCheck

func (TemplateCheck) Check

func (c TemplateCheck) Check(rule parser.Rule) (problems []Problem)

func (TemplateCheck) String

func (c TemplateCheck) String() string

type WithoutCheck

type WithoutCheck struct {
	// contains filtered or unexported fields
}

func NewWithoutCheck

func NewWithoutCheck(nameRegex *regexp.Regexp, label string, keep bool, severity Severity) WithoutCheck

func (WithoutCheck) Check

func (c WithoutCheck) Check(rule parser.Rule) (problems []Problem)

func (WithoutCheck) String

func (c WithoutCheck) String() string

Jump to

Keyboard shortcuts

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