checks

package
v0.85.0 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2026 License: Apache-2.0 Imports: 37 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AlertsAbsentCheckName    = "alerts/absent"
	AlertsAbsentCheckDetails = "" /* 233-byte string literal not displayed */
)
View Source
const (
	ComparisonCheckName    = "alerts/comparison"
	ComparisonCheckDetails = `Prometheus alerting rules will trigger an alert for each query that returns *any* result.
Unless you do want an alert to always fire you should write your query in a way that returns results only when some condition is met.
In most cases this can be achieved by having some condition in the query expression.
For example ` + "`" + `up == 0` + "`" + " or " + "`" + "rate(error_total[2m]) > 0" + "`." + `
Be careful as some PromQL operations will cause the query to always return the results, for example using the [bool modifier](https://prometheus.io/docs/prometheus/latest/querying/operators/#comparison-binary-operators).`
)
View Source
const (
	AlertForCheckName         = "alerts/for"
	AlertForCheckDurationHelp = `Supported time durations are documented [here](https://prometheus.io/docs/prometheus/latest/querying/basics/#time-durations).`
)
View Source
const (
	TemplateCheckName             = "alerts/template"
	TemplateCheckSyntaxDetails    = `` /* 134-byte string literal not displayed */
	TemplateCheckReferenceDetails = "" /* 145-byte string literal not displayed */
)
View Source
const (
	CounterCheckName    = "promql/counter"
	CounterCheckDetails = `` /* 814-byte string literal not displayed */

)
View Source
const (
	FeaturesCheckName    = "promql/features"
	FeaturesCheckDetails = `This query uses PromQL features that require feature flags to be enabled on the Prometheus server via ` + "`--enable-feature=...`" + ` flag.
[Click here](https://prometheus.io/docs/prometheus/latest/feature_flags/) to see Prometheus feature flags documentation.`
)
View Source
const (
	FragileCheckName = "promql/fragile"

	FragileCheckSamplingDetails = `` /* 513-byte string literal not displayed */

	FragileCheckPartialData = `This alerting rule performs arithmetic operation on results of two aggregations, this might cause false positive alerts when Prometheus restarts.
When Prometheus is started it doesn't scrape all targets at once, it spreads it over the first scrape interval.
Until it finishes scraping all target queries that use aggregation will return results calculated from only a subset of targets.
If each of these aggregates comes from a different scrape job then one aggregate might have data from more targets then the other.
The easiest way to avoid such issues is to add ` + "`for: 2m` to you alerting rule."
)
View Source
const (
	RateCheckName    = "promql/rate"
	RateCheckDetails = `` /* 667-byte string literal not displayed */

)
View Source
const (
	RegexpCheckName = "promql/regexp"

	RegexpCheckDetails = `` /* 157-byte string literal not displayed */
)
View Source
const (
	SeriesCheckName        = "promql/series"
	SeriesCheckRuleDetails = `` /* 479-byte string literal not displayed */

	SeriesCheckCommonProblemDetails = `` /* 145-byte string literal not displayed */
	SeriesCheckMinAgeDetails        = `` /* 248-byte string literal not displayed */

	SeriesCheckUnusedDisableComment = "" /* 358-byte string literal not displayed */
	SeriesCheckUnusedRuleSetComment = "" /* 332-byte string literal not displayed */
)
View Source
const (
	SyntaxCheckName    = "promql/syntax"
	SyntaxCheckDetails = "[Click here](https://prometheus.io/docs/prometheus/latest/querying/basics/) for PromQL documentation."
)
View Source
const (
	VectorMatchingCheckName    = "promql/vector_matching"
	VectorMatchingCheckDetails = `` /* 360-byte string literal not displayed */

)
View Source
const (
	CostCheckName       = "query/cost"
	BytesPerSampleQuery = "avg(avg_over_time(go_memstats_alloc_bytes[2h]) / avg_over_time(prometheus_tsdb_head_series[2h]))"
)
View Source
const (
	AggregationCheckName = "promql/aggregate"
)
View Source
const (
	AlertsCheckName = "alerts/count"
)
View Source
const (
	AlertsExternalLabelsCheckName = "alerts/external_labels"
)
View Source
const (
	AnnotationCheckName = "alerts/annotation"
)
View Source
const (
	GroupIntervalCheckName = "group/interval"
)
View Source
const (
	ImpossibleCheckName = "promql/impossible"
)
View Source
const (
	LabelCheckName = "rule/label"
)
View Source
const (
	LabelsConflictCheckName = "labels/conflict"
)
View Source
const (
	OffsetCheckName = "promql/offset"
)
View Source
const (
	RangeQueryCheckName = "promql/range_query"
)
View Source
const (
	RejectCheckName = "rule/reject"
)
View Source
const (
	ReportCheckName = "rule/report"
)
View Source
const (
	RuleDependencyCheckName = "rule/dependency"
)
View Source
const (
	RuleDuplicateCheckName = "rule/duplicate"
)
View Source
const (
	RuleForCheckName = "rule/for"
)
View Source
const (
	RuleLinkCheckName = "rule/link"
)
View Source
const (
	RuleNameCheckName = "rule/name"
)
View Source
const (
	SelectorCheckName = "promql/selector"
)

