Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var TunedRateLimitMetric = prometheus.NewGaugeVec( prometheus.GaugeOpts{ Namespace: config.AppName, Subsystem: "ratelimiter_auto_tune", Name: "tuned_rate_limit", Help: "The current auto-tuned rate limit for an upstream", }, []string{"upstream", "period"}, )
Functions ¶
This section is empty.
Types ¶
type FixedRateLimiterType ¶
type FixedRateLimiterType struct {
// contains filtered or unexported fields
}
func NewFixedRateLimiterType ¶
func NewFixedRateLimiterType(requests int, period time.Duration) *FixedRateLimiterType
type RateLimitBudget ¶
type RateLimitBudget struct {
Name string
Rules []Rule
Engine RateLimitEngine
}
func NewRateLimitBudget ¶
func NewRateLimitBudget(config *config.RateLimitBudget, engine RateLimitEngine) *RateLimitBudget
type RateLimitBudgetRegistry ¶
type RateLimitBudgetRegistry struct {
// contains filtered or unexported fields
}
func NewRateLimitBudgetRegistry ¶
func NewRateLimitBudgetRegistry(cfg []config.RateLimitBudgetsConfig, storageRegistry *storages.StorageRegistry) (*RateLimitBudgetRegistry, error)
func (*RateLimitBudgetRegistry) Get ¶
func (r *RateLimitBudgetRegistry) Get(name string) (*RateLimitBudget, bool)
type RateLimitCommand ¶
type RateLimitCommand struct {
Type RateLimiterType
Name string
}
type RateLimitEngine ¶
type RateLimitEngine interface {
Execute([]RateLimitCommand) (bool, error)
}
type RateLimitMemoryEngine ¶
type RateLimitMemoryEngine struct {
// contains filtered or unexported fields
}
func NewRateLimitMemoryEngine ¶
func NewRateLimitMemoryEngine() *RateLimitMemoryEngine
func (*RateLimitMemoryEngine) Execute ¶
func (e *RateLimitMemoryEngine) Execute(cmd []RateLimitCommand) (bool, error)
type RateLimitRedisEngine ¶
type RateLimitRedisEngine struct {
// contains filtered or unexported fields
}
func NewRateLimitRedisEngine ¶
func NewRateLimitRedisEngine(name string, redis *redis.Client) *RateLimitRedisEngine
func (*RateLimitRedisEngine) Execute ¶
func (e *RateLimitRedisEngine) Execute(cmd []RateLimitCommand) (bool, error)
type RateLimiterType ¶
type RateLimiterType interface {
// contains filtered or unexported methods
}
type Rule ¶
type Rule struct {
Check ruleCheck
Type RateLimiterType
}
type UpstreamAutoTune ¶
type UpstreamAutoTune struct {
// contains filtered or unexported fields
}
func NewUpstreamAutoTune ¶
func NewUpstreamAutoTune(ctx context.Context, upstreamId string, config *config.RateLimitAutoTuneConfig) *UpstreamAutoTune
func (*UpstreamAutoTune) Allow ¶
func (u *UpstreamAutoTune) Allow() bool
func (*UpstreamAutoTune) IncErrors ¶
func (u *UpstreamAutoTune) IncErrors()
func (*UpstreamAutoTune) RecalculateRateLimit ¶
func (u *UpstreamAutoTune) RecalculateRateLimit(ctx context.Context)
func (*UpstreamAutoTune) Run ¶
func (u *UpstreamAutoTune) Run(ctx context.Context)
Click to show internal directories.
Click to hide internal directories.