limiter

package
v1.6.2-0...-b66c343 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 2, 2024 License: AGPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMaxSeriesHit           = "the query hit the max number of series limit (limit: %d series)"
	ErrMaxChunkBytesHit       = "the query hit the aggregated chunks size limit (limit: %d bytes)"
	ErrMaxChunksPerQueryLimit = "the query hit the max number of chunks limit (limit: %d chunks)"
)

Functions

func AddQueryLimiterToContext

func AddQueryLimiterToContext(ctx context.Context, limiter *QueryLimiter) context.Context

Types

type QueryLimiter

type QueryLimiter struct {
	// contains filtered or unexported fields
}

func NewQueryLimiter

func NewQueryLimiter(maxSeriesPerQuery, maxChunkBytesPerQuery int, maxChunksPerQuery int) *QueryLimiter

NewQueryLimiter makes a new per-query limiter. Each query limiter is configured using the `maxSeriesPerQuery` limit.

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) error

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) error

func (*QueryLimiter) AddSeries

func (ql *QueryLimiter) AddSeries(seriesLabels []logproto.LabelAdapter) error

AddSeries adds the input series and returns an error if the limit is reached.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL