usagelimits

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

README

Static Usage Limit Policy Plugin

Type: static-usage-limit-policy

A usage limit policy that applies a fixed admission ceiling across all priority levels. The Flow Controller uses this ceiling to gate how much of the pool's capacity can be consumed before requests are queued.

A threshold of 1.0 (the default) means no gating — all capacity is available. A lower value (e.g., 0.8) reserves headroom by capping admission at 80% of pool capacity, providing a safety margin before saturation.

This policy is framework-injected by default when flow control is enabled. You do not need to explicitly declare it in your configuration.

Parameters:

  • threshold (float64, optional, default: 1.0): Fixed admission ceiling applied uniformly to all priorities. Must be in (0.0, 1.0].

Configuration Example:

plugins:
  - type: static-usage-limit-policy
    name: my-usage-limit
    parameters:
      threshold: 0.8
flowControl:
  usageLimitPolicyPluginRef: my-usage-limit

Documentation

Index

Constants

View Source
const StaticUsageLimitPolicyType = "static-usage-limit-policy"

Variables

This section is empty.

Functions

func DefaultPolicy

func DefaultPolicy() flowcontrol.UsageLimitPolicy

DefaultPolicy returns the default UsageLimitPolicy with threshold 1.0 (no gating). Useful for test cases.

func NewConstPolicy

func NewConstPolicy(usageLimitName string, threshold float64) flowcontrol.UsageLimitPolicy

NewConstPolicy implements a UsageLimitPolicy that returns a fixed threshold for all priorities.

func NewPolicyFunc

func NewPolicyFunc(usageLimitName string, f func(ctx context.Context, saturation float64, priorities []int) (ceilings []float64)) flowcontrol.UsageLimitPolicy

NewPolicyFunc implements a UsageLimitPolicy with a single func.

func StaticPolicyFactory

func StaticPolicyFactory(name string, rawConfig *json.Decoder, _ plugin.Handle) (plugin.Plugin, error)

StaticPolicyFactory creates a StaticUsageLimitPolicy from JSON config. If no threshold is specified, it defaults to 1.0 (no gating).

Types

This section is empty.

Jump to

Keyboard shortcuts

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