GitHub user enothereska opened a pull request: https://github.com/apache/kafka/pull/364
MINOR: Expose ReplicaManager gauges There are several gauges in core that are registered but cannot be accessed programmatically. For example, gauges "LeaderCount", "PartitionCount", "UnderReplicatedParittions" are all registered in ReplicaManager.scala but there is no way to access them programmatically if one has access to the kafka.server object. Other metrics, such as isrExpandRate (also in ReplicaManager.scala) can be accessed. The solution here is trivial, add a var <variable name> in front of newGauge, as shown below val partitionCount newGauge( "PartitionCount", new Gauge[Int] { def value = allPartitions.size } ) You can merge this pull request into a Git repository by running: $ git pull https://github.com/enothereska/kafka gauges Alternatively you can review and apply these changes as the patch at: https://github.com/apache/kafka/pull/364.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #364 ---- commit bcd2cab37874e5ae1dad20a40d416ec06c5781dc Author: Eno Thereska <eno.there...@gmail.com> Date: 2015-10-26T20:22:32Z Expose ReplicaManager gauges ---- --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---