如何测量kafka生产者每秒产生的消息数量?

How to measure the number of messages produced by kafka producer per second?

我正在为我的大学项目学习 Kafka,我想知道监控 Kafka 生产者每秒产生的消息数量的日志记录技术。

感谢您的帮助。

有很多 Kafka 指标公开在 JMX 上。可以查看官方文档 here for that. As you can see there, one of the Producer metrics is request-rate (the average number of requests sent per second.). You just need to enable JMX in the producer client JVM. Some more helpful info can be found and .