Variables

Functions

func WholeRuleDiag added in v0.71.0

func WholeRuleDiag(rule parser.Rule, msg string) diags.Diagnostic

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, comment string, severity Severity) AggregationCheck

func (AggregationCheck) Check added in v0.6.0

func (c AggregationCheck) Check(_ context.Context, entry *discovery.Entry, _ []*discovery.Entry) (problems []Problem)

func (AggregationCheck) Meta added in v0.27.0

func (c AggregationCheck) Meta() CheckMeta

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 AlertsAbsentCheck added in v0.63.0

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

func NewAlertsAbsentCheck added in v0.63.0

func NewAlertsAbsentCheck(prom *promapi.FailoverGroup) AlertsAbsentCheck

func (AlertsAbsentCheck) Check added in v0.63.0

func (c AlertsAbsentCheck) Check(ctx context.Context, entry *discovery.Entry, _ []*discovery.Entry) (problems []Problem)

func (AlertsAbsentCheck) Meta added in v0.63.0

func (c AlertsAbsentCheck) Meta() CheckMeta

func (AlertsAbsentCheck) Reporter added in v0.63.0

func (c AlertsAbsentCheck) Reporter() string

func (AlertsAbsentCheck) String added in v0.63.0

func (c AlertsAbsentCheck) String() string

type AlertsCheck

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

func NewAlertsCheck

func NewAlertsCheck(prom *promapi.FailoverGroup, lookBack, step, resolve time.Duration, minCount int, comment string, severity Severity) AlertsCheck

func (AlertsCheck) Check

func (c AlertsCheck) Check(ctx context.Context, entry *discovery.Entry, _ []*discovery.Entry) (problems []Problem)

func (AlertsCheck) Meta added in v0.27.0

func (c AlertsCheck) Meta() CheckMeta

func (AlertsCheck) Reporter added in v0.7.0

func (c AlertsCheck) Reporter() string

func (AlertsCheck) String

func (c AlertsCheck) String() string

type AlertsExternalLabelsCheck added in v0.49.0

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

func NewAlertsExternalLabelsCheck added in v0.49.0

func NewAlertsExternalLabelsCheck(prom *promapi.FailoverGroup) AlertsExternalLabelsCheck

func (AlertsExternalLabelsCheck) Check added in v0.49.0

func (c AlertsExternalLabelsCheck) Check(ctx context.Context, entry *discovery.Entry, _ []*discovery.Entry) (problems []Problem)

func (AlertsExternalLabelsCheck) Meta added in v0.49.0

func (AlertsExternalLabelsCheck) Reporter added in v0.49.0

func (c AlertsExternalLabelsCheck) Reporter() string

func (AlertsExternalLabelsCheck) String added in v0.49.0

func (c AlertsExternalLabelsCheck) 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(_ context.Context, entry *discovery.Entry, _ []*discovery.Entry) (problems []Problem)

func (AlertsForChecksFor) Meta added in v0.27.0

func (c AlertsForChecksFor) Meta() CheckMeta

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 Anchor added in v0.51.0

type Anchor uint8
const (
	AnchorAfter Anchor = iota
	AnchorBefore
)

type AnnotationCheck

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

func NewAnnotationCheck

func NewAnnotationCheck(keyRe, tokenRe, valueRe *TemplatedRegexp, values []string, isRequired bool, comment string, severity Severity) AnnotationCheck

func (AnnotationCheck) Check

func (c AnnotationCheck) Check(_ context.Context, entry *discovery.Entry, _ []*discovery.Entry) (problems []Problem)

func (AnnotationCheck) Meta added in v0.27.0

func (c AnnotationCheck) Meta() CheckMeta

