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

Function ValidateOverrides

pkg/overrides/limits.go:24–38  ·  view source on GitHub ↗

No default allowed limits - these must be configured via runtime config ValidateOverrides checks if the provided overrides only contain allowed limits

(overrides map[string]any, allowedLimits []string)

Source from the content-addressed store, hash-verified

22
23// ValidateOverrides checks if the provided overrides only contain allowed limits
24func ValidateOverrides(overrides map[string]any, allowedLimits []string) error {
25 var invalidLimits []string
26
27 for limitName := range overrides {
28 if !slices.Contains(allowedLimits, limitName) {
29 invalidLimits = append(invalidLimits, limitName)
30 }
31 }
32
33 if len(invalidLimits) > 0 {
34 return fmt.Errorf("%s: %s", ErrInvalidLimits, strings.Join(invalidLimits, ", "))
35 }
36
37 return nil
38}
39
40// validateHardLimits checks if the provided overrides exceed any hard limits from the runtime config
41func (a *API) validateHardLimits(overrides map[string]any, userID string) error {

Callers 1

SetOverridesMethod · 0.85

Calls 1

JoinMethod · 0.80

Tested by

no test coverage detected