Documentation ¶
Index ¶
- func AddQueryLimiterToContext(ctx context.Context, limiter *QueryLimiter) context.Context
- func NewMaxChunkBytesHitLimitError(maxChunkBytesPerQuery uint64) validation.LimitError
- func NewMaxChunksPerQueryLimitError(maxChunksPerQuery uint64) validation.LimitError
- func NewMaxEstimatedChunksPerQueryLimitError(maxEstimatedChunksPerQuery uint64) validation.LimitError
- func NewMaxEstimatedMemoryConsumptionPerQueryLimitError(maxEstimatedMemoryConsumptionPerQuery uint64) validation.LimitError
- func NewMaxSeriesHitLimitError(maxSeriesPerQuery uint64) validation.LimitError
- type QueryLimiter
- func (ql *QueryLimiter) AddChunkBytes(chunkSizeInBytes int) validation.LimitError
- func (ql *QueryLimiter) AddChunks(count int) validation.LimitError
- func (ql *QueryLimiter) AddEstimatedChunks(count int) validation.LimitError
- func (ql *QueryLimiter) AddSeries(seriesLabels []mimirpb.LabelAdapter) validation.LimitError
- type UtilizationBasedLimiter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddQueryLimiterToContext ¶
func AddQueryLimiterToContext(ctx context.Context, limiter *QueryLimiter) context.Context
func NewMaxChunkBytesHitLimitError ¶
func NewMaxChunkBytesHitLimitError(maxChunkBytesPerQuery uint64) validation.LimitError
func NewMaxChunksPerQueryLimitError ¶
func NewMaxChunksPerQueryLimitError(maxChunksPerQuery uint64) validation.LimitError
func NewMaxEstimatedChunksPerQueryLimitError ¶
func NewMaxEstimatedChunksPerQueryLimitError(maxEstimatedChunksPerQuery uint64) validation.LimitError
func NewMaxEstimatedMemoryConsumptionPerQueryLimitError ¶
func NewMaxEstimatedMemoryConsumptionPerQueryLimitError(maxEstimatedMemoryConsumptionPerQuery uint64) validation.LimitError
func NewMaxSeriesHitLimitError ¶
func NewMaxSeriesHitLimitError(maxSeriesPerQuery uint64) validation.LimitError
Types ¶
type QueryLimiter ¶
type QueryLimiter struct {
// contains filtered or unexported fields
}
func NewQueryLimiter ¶
func NewQueryLimiter(maxSeriesPerQuery, maxChunkBytesPerQuery, maxChunksPerQuery int, maxEstimatedChunksPerQuery int, queryMetrics *stats.QueryMetrics) *QueryLimiter
NewQueryLimiter makes a new per-query limiter. Each query limiter is configured using the maxSeriesPerQuery, maxChunkBytesPerQuery, maxChunksPerQuery and maxEstimatedChunksPerQuery limits.
func QueryLimiterFromContextWithFallback ¶
func QueryLimiterFromContextWithFallback(ctx context.Context) *QueryLimiter
QueryLimiterFromContextWithFallback returns a QueryLimiter from the current context. If there is not a QueryLimiter on the context it will return a new no-op limiter.
func (*QueryLimiter) AddChunkBytes ¶
func (ql *QueryLimiter) AddChunkBytes(chunkSizeInBytes int) validation.LimitError
AddChunkBytes adds the input chunk size in bytes and returns an error if the limit is reached.
func (*QueryLimiter) AddChunks ¶
func (ql *QueryLimiter) AddChunks(count int) validation.LimitError
func (*QueryLimiter) AddEstimatedChunks ¶
func (ql *QueryLimiter) AddEstimatedChunks(count int) validation.LimitError
func (*QueryLimiter) AddSeries ¶
func (ql *QueryLimiter) AddSeries(seriesLabels []mimirpb.LabelAdapter) validation.LimitError
AddSeries adds the input series and returns an error if the limit is reached.
type UtilizationBasedLimiter ¶
UtilizationBasedLimiter is a Service offering limiting based on CPU and memory utilization.
The respective CPU and memory utilization limits are configurable.
func NewUtilizationBasedLimiter ¶
func NewUtilizationBasedLimiter(cpuLimit float64, memoryLimit uint64, logCPUSamples bool, logger log.Logger, reg prometheus.Registerer) *UtilizationBasedLimiter
NewUtilizationBasedLimiter returns a UtilizationBasedLimiter configured with cpuLimit and memoryLimit.
func (*UtilizationBasedLimiter) LimitingReason ¶
func (l *UtilizationBasedLimiter) LimitingReason() string
LimitingReason returns the current reason for limiting, if any. If an empty string is returned, limiting is disabled.