func (AnnotationCheck) Reporter added in v0.7.0

func (c AnnotationCheck) Reporter() string

func (AnnotationCheck) String

func (c AnnotationCheck) String() string

type CheckMeta added in v0.27.0

type CheckMeta struct {
	States        []discovery.ChangeType
	Online        bool
	AlwaysEnabled bool
}

type ComparisonCheck

type ComparisonCheck struct{}

func NewComparisonCheck

func NewComparisonCheck() ComparisonCheck

func (ComparisonCheck) Check

func (c ComparisonCheck) Check(_ context.Context, entry *discovery.Entry, _ []*discovery.Entry) (problems []Problem)

func (ComparisonCheck) Meta added in v0.27.0

func (c ComparisonCheck) Meta() CheckMeta

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, maxSeries, maxTotalSamples, maxPeakSamples int, maxEvaluationDuration time.Duration, comment string, severity Severity) CostCheck

func (CostCheck) Check

func (c CostCheck) Check(ctx context.Context, entry *discovery.Entry, entries []*discovery.Entry) (problems []Problem)

func (CostCheck) Meta added in v0.27.0

func (c CostCheck) Meta() CheckMeta

func (CostCheck) Reporter added in v0.7.0

func (c CostCheck) Reporter() string

func (CostCheck) String

func (c CostCheck) String() string

type CounterCheck added in v0.56.0

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

func NewCounterCheck added in v0.56.0

func NewCounterCheck(prom *promapi.FailoverGroup) CounterCheck

func (CounterCheck) Check added in v0.56.0

func (c CounterCheck) Check(ctx context.Context, entry *discovery.Entry, _ []*discovery.Entry) (problems []Problem)

func (CounterCheck) Meta added in v0.56.0

func (c CounterCheck) Meta() CheckMeta

func (CounterCheck) Reporter added in v0.56.0

func (c CounterCheck) Reporter() string

func (CounterCheck) String added in v0.56.0

func (c CounterCheck) String() string

type ErrorCheck added in v0.65.0

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

func NewErrorCheck added in v0.65.0

func NewErrorCheck(entry *discovery.Entry) ErrorCheck

func (ErrorCheck) Check added in v0.65.0

func (c ErrorCheck) Check(_ context.Context, _ *discovery.Entry, _ []*discovery.Entry) (problems []Problem)

func (ErrorCheck) Meta added in v0.65.0

func (c ErrorCheck) Meta() CheckMeta

func (ErrorCheck) Reporter added in v0.65.0

func (c ErrorCheck) Reporter() string

func (ErrorCheck) String added in v0.65.0

func (c ErrorCheck) String() string

type FeaturesCheck added in v0.80.0

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

func NewFeaturesCheck added in v0.80.0

func NewFeaturesCheck(prom *promapi.FailoverGroup) FeaturesCheck

func (FeaturesCheck) Check added in v0.80.0

func (c FeaturesCheck) Check(ctx context.Context, entry *discovery.Entry, _ []*discovery.Entry) (problems []Problem)

func (FeaturesCheck) Meta added in v0.80.0

func (c FeaturesCheck) Meta() CheckMeta

func (FeaturesCheck) Reporter added in v0.80.0

func (c FeaturesCheck) Reporter() string

func (FeaturesCheck) String added in v0.80.0

func (c FeaturesCheck) 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(_ context.Context, entry *discovery.Entry, _ []*discovery.Entry) (problems []Problem)

func (FragileCheck) Meta added in v0.27.0

func (c FragileCheck) Meta() CheckMeta

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 GroupIntervalCheck added in v0.80.0

type GroupIntervalCheck struct{}

func NewGroupIntervalCheck added in v0.80.0

func NewGroupIntervalCheck() GroupIntervalCheck

func (GroupIntervalCheck) Check added in v0.80.0

func (c GroupIntervalCheck) Check(_ context.Context, entry *discovery.Entry, _ []*discovery.Entry) (problems []Problem)

func (GroupIntervalCheck) Meta added in v0.80.0

func (c GroupIntervalCheck) Meta() CheckMeta

func (GroupIntervalCheck) Reporter added in v0.80.0

func (c GroupIntervalCheck) Reporter() string

func (GroupIntervalCheck) String added in v0.80.0

func (c GroupIntervalCheck) String() string

type ImpossibleCheck added in v0.71.0

type ImpossibleCheck struct{}

func NewImpossibleCheck added in v0.71.0

