Kafka consumer lag through JMX

安稳与你 提交于 2019-12-06 09:22:38

You could retrieve the atrributes {topic}-{partition}.records-lag of metric kafka.consumer:type=consumer-fetch-manager-metrics,client-id={client-id} for all partitions. That should be equivalent to the output of consumer-groups.sh

MeetJoeBlack

To expose JMX metrics from consumer simply add

-Dcom.sun.management.jmxremote.port=9090 
-Dcom.sun.management.jmxremote.authenticate=false  
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.local.only=false

parameters to your java based consumer application, then you can access it using jconsole tool and localhost:9090 url. There you can find kafka.consumer:type=consumer-fetch-manager-metrics bean.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!