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

Method AssertMaxRulesPerRuleGroup

pkg/ruler/ruler.go:1568–1579  ·  view source on GitHub ↗

AssertMaxRulesPerRuleGroup limit has not been reached compared to the current number of rules in a rule group in input and returns an error if so.

(userID string, rules int)

Source from the content-addressed store, hash-verified

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.
1568func (r *Ruler) AssertMaxRulesPerRuleGroup(userID string, rules int) error {
1569 limit := r.limits.RulerMaxRulesPerRuleGroup(userID)
1570
1571 if limit <= 0 {
1572 return nil
1573 }
1574
1575 if rules <= limit {
1576 return nil
1577 }
1578 return fmt.Errorf(errMaxRulesPerRuleGroupPerUserLimitExceeded, limit, rules)
1579}
1580
1581func (r *Ruler) DeleteTenantConfiguration(w http.ResponseWriter, req *http.Request) {
1582 logger := util_log.WithContext(req.Context(), r.logger)

Callers 1

CreateRuleGroupMethod · 0.80

Calls 1

Tested by

no test coverage detected