Documentation ¶
Index ¶
- Constants
- Variables
- type AggregationCheck
- type AlertsCheck
- type AlertsExternalLabelsCheck
- type AlertsForChecksFor
- type Anchor
- type AnnotationCheck
- type CheckMeta
- type ComparisonCheck
- type CostCheck
- type CounterCheck
- type FragileCheck
- type LabelCheck
- type LabelsConflictCheck
- type Problem
- type PromqlSeriesSettings
- type RangeQueryCheck
- type RateCheck
- type RegexpCheck
- type Reject
- type RuleChecker
- type RuleDependencyCheck
- type RuleDuplicateCheck
- type RuleForCheck
- type RuleForKey
- type RuleLinkCheck
- type SeriesCheck
- type SettingsKey
- type Severity
- type SyntaxCheck
- type TemplateCheck
- type TemplateContext
- type TemplatedRegexp
- type VectorMatchingCheck
Constants ¶
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 */ TemplateCheckAggregationDetails = `` /* 400-byte string literal not displayed */ TemplateCheckAbsentDetails = `The [absent()](https://prometheus.io/docs/prometheus/latest/querying/functions/#absent) function is used to check if provided query doesn't match any time series. You will only get any results back if the metric selector you pass doesn't match anything. Since there are no matching time series there are also no labels. If some time series is missing you cannot read its labels. This means that the only labels you can get back from absent call are the ones you pass to it. If you're hoping to get instance specific labels this way and alert when some target is down then that won't work, use the ` + "`up`" + ` metric instead.` TemplateCheckOnDetails = `Using [vector matching](https://prometheus.io/docs/prometheus/latest/querying/operators/#vector-matching) operations will impact which labels are available on the results of your query. When using ` + "`on()`" + `make sure that all labels you're trying to use in this templare match what the query can return.` TemplateCheckLabelsDetails = `This query doesn't seem to be using any time series and so cannot have any labels.` )
View Source
const ( CounterCheckName = "promql/counter" CounterCheckDetails = `` /* 814-byte string literal not displayed */ )
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 */ )
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 (
FragileCheckName = "promql/fragile"
)
View Source
const (
LabelCheckName = "rule/label"
)
View Source
const (
LabelsConflictCheckName = "labels/conflict"
)
View Source
const (
RangeQueryCheckName = "promql/range_query"
)
View Source
const (
RejectCheckName = "rule/reject"
)
View Source
const (
RuleDependencyCheckName = "rule/dependency"
)
View Source
const (
RuleDuplicateCheckName = "rule/duplicate"
)
View Source
const (
RuleForCheckName = "rule/for"
)
View Source
const (
RuleLinkCheckName = "rule/link"
)
Variables ¶
View Source
var ( CheckNames = []string{ AnnotationCheckName, AlertsCheckName, AlertsExternalLabelsCheckName, AlertForCheckName, TemplateCheckName, LabelsConflictCheckName, AggregationCheckName, ComparisonCheckName, FragileCheckName, RangeQueryCheckName, RateCheckName, RegexpCheckName, SyntaxCheckName, VectorMatchingCheckName, CostCheckName, CounterCheckName, SeriesCheckName, RuleDependencyCheckName, RuleDuplicateCheckName, RuleForCheckName, LabelCheckName, RuleLinkCheckName, RejectCheckName, } OnlineChecks = []string{ AlertsCheckName, AlertsExternalLabelsCheckName, LabelsConflictCheckName, RangeQueryCheckName, RateCheckName, VectorMatchingCheckName, CostCheckName, CounterCheckName, SeriesCheckName, RuleLinkCheckName, } )
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, comment string, severity Severity) AggregationCheck
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 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) 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) Meta ¶ added in v0.49.0
func (c AlertsExternalLabelsCheck) Meta() CheckMeta
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) 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 AnnotationCheck ¶
type AnnotationCheck struct {
// contains filtered or unexported fields
}
func NewAnnotationCheck ¶
func NewAnnotationCheck(keyRe, tokenRe, valueRe *TemplatedRegexp, values []string, isReguired bool, comment string, severity Severity) AnnotationCheck
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 IsOnline bool }
type ComparisonCheck ¶
type ComparisonCheck struct{}
func NewComparisonCheck ¶
func NewComparisonCheck() ComparisonCheck
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 ¶
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) 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 FragileCheck ¶ added in v0.8.0
type FragileCheck struct{}
func NewFragileCheck ¶ added in v0.8.0
func NewFragileCheck() FragileCheck
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 LabelCheck ¶
type LabelCheck struct {
// contains filtered or unexported fields
}
func NewLabelCheck ¶
func NewLabelCheck(keyRe, tokenRe, valueRe *TemplatedRegexp, values []string, isReguired bool, comment string, severity Severity) LabelCheck
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) 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 PromqlSeriesSettings ¶ added in v0.23.0
type PromqlSeriesSettings struct { LookbackRange string `hcl:"lookbackRange,optional" json:"lookbackRange,omitempty"` LookbackStep string `hcl:"lookbackStep,optional" json:"lookbackStep,omitempty"` IgnoreMetrics []string `hcl:"ignoreMetrics,optional" json:"ignoreMetrics,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) RangeQueryCheck
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
type RegexpCheck ¶ added in v0.11.0
type RegexpCheck struct{}
func NewRegexpCheck ¶ added in v0.11.0
func NewRegexpCheck() RegexpCheck
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
type RuleChecker ¶
type RuleDependencyCheck ¶ added in v0.51.0
type RuleDependencyCheck struct{}
func NewRuleDependencyCheck ¶ added in v0.51.0
func NewRuleDependencyCheck() RuleDependencyCheck
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 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) 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) 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) 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 SeriesCheck ¶
type SeriesCheck struct {
// contains filtered or unexported fields
}
func NewSeriesCheck ¶
func NewSeriesCheck(prom *promapi.FailoverGroup) SeriesCheck
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 SyntaxCheck ¶
type SyntaxCheck struct{}
func NewSyntaxCheck ¶
func NewSyntaxCheck() SyntaxCheck
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) 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 }
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 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) 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) 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
Source Files ¶
- alerts_annotation.go
- alerts_comparison.go
- alerts_count.go
- alerts_external_labels.go
- alerts_for.go
- alerts_template.go
- base.go
- labels_conflict.go
- promql_aggregation.go
- promql_counter.go
- promql_fragile.go
- promql_range_query.go
- promql_rate.go
- promql_regexp.go
- promql_series.go
- promql_syntax.go
- promql_vector_matching.go
- query_cost.go
- rule_dependency.go
- rule_duplicate.go
- rule_for.go
- rule_label.go
- rule_link.go
- rule_reject.go
- template.go
Click to show internal directories.
Click to hide internal directories.