Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func (cfg *Config) GetChecksForEntry(ctx context.Context, gen *PrometheusGenerat
defaultMatch := []Match{{State: defaultStates}}
proms := gen.ServersForPath(entry.Path.Name)

parsedRules := make([]parsedRule, 0, len(cfg.Rules))
parsedRules := make([]*parsedRule, 0, len(cfg.Rules))
if entry.PathError != nil || entry.Rule.Error.Err != nil {
check := checks.NewErrorCheck(entry)
parsedRules = append(parsedRules, baseParsedRule(defaultMatch, check.Reporter(), check, nil))
Expand Down
14 changes: 7 additions & 7 deletions internal/config/parsed_rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ type parsedRule struct {
locked bool
}

func newParsedRule(rule Rule, defaultStates []string, name string, check checks.RuleChecker, tags []string) parsedRule {
return parsedRule{
func newParsedRule(rule Rule, defaultStates []string, name string, check checks.RuleChecker, tags []string) *parsedRule {
return &parsedRule{
match: defaultRuleMatch(rule.Match, defaultStates),
ignore: rule.Ignore,
name: name,
Expand All @@ -30,8 +30,8 @@ func newParsedRule(rule Rule, defaultStates []string, name string, check checks.
}
}

func baseParsedRule(match []Match, name string, check checks.RuleChecker, tags []string) parsedRule {
return parsedRule{
func baseParsedRule(match []Match, name string, check checks.RuleChecker, tags []string) *parsedRule {
return &parsedRule{
match: match,
ignore: nil,
name: name,
Expand Down Expand Up @@ -115,8 +115,8 @@ func defaultMatchStates(cmd ContextCommandVal) []string {
}
}

func baseRules(staticRules []staticRule, proms []*promapi.FailoverGroup, match []Match) (rules []parsedRule) {
rules = make([]parsedRule, 0, len(staticRules)+(len(proms)*9))
func baseRules(staticRules []staticRule, proms []*promapi.FailoverGroup, match []Match) (rules []*parsedRule) {
rules = make([]*parsedRule, 0, len(staticRules)+(len(proms)*9))
for _, sr := range staticRules {
rules = append(rules, baseParsedRule(match, sr.name, sr.checker, nil))
}
Expand Down Expand Up @@ -152,7 +152,7 @@ func defaultRuleMatch(match []Match, defaultStates []string) []Match {
return dst
}

func parseRule(rule Rule, prometheusServers []*promapi.FailoverGroup, defaultStates []string) (rules []parsedRule) {
func parseRule(rule Rule, prometheusServers []*promapi.FailoverGroup, defaultStates []string) (rules []*parsedRule) {
if len(rule.Aggregate) > 0 {
var nameRegex *checks.TemplatedRegexp
for _, aggr := range rule.Aggregate {
Expand Down
Loading