Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CheckResult ¶
type CheckResult struct { // File represents the checked file name File string // Group represents the checked group name Group string // Name represents the checked recording rule or alert name Name string // Expression represents the PromQL expression string Expression string // Results represents a list of PromQL selectors which successfully returned a result value Results []string // NoResults represents a list of PromQL selectors which did not return any result value NoResults []string }
CheckResult represents a check result.
type Prober ¶ added in v1.0.2
type Prober interface { // ProbeSelector probes the given PromQL selector against a remote instance. ProbeSelector(selector string) (float64, error) }
Prober represents probe.
type PrometheusRulesChecker ¶
type PrometheusRulesChecker struct {
// contains filtered or unexported fields
}
PrometheusRulesChecker represents linting PromQL logic.
func NewPrometheusRulesChecker ¶
func NewPrometheusRulesChecker(config PrometheusRulesCheckerConfig, client prometheusv1.API) *PrometheusRulesChecker
NewPrometheusRulesChecker returns PrometheusRulesChecker.
func (*PrometheusRulesChecker) CheckRuleGroup ¶ added in v1.1.0
func (prc *PrometheusRulesChecker) CheckRuleGroup(group RuleGroup) ([]CheckResult, error)
CheckRuleGroup checks a single rule group. CheckRuleGroup returns a list of CheckResult.
func (*PrometheusRulesChecker) CheckRuleGroups ¶
func (prc *PrometheusRulesChecker) CheckRuleGroups(groups []RuleGroup) ([]CheckResult, error)
CheckRuleGroups checks Prometheus rule groups. CheckRuleGroups returns a list of CheckResult.
type PrometheusRulesCheckerConfig ¶
type PrometheusRulesCheckerConfig struct { // ProbeDelay represents the delay between selector probes ProbeDelay time.Duration // PrometheusURL represents the Prometheus instance url PrometheusURL string // IgnoredSelectorsRegexp represents a list of ignored selector regexp // This parameter can be used to exclude selectors from probes IgnoredSelectorsRegexp []string // IgnoredGroupsRegexp represents a list of ignored group regexp // This parameter can be used to exclude groups and therefore a set of selectors from probes IgnoredGroupsRegexp []string }
PrometheusRulesCheckerConfig represents PrometheusRulesChecker configuration.
type Rule ¶ added in v1.1.0
type Rule struct { // Name represents the checked recording rule or alert name Name string `json:"name"` // Expression represents the PromQL expression string Expression string `json:"expr"` }
Rule describes an alerting or recording rule.
type RuleGroup ¶ added in v1.1.0
type RuleGroup struct { // Name represents the name of the rule group Name string `json:"name"` // File represents the name of the rule group File string `json:"file"` // Rules represents a list of Rule Rules []Rule `json:"rules"` }
RuleGroup models a rule group that contains a set of recording and alerting rules.
Click to show internal directories.
Click to hide internal directories.