ratelimiter

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2024 License: MPL-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LogPaylaodMetadata added in v1.0.0

type LogPaylaodMetadata struct {
}

type LogRateLimiter

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

LogRateLimiter represents the RateLimiter config for logs

func NewLogRateLimiter

func NewLogRateLimiter(setting LogRateLimiterSetting) (*LogRateLimiter, error)

NewLogRateLimiter creates RateLimiter implementation for logs using RateLimiterSetting

func (*LogRateLimiter) Acquire

func (rateLimiter *LogRateLimiter) Acquire(payloadMetadata interface{}) (bool, error)

Acquire checks if the requests count for logs is reached to maximum allocated quota per minute.

func (*LogRateLimiter) IncRequestCount

func (rateLimiter *LogRateLimiter) IncRequestCount()

IncRequestCount increaments the request count associated with logs by 1

func (*LogRateLimiter) ResetRequestCount

func (rateLimiter *LogRateLimiter) ResetRequestCount()

ResetRequestCount resets the request count associated with logs to 0

func (*LogRateLimiter) Run

func (rateLimiter *LogRateLimiter) Run(ctx context.Context)

Run starts the timer for reseting the logs request counter

func (*LogRateLimiter) Shutdown

func (rateLimiter *LogRateLimiter) Shutdown(_ context.Context)

Shutdown triggers the shutdown of the LogRateLimiter

type LogRateLimiterSetting added in v1.0.0

type LogRateLimiterSetting struct {
	RequestCount int
}

type MetricsPaylaodMetadata added in v1.0.0

type MetricsPaylaodMetadata struct {
}

type MetricsRateLimiter

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

MetricsRateLimiter represents the RateLimiter config for metrics

func NewMetricsRateLimiter

func NewMetricsRateLimiter(setting MetricsRateLimiterSetting) (*MetricsRateLimiter, error)

NewMetricsRateLimiter creates RateLimiter implementation for metrics using RateLimiterSetting

func (*MetricsRateLimiter) Acquire

func (rateLimiter *MetricsRateLimiter) Acquire(payloadMetadata interface{}) (bool, error)

Acquire checks if the requests count for metrics is reached to maximum allocated quota per minute.

func (*MetricsRateLimiter) IncRequestCount

func (rateLimiter *MetricsRateLimiter) IncRequestCount()

IncRequestCount increaments the request count associated with metrics by 1

func (*MetricsRateLimiter) ResetRequestCount

func (rateLimiter *MetricsRateLimiter) ResetRequestCount()

ResetRequestCount resets the request count associated with metrics to 0

func (*MetricsRateLimiter) Run

func (rateLimiter *MetricsRateLimiter) Run(ctx context.Context)

Run starts the timer for reseting the metrics request counter

func (*MetricsRateLimiter) Shutdown

func (rateLimiter *MetricsRateLimiter) Shutdown(_ context.Context)

Shutdown triggers the shutdown of the MetricsRateLimiter

type MetricsRateLimiterSetting added in v1.0.0

type MetricsRateLimiterSetting struct {
	RequestCount int
}

type RateLimiter

type RateLimiter interface {
	// IncRequestCount()
	Acquire(payloadMetadata interface{}) (bool, error)
	// ResetRequestCount()
	Run(context.Context)
	Shutdown(context.Context)
}

RateLimiter represents the RateLimiter operations

type TracePayloadMetadata added in v1.0.0

type TracePayloadMetadata struct {
	RequestSpanCount uint64
}

type TraceRateLimiter

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

TraceRateLimiter represents the RateLimiter config for traces

func NewTraceRateLimiter

func NewTraceRateLimiter(setting TraceRateLimiterSetting) (*TraceRateLimiter, error)

NewTraceRateLimiter creates RateLimiter implementation for traces using RateLimiterSetting

func (*TraceRateLimiter) Acquire

func (rateLimiter *TraceRateLimiter) Acquire(payloadMetadata interface{}) (bool, error)

Acquire checks if the requests count for traces is reached to maximum allocated quota per minute.

func (*TraceRateLimiter) Run

func (rateLimiter *TraceRateLimiter) Run(ctx context.Context)

Run starts the timer for reseting the traces request counter

func (*TraceRateLimiter) Shutdown

func (rateLimiter *TraceRateLimiter) Shutdown(_ context.Context)

Shutdown triggers the shutdown of the LogRateLimiter

type TraceRateLimiterSetting added in v1.0.0

type TraceRateLimiterSetting struct {
	RequestCount        int
	SpanCount           int
	SpanCountPerRequest int
}

Jump to

Keyboard shortcuts

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