checks

package
v0.22.2 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2022 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AggregationCheckName = "promql/aggregate"
)
View Source
const (
	AlertForCheckName = "alerts/for"
)
View Source
const (
	AlertsCheckName = "alerts/count"
)
View Source
const (
	AnnotationCheckName = "alerts/annotation"
)
View Source
const (
	ComparisonCheckName = "alerts/comparison"
)
View Source
const (
	CostCheckName = "query/cost"
)
View Source
const (
	FragileCheckName = "promql/fragile"
)
View Source
const (
	LabelCheckName = "rule/label"
)
View Source
const (
	RateCheckName = "promql/rate"
)
View Source
const (
	RegexpCheckName = "promql/regexp"
)
View Source
const (
	RejectCheckName = "rule/reject"
)
View Source
const (
	SeriesCheckName = "promql/series"
)
View Source
const (
	SyntaxCheckName = "promql/syntax"
)
View Source
const (
	TemplateCheckName = "alerts/template"
)
View Source
const (
	VectorMatchingCheckName = "promql/vector_matching"
)

Variables

Functions

This section is empty.

Types

type AggregationCheck added in v0.6.0

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

func NewAggregationCheck added in v0.6.0

func NewAggregationCheck(nameRegex *TemplatedRegexp, label string, keep bool, severity Severity) AggregationCheck

func (AggregationCheck) Check added in v0.6.0

func (c AggregationCheck) Check(ctx context.Context, rule parser.Rule, entries []discovery.Entry) (problems []Problem)

func (AggregationCheck) Reporter added in v0.7.0

func (c AggregationCheck) Reporter() string

func (AggregationCheck) String added in v0.6.0

func (c AggregationCheck) String() string

type AlertsCheck

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

func NewAlertsCheck

func NewAlertsCheck(prom *promapi.FailoverGroup, lookBack, step, resolve time.Duration) AlertsCheck

func (AlertsCheck) Check

func (c AlertsCheck) Check(ctx context.Context, rule parser.Rule, entries []discovery.Entry) (problems []Problem)

func (AlertsCheck) Reporter added in v0.7.0

func (c AlertsCheck) Reporter() string

func (AlertsCheck) String

func (c AlertsCheck) String() string

type AlertsForChecksFor added in v0.5.0

type AlertsForChecksFor struct{}

func NewAlertsForCheck added in v0.5.0

func NewAlertsForCheck() AlertsForChecksFor

func (AlertsForChecksFor) Check added in v0.5.0

func (c AlertsForChecksFor) Check(ctx context.Context, rule parser.Rule, entries []discovery.Entry) (problems []Problem)

func (AlertsForChecksFor) Reporter added in v0.7.0

func (c AlertsForChecksFor) Reporter() string

func (AlertsForChecksFor) String added in v0.5.0

func (c AlertsForChecksFor) String() string

type AnnotationCheck

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

func NewAnnotationCheck

func NewAnnotationCheck(key string, valueRe *TemplatedRegexp, isReguired bool, severity Severity) AnnotationCheck

func (AnnotationCheck) Check

func (c AnnotationCheck) Check(ctx context.Context, rule parser.Rule, entries []discovery.Entry) (problems []Problem)

func (AnnotationCheck) Reporter added in v0.7.0

func (c AnnotationCheck) Reporter() string

func (AnnotationCheck) String

func (c AnnotationCheck) String() string

type ComparisonCheck

type ComparisonCheck struct{}

func NewComparisonCheck

func NewComparisonCheck() ComparisonCheck

func (ComparisonCheck) Check

func (c ComparisonCheck) Check(ctx context.Context, rule parser.Rule, entries []discovery.Entry) (problems []Problem)

func (ComparisonCheck) Reporter added in v0.7.0

func (c ComparisonCheck) Reporter() string

func (ComparisonCheck) String

func (c ComparisonCheck) String() string

type CostCheck

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

func NewCostCheck

func NewCostCheck(prom *promapi.FailoverGroup, bps, maxSeries int, severity Severity) CostCheck

func (CostCheck) Check

func (c CostCheck) Check(ctx context.Context, rule parser.Rule, entries []discovery.Entry) (problems []Problem)

func (CostCheck) Reporter added in v0.7.0

func (c CostCheck) Reporter() string

func (CostCheck) String

func (c CostCheck) String() string

type FragileCheck added in v0.8.0

type FragileCheck struct{}

func NewFragileCheck added in v0.8.0

func NewFragileCheck() FragileCheck

func (FragileCheck) Check added in v0.8.0

func (c FragileCheck) Check(ctx context.Context, rule parser.Rule, entries []discovery.Entry) (problems []Problem)

func (FragileCheck) Reporter added in v0.8.0

func (c FragileCheck) Reporter() string

