Kafka配额违规日志

Kafka quota violation log

我使用 Kafka Quotas 来限制生产者 (0.10.2.1)。但是现在我想知道什么时候以及哪个用户达到了限制。

是否有 JMX 指标或日志条目告诉我有关违规的信息?

在页面 Monitoring Kafka 上没有任何关于配额 JMX 指标的内容。只有一个小指标可能表示已达到配额。

fetch-throttle-time-avg

The average throttle time in ms. When quotas are enabled, the broker may delay fetch requests in order to throttle a consumer which has exceeded its limit. This metric indicates how throttling time has been added to fetch requests on average.

来自 Apache Kafka 官方文档,在 monitoring section 中,Kafka 0.10.2 在代理上公开了一个指标来跟踪违反配额和被限制的用户:

kafka.server:type={Produce|Fetch},user=([-.\w]+),client-id=([-.\w]+)

Quota metrics per (user, client-id), user or client-id

Two attributes:

  • throttle-time indicates the amount of time in ms the client was throttled. Ideally = 0

  • byte-rate indicates the data produce/consume rate of the client in bytes/sec. For (user, client-id) quotas, both user and client-id are specified. If per-client-id quota is applied to the client, user is not specified. If per-user quota is applied, client-id is not specified.