[ 
https://issues.apache.org/jira/browse/KAFKA-2689?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14972824#comment-14972824
 ] 

Ismael Juma commented on KAFKA-2689:
------------------------------------

It should be a val.

> Expose select gauges and metrics programmatically (not just through JMX)
> ------------------------------------------------------------------------
>
>                 Key: KAFKA-2689
>                 URL: https://issues.apache.org/jira/browse/KAFKA-2689
>             Project: Kafka
>          Issue Type: Improvement
>          Components: core
>    Affects Versions: 0.9.0.0
>            Reporter: Eno Thereska
>            Assignee: Eno Thereska
>              Labels: newbie
>             Fix For: 0.9.0.0
>
>
> 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
> var partitionCount newGauge(
>     "PartitionCount",
>     new Gauge[Int] {
>       def value = allPartitions.size
>     }
> )



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to