func (FragileCheck) String added in v0.8.0

func (c FragileCheck) String() string

type LabelCheck

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

func NewLabelCheck

func NewLabelCheck(key string, valueRe *TemplatedRegexp, isReguired bool, severity Severity) LabelCheck

func (LabelCheck) Check

func (c LabelCheck) Check(ctx context.Context, rule parser.Rule, entries []discovery.Entry) (problems []Problem)

func (LabelCheck) Reporter added in v0.7.0

func (c LabelCheck) Reporter() string

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(prom *promapi.FailoverGroup) RateCheck

func (RateCheck) Check

func (c RateCheck) Check(ctx context.Context, rule parser.Rule, entries []discovery.Entry) (problems []Problem)

func (RateCheck) Reporter added in v0.7.0

func (c RateCheck) Reporter() string

func (RateCheck) String

func (c RateCheck) String() string

type RegexpCheck added in v0.11.0

type RegexpCheck struct{}

func NewRegexpCheck added in v0.11.0

func NewRegexpCheck() RegexpCheck

func (RegexpCheck) Check added in v0.11.0

func (c RegexpCheck) Check(ctx context.Context, rule parser.Rule, entries []discovery.Entry) (problems []Problem)

func (RegexpCheck) Reporter added in v0.11.0

func (c RegexpCheck) Reporter() string

func (RegexpCheck) String added in v0.11.0

func (c RegexpCheck) String() string

type Reject

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

func NewRejectCheck

func NewRejectCheck(l, a bool, k, v *TemplatedRegexp, s Severity) Reject

func (Reject) Check

func (c Reject) Check(ctx context.Context, rule parser.Rule, entries []discovery.Entry) (problems []Problem)

func (Reject) Reporter added in v0.7.0

func (c Reject) Reporter() string

func (Reject) String

func (c Reject) String() string

type RuleChecker

type RuleChecker interface {
	String() string
	Reporter() string
	Check(ctx context.Context, rule parser.Rule, entries []discovery.Entry) []Problem
}

type SeriesCheck

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

func NewSeriesCheck

func NewSeriesCheck(prom *promapi.FailoverGroup) SeriesCheck

func (SeriesCheck) Check

func (c SeriesCheck) Check(ctx context.Context, rule parser.Rule, entries []discovery.Entry) (problems []Problem)

func (SeriesCheck) Reporter added in v0.7.0

func (c SeriesCheck) Reporter() string

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(ctx context.Context, rule parser.Rule, entries []discovery.Entry) (problems []Problem)

func (SyntaxCheck) Reporter added in v0.7.0

func (c SyntaxCheck) Reporter() string

func (SyntaxCheck) String

func (c SyntaxCheck) String() string

type TemplateCheck

type TemplateCheck struct{}

func NewTemplateCheck

func NewTemplateCheck() TemplateCheck

func (TemplateCheck) Check

func (c TemplateCheck) Check(ctx context.Context, rule parser.Rule, entries []discovery.Entry) (problems []Problem)

func (TemplateCheck) Reporter added in v0.7.0

func (c TemplateCheck) Reporter() string

func (TemplateCheck) String

func (c TemplateCheck) String() string

type TemplateContext added in v0.14.0

type TemplateContext struct {
	Alert       string
	Record      string
	Expr        string
	For         string
	Labels      map[string]string
	Annotations map[string]string
}

func (TemplateContext) Aliases added in v0.14.0

func (tc TemplateContext) Aliases() string

type TemplatedRegexp added in v0.14.0

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

func MustTemplatedRegexp added in v0.14.0

func MustTemplatedRegexp(re string) *TemplatedRegexp

func NewTemplatedRegexp added in v0.14.0

func NewTemplatedRegexp(s string) (*TemplatedRegexp, error)

func (TemplatedRegexp) Expand added in v0.14.0

func (tr TemplatedRegexp) Expand(rule parser.Rule) (*regexp.Regexp, error)

func (TemplatedRegexp) MustExpand added in v0.14.0

func (tr TemplatedRegexp) MustExpand(rule parser.Rule) *regexp.Regexp

type VectorMatchingCheck added in v0.1.3

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

func NewVectorMatchingCheck added in v0.1.3

func NewVectorMatchingCheck(prom *promapi.FailoverGroup) VectorMatchingCheck

func (VectorMatchingCheck) Check added in v0.1.3

func (c VectorMatchingCheck) Check(ctx context.Context, rule parser.Rule, entries []discovery.Entry) (problems []Problem)

func (VectorMatchingCheck) Reporter added in v0.7.0

func (c VectorMatchingCheck) Reporter() string

func (VectorMatchingCheck) String added in v0.1.3

func (c VectorMatchingCheck) String() string

Jump to

Keyboard shortcuts

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