github.com/muhammadn/cortex@v1.9.1-0.20220510110439-46bb7000d03d/pkg/ingester/instance_limits.go (about) 1 package ingester 2 3 import "github.com/pkg/errors" 4 5 var ( 6 // We don't include values in the message to avoid leaking Cortex cluster configuration to users. 7 errMaxSamplesPushRateLimitReached = errors.New("cannot push more samples: ingester's samples push rate limit reached") 8 errMaxUsersLimitReached = errors.New("cannot create TSDB: ingesters's max tenants limit reached") 9 errMaxSeriesLimitReached = errors.New("cannot add series: ingesters's max series limit reached") 10 errTooManyInflightPushRequests = errors.New("cannot push: too many inflight push requests in ingester") 11 ) 12 13 // InstanceLimits describes limits used by ingester. Reaching any of these will result in Push method to return 14 // (internal) error. 15 type InstanceLimits struct { 16 MaxIngestionRate float64 `yaml:"max_ingestion_rate"` 17 MaxInMemoryTenants int64 `yaml:"max_tenants"` 18 MaxInMemorySeries int64 `yaml:"max_series"` 19 MaxInflightPushRequests int64 `yaml:"max_inflight_push_requests"` 20 } 21 22 // Sets default limit values for unmarshalling. 23 var defaultInstanceLimits *InstanceLimits = nil 24 25 // UnmarshalYAML implements the yaml.Unmarshaler interface. If give 26 func (l *InstanceLimits) UnmarshalYAML(unmarshal func(interface{}) error) error { 27 if defaultInstanceLimits != nil { 28 *l = *defaultInstanceLimits 29 } 30 type plain InstanceLimits // type indirection to make sure we don't go into recursive loop 31 return unmarshal((*plain)(l)) 32 }