private void registerMetrics ( final ObjectName nameObj , MetricRegistry reg ) { reg . register ( MetricRegistry . name ( ZKShardLockManager . class , "Lock Disinterested Time Millis" ) , new JmxAttributeGauge ( nameObj , "LockDisinterestedTimeMillis" ) ) ; reg . register ( MetricRegistry . name ( ZKShardLockManager . class , "Min Lock Hold Time Millis" ) , new JmxAttributeGauge ( nameObj , "MinLockHoldTimeMillis" ) ) ; reg . register ( MetricRegistry . name ( ZKShardLockManager . class , "Seconds Since Last Scavenge" ) , new JmxAttributeGauge ( nameObj , "SecondsSinceLastScavenge" ) ) ; reg . register ( MetricRegistry . name ( ZKShardLockManager . class , "Zk Connection Status" ) , new JmxAttributeGauge ( nameObj , "ZkConnectionStatus" ) { @ Override public Object getValue ( ) { Object val = super . getValue ( ) ; if ( val . equals ( "connected" ) ) { return 1 ; } return 0 ; } } ) ; reg . register ( MetricRegistry . name ( ZKShardLockManager . class , "Held Shards" ) , new Gauge < Integer > ( ) { @ Override public Integer getValue ( ) { return getHeldShards ( ) . size ( ) ; } } ) ; reg . register ( MetricRegistry . name ( ZKShardLockManager . class , "Unheld Shards" ) , new Gauge < Integer > ( ) { @ Override public Integer getValue ( ) { return getUnheldShards ( ) . size ( ) ; } } ) ; reg . register ( MetricRegistry . name ( ZKShardLockManager . class , "Error Shards" ) , new Gauge < Integer > ( ) { @ Override public Integer getValue ( ) { return getErrorShards ( ) . size ( ) ; } } ) ; }
Registers the different ZooKeeper metrics .