func NewImpossibleCheck() ImpossibleCheck

func (ImpossibleCheck) Check added in v0.71.0

func (c ImpossibleCheck) Check(_ context.Context, entry *discovery.Entry, _ []*discovery.Entry) (problems []Problem)

func (ImpossibleCheck) Meta added in v0.71.0

func (c ImpossibleCheck) Meta() CheckMeta

func (ImpossibleCheck) Reporter added in v0.71.0

func (c ImpossibleCheck) Reporter() string

func (ImpossibleCheck) String added in v0.71.0

func (c ImpossibleCheck) String() string

type LabelCheck

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

func NewLabelCheck

func NewLabelCheck(keyRe, tokenRe, valueRe *TemplatedRegexp, values []string, isRequired bool, comment string, severity Severity) LabelCheck

func (LabelCheck) Check

func (c LabelCheck) Check(_ context.Context, entry *discovery.Entry, _ []*discovery.Entry) (problems []Problem)

func (LabelCheck) Meta added in v0.27.0

func (c LabelCheck) Meta() CheckMeta

func (LabelCheck) Reporter added in v0.7.0

func (c LabelCheck) Reporter() string

func (LabelCheck) String

func (c LabelCheck) String() string

type LabelsConflictCheck added in v0.35.0

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

func NewLabelsConflictCheck added in v0.35.0

func NewLabelsConflictCheck(prom *promapi.FailoverGroup) LabelsConflictCheck

func (LabelsConflictCheck) Check added in v0.35.0

func (c LabelsConflictCheck) Check(ctx context.Context, entry *discovery.Entry, _ []*discovery.Entry) (problems []Problem)

func (LabelsConflictCheck) Meta added in v0.35.0

func (c LabelsConflictCheck) Meta() CheckMeta

func (LabelsConflictCheck) Reporter added in v0.35.0

func (c LabelsConflictCheck) Reporter() string

func (LabelsConflictCheck) String added in v0.35.0

func (c LabelsConflictCheck) String() string

type OffsetCheck added in v0.85.0

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

func NewOffsetCheck added in v0.85.0

func NewOffsetCheck(prom *promapi.FailoverGroup) OffsetCheck

func (OffsetCheck) Check added in v0.85.0

func (c OffsetCheck) Check(ctx context.Context, entry *discovery.Entry, _ []*discovery.Entry) (problems []Problem)

func (OffsetCheck) Meta added in v0.85.0

func (c OffsetCheck) Meta() CheckMeta

func (OffsetCheck) Reporter added in v0.85.0

func (c OffsetCheck) Reporter() string

func (OffsetCheck) String added in v0.85.0

func (c OffsetCheck) String() string

type Problem

type Problem struct {
	Reporter    string
	Summary     string
	Details     string
	Diagnostics []diags.Diagnostic
	Lines       diags.LineRange
	Severity    Severity
	Anchor      Anchor
}

type PromqlRegexpSettings added in v0.67.0

type PromqlRegexpSettings struct {
	Smelly *bool `hcl:"smelly,optional" json:"smelly,omitempty"`
	// contains filtered or unexported fields
}

func (*PromqlRegexpSettings) Validate added in v0.67.0

func (c *PromqlRegexpSettings) Validate() error

type PromqlSeriesSettings added in v0.23.0

type PromqlSeriesSettings struct {
	IgnoreLabelsValue       map[string][]string `hcl:"ignoreLabelsValue,optional" json:"ignoreLabelsValue,omitempty"`
	LookbackRange           string              `hcl:"lookbackRange,optional" json:"lookbackRange,omitempty"`
	LookbackStep            string              `hcl:"lookbackStep,optional" json:"lookbackStep,omitempty"`
	IgnoreMetrics           []string            `hcl:"ignoreMetrics,optional" json:"ignoreMetrics,omitempty"`
	IgnoreMatchingElsewhere []string            `hcl:"ignoreMatchingElsewhere,optional" json:"ignoreMatchingElsewhere,omitempty"`
	FallbackTimeout         string              `hcl:"fallbackTimeout,optional" json:"fallbackTimeout,omitempty"`
	// contains filtered or unexported fields
}

func (*PromqlSeriesSettings) Validate added in v0.23.0

func (c *PromqlSeriesSettings) Validate() error

type RangeQueryCheck added in v0.26.0

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

func NewRangeQueryCheck added in v0.26.0

