Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Limiter ¶
type Limiter struct {
// contains filtered or unexported fields
}
Limiter does two things a) limits the number of concurrent requests going upstream b) prioritize the "waiting" requests For prioritization we are using two variables: "priority": that is request complexity, less complexity == more priority "uuid": for requests of equal comlexity, process them ordered by uuid in order do minimize the number of "active" requests
func New ¶
func New(limit int, options ...LimiterOption) *Limiter
New creates a new limiter that allows maximum "limit" requests to "Enter"
type LimiterOption ¶
type LimiterOption func(*Limiter)
func WithMetrics ¶
func WithMetrics(activeGauge, waitingGauge prometheus.Gauge) LimiterOption
WithMetrics adds prometheus metrics to the Limiter instanace
Click to show internal directories.
Click to hide internal directories.