Versions in this module Expand all Collapse all v0 v0.1.0 Nov 10, 2026 Changes in this version + var ErrOverloaded = errors.New("agilelimiter: concurrency limit reached") + func Do[T any](l *Limiter, fn func() (T, error)) (T, error) + type Anchor int + const AnchorBaseline + const AnchorSLO + const AnchorUnset + type Clock interface + Now func() time.Time + Sleep func(time.Duration) + type ConcurrencyConfig struct + Anchor Anchor + BackoffTicks int + Classify func(err error) Outcome + Clock Clock + Deadband float64 + DownStep float64 + FloorLimit int + InitialLimit int + MaxBaselineRise float64 + MaxLimit int + MinLimit int + Preset Preset + ProbeLimit int + RecoverTicks int + SLOTarget time.Duration + SlowDownHalfLife time.Duration + SlowHalfLife time.Duration + SlowStartGain float64 + TailFactor float64 + TailTolerance float64 + TargetInflation float64 + Tick time.Duration + UpStep float64 + func (cc ConcurrencyConfig) Validate() error + type ConcurrencyLimiter struct + func NewConcurrency(cc ConcurrencyConfig) *ConcurrencyLimiter + func (l *ConcurrencyLimiter) Config() Resolved + func (l *ConcurrencyLimiter) Do(fn func() error) error + func (l *ConcurrencyLimiter) InFlight() int + func (l *ConcurrencyLimiter) Limit() int + func (l *ConcurrencyLimiter) Observe(d time.Duration) + func (l *ConcurrencyLimiter) ObserveOutcome(d time.Duration, err error) + func (l *ConcurrencyLimiter) ObserveTruncated(d time.Duration) + func (l *ConcurrencyLimiter) Release() + func (l *ConcurrencyLimiter) Start() + func (l *ConcurrencyLimiter) Stats() Stats + func (l *ConcurrencyLimiter) Stop() + func (l *ConcurrencyLimiter) TryTake() bool + func (l *ConcurrencyLimiter) Unavailable() + type Config struct + Anchor Anchor + BackoffTicks int + Classify func(err error) Outcome + Clock Clock + Deadband float64 + DownStep float64 + FloorRate int + InitialRate int + MaxBaselineRise float64 + MaxRate int + MinRate int + Preset Preset + ProbeRate int + RecoverTicks int + SLOTarget time.Duration + SlowDownHalfLife time.Duration + SlowHalfLife time.Duration + SlowStartGain float64 + TailFactor float64 + TailTolerance float64 + TargetInflation float64 + Tick time.Duration + UpStep float64 + func (c Config) Validate() error + type Limiter struct + func New(cfg Config) *Limiter + func (l *Limiter) Config() Resolved + func (l *Limiter) Do(fn func() error) error + func (l *Limiter) Observe(rtt time.Duration) + func (l *Limiter) ObserveOutcome(d time.Duration, err error) + func (l *Limiter) ObserveTruncated(d time.Duration) + func (l *Limiter) Rate() float64 + func (l *Limiter) Start() + func (l *Limiter) Stats() Stats + func (l *Limiter) Stop() + func (l *Limiter) Take() time.Time + func (l *Limiter) Unavailable() + type Outcome int + const Aborted + const Reached + const Unreachable + type Preset int + const PresetBalanced + const PresetLatencyFirst + const PresetNone + const PresetThroughputFirst + func (p Preset) String() string + type Resolved struct + Anchor string + BackoffTicks int + Deadband float64 + DownStep float64 + FloorRate int + InitialRate int + Kind string + MaxBaselineRise float64 + MaxRate int + MinRate int + Preset string + ProbeRate int + RecoverTicks int + SLOTarget time.Duration + SlowDownHalfLife time.Duration + SlowHalfLife time.Duration + SlowStartGain float64 + Tail string + TailFactor float64 + TailTolerance float64 + TargetInflation float64 + Tick time.Duration + UpStep float64 + Window string + type Stats struct + Baseline time.Duration + ColdStart bool + Fast time.Duration + P50 time.Duration + P99 time.Duration + Rate float64 + Samples uint64 + TailRatio float64 + TailThreshold float64 + Used float64