Token bucket

type.TokenBucket

[type.TokenBucket proto]

Configures a token bucket, typically used for rate limiting.

  1. {
  2. "max_tokens": "...",
  3. "tokens_per_fill": "{...}",
  4. "fill_interval": "{...}"
  5. }

max_tokens

(uint32) The maximum tokens that the bucket can hold. This is also the number of tokens that the bucket initially contains.

tokens_per_fill

(UInt32Value) The number of tokens added to the bucket during each fill interval. If not specified, defaults to a single token.

fill_interval

(Duration, REQUIRED) The fill interval that tokens are added to the bucket. During each fill interval tokens_per_fill are added to the bucket. The bucket will never contain more than max_tokens tokens.