MCPcopy Index your code
hub / github.com/cortexproject/cortex / AssertMaxRuleGroups

Method AssertMaxRuleGroups

pkg/ruler/ruler.go:1552–1564  ·  view source on GitHub ↗

AssertMaxRuleGroups limit has not been reached compared to the current number of total rule groups in input and returns an error if so.

(userID string, rg int)

Source from the content-addressed store, hash-verified

1550// AssertMaxRuleGroups limit has not been reached compared to the current
1551// number of total rule groups in input and returns an error if so.
1552func (r *Ruler) AssertMaxRuleGroups(userID string, rg int) error {
1553 limit := r.limits.RulerMaxRuleGroupsPerTenant(userID)
1554
1555 if limit <= 0 {
1556 return nil
1557 }
1558
1559 if rg <= limit {
1560 return nil
1561 }
1562
1563 return fmt.Errorf(errMaxRuleGroupsPerUserLimitExceeded, limit, rg)
1564}
1565
1566// AssertMaxRulesPerRuleGroup limit has not been reached compared to the current
1567// number of rules in a rule group in input and returns an error if so.

Callers 1

CreateRuleGroupMethod · 0.80

Calls 1

Tested by

no test coverage detected