Class MinTokenBucket

java.lang.Object
org.apache.kafka.common.metrics.stats.TokenBucket
org.apache.kafka.common.metrics.stats.MinTokenBucket
All Implemented Interfaces:
Measurable, MeasurableStat, MetricValueProvider<Double>, Stat

public class MinTokenBucket extends TokenBucket
A variant of the TokenBucket that caps the token balance to some given minimum value. This is useful for quotas where we want to record values into a sensor but temporarily ignore any rate limiting. The MinTokenBucket will discount tokens recorded under a given min value, bounding the max throttle experienced once rate limiting is enforced. In comparison, the TokenBucket will continuously consume tokens, that would need to be replenished, resulting in unbounded throttle time.
  • Constructor Details

    • MinTokenBucket

      public MinTokenBucket(double minTokens)