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

Method getShardSizeForUser

pkg/ruler/ruler.go:1429–1434  ·  view source on GitHub ↗
(userID string)

Source from the content-addressed store, hash-verified

1427}
1428
1429func (r *Ruler) getShardSizeForUser(userID string) int {
1430 newShardSize := util.DynamicShardSize(r.limits.RulerTenantShardSize(userID), r.ring.InstancesCount())
1431
1432 // We want to guarantee that shard size will be at least replication factor
1433 return max(newShardSize, r.cfg.Ring.ReplicationFactor)
1434}
1435
1436func (r *Ruler) getShardedRules(ctx context.Context, userID string, rulesRequest RulesRequest) (*RulesResponse, error) {
1437 ring := ring.ReadRing(r.ring)

Callers 4

isUserOwnedMethod · 0.95
getShardedRulesMethod · 0.95
TestGetShardSizeForUserFunction · 0.95

Calls 4

DynamicShardSizeFunction · 0.92
maxFunction · 0.85
RulerTenantShardSizeMethod · 0.65
InstancesCountMethod · 0.65

Tested by 1

TestGetShardSizeForUserFunction · 0.76