func NewRangeQueryCheck(prom *promapi.FailoverGroup, limit time.Duration, comment string, severity Severity) RangeQueryCheck

func (RangeQueryCheck) Check added in v0.26.0

func (c RangeQueryCheck) Check(ctx context.Context, entry *discovery.Entry, _ []*discovery.Entry) (problems []Problem)

func (RangeQueryCheck) Meta added in v0.27.0

func (c RangeQueryCheck) Meta() CheckMeta

func (RangeQueryCheck) Reporter added in v0.26.0

func (c RangeQueryCheck) Reporter() string

func (RangeQueryCheck) String added in v0.26.0

func (c RangeQueryCheck) String() string

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, entry *discovery.Entry, entries []*discovery.Entry) (problems []Problem)

func (RateCheck) Meta added in v0.27.0

func (c RateCheck) Meta() CheckMeta

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, entry *discovery.Entry, _ []*discovery.Entry) (problems []Problem)

func (RegexpCheck) Meta added in v0.27.0

func (c RegexpCheck) Meta() CheckMeta

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(_ context.Context, entry *discovery.Entry, _ []*discovery.Entry) (problems []Problem)

func (Reject) Meta added in v0.27.0

func (c Reject) Meta() CheckMeta

func (Reject) Reporter added in v0.7.0

func (c Reject) Reporter() string

func (Reject) String

func (c Reject) String() string

type ReportCheck added in v0.68.0

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

func NewReportCheck added in v0.68.0

func NewReportCheck(c string, s Severity) ReportCheck

func (ReportCheck) Check added in v0.68.0

func (c ReportCheck) Check(_ context.Context, entry *discovery.Entry, _ []*discovery.Entry) (problems []Problem)

func (ReportCheck) Meta added in v0.68.0

func (c ReportCheck) Meta() CheckMeta

func (ReportCheck) Reporter added in v0.68.0

func (c ReportCheck) Reporter() string

func (ReportCheck) String added in v0.68.0

func (c ReportCheck) String() string

type RuleChecker

type RuleChecker interface {
	String() string
	Reporter() string
	Meta() CheckMeta
	Check(_ context.Context, entry *discovery.Entry, _ []*discovery.Entry) []Problem
}

type RuleDependencyCheck added in v0.51.0

type RuleDependencyCheck struct{}

func NewRuleDependencyCheck added in v0.51.0

func NewRuleDependencyCheck() RuleDependencyCheck

func (RuleDependencyCheck) Check added in v0.51.0

func (c RuleDependencyCheck) Check(ctx context.Context, entry *discovery.Entry, entries []*discovery.Entry) (problems []Problem)

func (RuleDependencyCheck) Meta added in v0.51.0

func (c RuleDependencyCheck) Meta() CheckMeta

func (RuleDependencyCheck) Reporter added in v0.51.0

func (c RuleDependencyCheck) Reporter() string

func (RuleDependencyCheck) String added in v0.51.0

func (c RuleDependencyCheck) String() string

type RuleDependencySettings added in v0.83.0

type RuleDependencySettings struct {
	IgnoreGroupMismatch []string `hcl:"ignoreGroupMismatch,optional" json:"ignoreGroupMismatch,omitempty"`
	// contains filtered or unexported fields
}

func (*RuleDependencySettings) Validate added in v0.83.0

func (c *RuleDependencySettings) Validate() error

type RuleDuplicateCheck added in v0.34.0

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

func NewRuleDuplicateCheck added in v0.34.0

func NewRuleDuplicateCheck(prom *promapi.FailoverGroup) RuleDuplicateCheck

func (RuleDuplicateCheck) Check added in v0.34.0

func (c RuleDuplicateCheck) Check(ctx context.Context, entry *discovery.Entry, entries []*discovery.Entry) (problems []Problem)

func (RuleDuplicateCheck) Meta added in v0.34.0

func (c RuleDuplicateCheck) Meta() CheckMeta

func (RuleDuplicateCheck) Reporter added in v0.34.0

func (c RuleDuplicateCheck) Reporter() string

func (RuleDuplicateCheck) String added in v0.34.0

func (c RuleDuplicateCheck) String() string

type RuleForCheck added in v0.41.0

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

func NewRuleForCheck added in v0.41.0

func NewRuleForCheck(key RuleForKey, minFor, maxFor time.Duration, comment string, severity Severity) RuleForCheck

func (RuleForCheck) Check added in v0.41.0

