MCPcopy Create free account
hub / github.com/cortexproject/cortex / Rules

Method Rules

pkg/ruler/ruler.go:1529–1542  ·  view source on GitHub ↗

Rules implements the rules service

(ctx context.Context, in *RulesRequest)

Source from the content-addressed store, hash-verified

1527
1528// Rules implements the rules service
1529func (r *Ruler) Rules(ctx context.Context, in *RulesRequest) (*RulesResponse, error) {
1530 userID, err := users.TenantID(ctx)
1531
1532 if err != nil {
1533 return nil, fmt.Errorf("no user id found in context")
1534 }
1535
1536 response, err := r.getLocalRules(userID, *in, r.cfg.RulesBackupEnabled())
1537 if err != nil {
1538 return nil, err
1539 }
1540
1541 return &response, nil
1542}
1543
1544// HasMaxRuleGroupsLimit check if RulerMaxRuleGroupsPerTenant limit is set for the userID.
1545func (r *Ruler) HasMaxRuleGroupsLimit(userID string) bool {

Callers

nothing calls this directly

Calls 3

getLocalRulesMethod · 0.95
TenantIDFunction · 0.92
RulesBackupEnabledMethod · 0.80

Tested by

no test coverage detected