...
Code Block | ||
---|---|---|
| ||
public class DescribeClientQuotasOptions extends AbstractOptions<DescribeClientQuotasOptions> { // Empty. } /** * The result of the {@link Admin#DescribeClientQuotas(Collection<QuotaFilter>, DescribeClientQuotasOptions)} call. */ public class DescribeClientQuotasResult { /** * Maps an entity to its configured quota value(s). Note if no value is defined for a quota * type for that entity's config, then it is not included in the resulting value map. * * @param entities the collection of entities that matched the filter */ public DescribeClientQuotasResult(KafkaFuture<Map<QuotaEntity, Map<QuotaKey, Long>>> entities); /** * Returns a map from quota entity to a future which can be used to check the status of the operation. */ public KafkaFuture<Map<QuotaEntity, Map<QuotaKey, Long>>> entities(); } public interface Admin extends AutoCloseable { ... /** * Describes all entities matching all provided filters (logical AND) that have at least one * quota value defined. * * @param filters filters to apply to matching entities * @param options the options to use * @return result containing all matching entities */ DescribeClientQuotasResult DescribeClientQuotasdescribeClientQuotas(Collection<QuotaFilter> filters, DescribeClientQuotasOptions options); } |
...
Code Block | ||
---|---|---|
| ||
public class DescribeEffectiveClientQuotasOptions extends AbstractOptions<DescribeEffectiveClientQuotasOptions> { /** * Whether to exclude the list of overridden values for every quota type in the result. */ public DescribeEffectiveClientQuotasOptions setOmitOverriddenValues(boolean omitOverriddenValues); } /** * The result of the {@link Admin#DescribeEffectiveClientQuotas(Collection<QuotaEntity>, DescribeEffectiveClientQuotasOptions)} call. */ public class DescribeEffectiveClientQuotasResult { /** * Information about a specific quota configuration entry. */ public class Entry { /** * @param source the entity source for the value * @param value the non-null value */ public Entry(QuotaEntity source, Long value); } /** * Information about the value for a quota type. */ public class Value { /** * @param entry the quota entry * @param overriddenEntries all values that are overridden due to being lower in * specificity, or null if not requested */ public Value(Entry entry, List<Entry> overriddenEntries); } /** * Maps a collection of entities to their effective quota values. * * @param config the quota configuration for the requested entities */ public DescribeEffectiveClientQuotasResult(Map<QuotaEntity, KafkaFuture<Map<QuotaKey, Value>>> config); /** * Returns a map from quota entity to a future which can be used to check the status of the operation. */ public Map<QuotaEntity, KafkaFuture<Map<QuotaKey, Value>>> config(); /** * Returns a future which succeeds only if all quota descriptions succeed. */ public KafkaFuture<Void> all(); } public interface Admin extends AutoCloseable { ... /** * Describes the effective quotas for the provided entities. * * @param entities the entities to describe the effective quotas for * @param options the options to use * @return the effective quotas for the entities */ DescribeEffectiveClientQuotasResult DescribeEffectiveClientQuotasdescribeEffectiveClientQuotas(Collection<QuotaEntity> entities, DescribeEffectiveClientQuotasOptions options); } |
...
Code Block | ||||
---|---|---|---|---|
| ||||
public class AlterClientQuotasEntry { public class Op { /** * @param key the quota type and units to alter * @param value if set then the existing value is updated, * otherwise if null, the existing value is cleared */ public Op(QuotaKey key, Long value); } /** * @param entity the entity whose config will be modified * @param ops the alteration to perform - if value is set, then the existing value is updated, * otherwise if null, the existing value is cleared */ public AlterClientQuotasEntry(QuotaEntity entity, Collection<Op> ops); } public class AlterClientQuotasOptions extends AbstractOptions<AlterClientQuotasOptions> { /** * Sets whether the request should be validated without altering the configs. */ public AlterClientQuotasOptions validateOnly(boolean validateOnly); } /** * The result of the {@link Admin#AlterClientQuotas(Collection<AlterClientQuotasEntry>, AlterClientQuotasOptions)} call. * * The API of this class is evolving, see {@link Admin} for details. */ public class AlterClientQuotasResult { public AlterClientQuotasResult(Map<QuotaEntity, KafkaFuture<Void>> futures); /** * Returns a map from quota entity to a future which can be used to check the status of the operation. */ public Map<QuotaEntity, KafkaFuture<Void>> values(); /** * Returns a future which succeeds only if all quota alterations succeed. */ public KafkaFuture<Void> all(); } public interface Admin extends AutoCloseable { ... /** * Alters the quotas as specified for the entries. * * @param alterations the alterations to perform * @return the result of the alterations */ AlterClientQuotasResult AlterClientQuotasalterClientQuotas(Collection<AlterClientQuotasEntry> entries, AlterClientQuotasOptions options); } |
...
Exclusive to --list
:--prefix
: Comma-separated prefix=name pairs, e.g. "user=test-".
Exclusive to --describe: --show-overridden
: Whether to include overridden config entriesNone.
Exclusive to --alter:--add
: Comma-separated list of entries to add or update to the configuration, in format "name:unit=value".--delete
: Comma-separated list of entries to remove from the configuration, in format "name:unit".--validate-only
: If set, validates the alteration but doesn't perform it.
...
When specifying configuration entries, the form: quota-name[:quota-unit][=quota-value]
is used. For convenience, if no quota unit is specified, then the historical default RATE_BPS
is used.
Output
In general, the output of the entities will be of the form: {entity-type=entity-name, ...}
, where entity-name
is sanitized for output since it is an opaque string. When displaying configuration values, the form: quota-name:quota-unit=quota-value
.
...
Code Block |
---|
$./bin/kafka-client-quotas.sh --bootstrap-server localhost:9092 --describe \
--names=user=user-one,client-id=my-client
consumer_byte_rate:shares=200 {user=user-one, client-id=my-client}
producer_byte_rate:bps=10000000 {user=user-one, client-id=my-client}
producer_byte_rate:broker_bps=500000 {user=<default>, client-id=my-client}
$./bin/kafka-client-quotas.sh --bootstrap-server localhost:9092 --describe \
--names=user=user-two,client-id=my-client \
--show-overridden
consumer_byte_rate:shares=100 {user=<default>, client-id=my-client}
producer_byte_rate:broker_bps=2000000 {user=user-two, client-id=my-client}
* producer_byte_rate:broker_bps=500000 {user=<default>, client-id=my-client}
|
...