(ctx context.Context)
| 925 | } |
| 926 | |
| 927 | func (r *Ruler) listRulesShardingDefault(ctx context.Context) (map[string]rulespb.RuleGroupList, map[string]rulespb.RuleGroupList, error) { |
| 928 | configs, err := r.store.ListAllRuleGroups(ctx) |
| 929 | if err != nil { |
| 930 | return nil, nil, err |
| 931 | } |
| 932 | |
| 933 | ruleGroupCounts := make(map[string]int, len(configs)) |
| 934 | ownedConfigs := make(map[string]rulespb.RuleGroupList) |
| 935 | backedUpConfigs := make(map[string]rulespb.RuleGroupList) |
| 936 | for userID, groups := range configs { |
| 937 | ruleGroupCounts[userID] = len(groups) |
| 938 | owned := r.filterRuleGroups(userID, groups, r.ring) |
| 939 | if len(owned) > 0 { |
| 940 | ownedConfigs[userID] = owned |
| 941 | } |
| 942 | if r.cfg.RulesBackupEnabled() { |
| 943 | backup := r.filterBackupRuleGroups(userID, groups, owned, r.ring) |
| 944 | if len(backup) > 0 { |
| 945 | backedUpConfigs[userID] = backup |
| 946 | } |
| 947 | } |
| 948 | } |
| 949 | r.ruleGroupMetrics.UpdateRuleGroupsInStore(ruleGroupCounts) |
| 950 | return ownedConfigs, backedUpConfigs, nil |
| 951 | } |
| 952 | |
| 953 | func (r *Ruler) listRulesShuffleSharding(ctx context.Context) (map[string]rulespb.RuleGroupList, map[string]rulespb.RuleGroupList, error) { |
| 954 | users, err := r.store.ListAllUsers(ctx) |
no test coverage detected