func (c RuleForCheck) Check(_ context.Context, entry *discovery.Entry, _ []*discovery.Entry) (problems []Problem)

func (RuleForCheck) Meta added in v0.41.0

func (c RuleForCheck) Meta() CheckMeta

func (RuleForCheck) Reporter added in v0.41.0

func (c RuleForCheck) Reporter() string

func (RuleForCheck) String added in v0.41.0

func (c RuleForCheck) String() string

type RuleForKey added in v0.46.0

type RuleForKey string
const (
	RuleForFor           RuleForKey = "for"
	RuleForKeepFiringFor RuleForKey = "keep_firing_for"
)

type RuleLinkCheck added in v0.27.0

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

func NewRuleLinkCheck added in v0.27.0

func NewRuleLinkCheck(re *TemplatedRegexp, uriRewrite string, timeout time.Duration, headers map[string]string, comment string, s Severity) RuleLinkCheck

func (RuleLinkCheck) Check added in v0.27.0

func (c RuleLinkCheck) Check(ctx context.Context, entry *discovery.Entry, _ []*discovery.Entry) (problems []Problem)

func (RuleLinkCheck) Meta added in v0.27.0

func (c RuleLinkCheck) Meta() CheckMeta

func (RuleLinkCheck) Reporter added in v0.27.0

func (c RuleLinkCheck) Reporter() string

func (RuleLinkCheck) String added in v0.27.0

func (c RuleLinkCheck) String() string

type RuleNameCheck added in v0.63.0

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

func NewRuleNameCheck added in v0.63.0

func NewRuleNameCheck(re *TemplatedRegexp, comment string, severity Severity) RuleNameCheck

func (RuleNameCheck) Check added in v0.63.0

func (c RuleNameCheck) Check(_ context.Context, entry *discovery.Entry, _ []*discovery.Entry) (problems []Problem)

func (RuleNameCheck) Meta added in v0.63.0

func (c RuleNameCheck) Meta() CheckMeta

func (RuleNameCheck) Reporter added in v0.63.0

func (c RuleNameCheck) Reporter() string

func (RuleNameCheck) String added in v0.63.0

func (c RuleNameCheck) String() string

type SelectorCheck added in v0.75.0

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

func NewSelectorCheck added in v0.75.0

func NewSelectorCheck(keyRe, callRe *TemplatedRegexp, requiredName, comment string, severity Severity) SelectorCheck

func (SelectorCheck) Check added in v0.75.0

func (c SelectorCheck) Check(_ context.Context, entry *discovery.Entry, _ []*discovery.Entry) (problems []Problem)

func (SelectorCheck) Meta added in v0.75.0

func (c SelectorCheck) Meta() CheckMeta

func (SelectorCheck) Reporter added in v0.75.0

func (c SelectorCheck) Reporter() string

func (SelectorCheck) String added in v0.75.0

func (c SelectorCheck) String() string

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, entry *discovery.Entry, entries []*discovery.Entry) (problems []Problem)

func (SeriesCheck) Meta added in v0.27.0

func (c SeriesCheck) Meta() CheckMeta

func (SeriesCheck) Reporter added in v0.7.0

func (c SeriesCheck) Reporter() string

func (SeriesCheck) String

func (c SeriesCheck) String() string

type SettingsKey added in v0.23.0

type SettingsKey string

type Severity

type Severity uint8

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(_ context.Context, entry *discovery.Entry, _ []*discovery.Entry) (problems []Problem)

func (SyntaxCheck) Meta added in v0.27.0

func (c SyntaxCheck) Meta() CheckMeta

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, entry *discovery.Entry, _ []*discovery.Entry) (problems []Problem)

func (TemplateCheck) Meta added in v0.27.0

func (c TemplateCheck) Meta() CheckMeta

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 {
	Labels      map[string]string
	Annotations map[string]string
	Alert       string
	Record      string
	Expr        string
	For         string
}

type TemplatedRegexp added in v0.14.0

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

func MustRawTemplatedRegexp added in v0.52.0

func MustRawTemplatedRegexp(re string) *TemplatedRegexp

func MustTemplatedRegexp added in v0.14.0

func MustTemplatedRegexp(re string) *TemplatedRegexp

func NewRawTemplatedRegexp added in v0.52.0

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

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, entry *discovery.Entry, _ []*discovery.Entry) (problems []Problem)

func (VectorMatchingCheck) Meta added in v0.27.0

func (c VectorMatchingCheck) Meta() CheckMeta

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