@ Validate public void start ( ) { metrics . register ( "executors" , new MetricSet ( ) { @ Override public Map < String , Metric > getMetrics ( ) { return ImmutableMap . < String , Metric > of ( "executors.count" , new Gauge < Integer > ( ) { @ Override public Integer getValue ( ) { return getExecutors ( ) . length ; } } , "schedulers.count" , new Gauge < Integer > ( ) { @ Override public Integer getValue ( ) { return getSchedulers ( ) . length ; } } , "hung.count" , new Gauge < Integer > ( ) { @ Override public Integer getValue ( ) { return getHungTasks ( ) ; } } , "completed.count" , new Gauge < Integer > ( ) { @ Override public Integer getValue ( ) { return getCompletedTasks ( ) ; } } ) ; } } ) ; for ( ManagedExecutorService service : executors ) { metrics . register ( service . name ( ) , metricsForExecutor ( service ) ) ; } for ( ManagedExecutorService service : schedulers ) { metrics . register ( service . name ( ) , metricsForExecutor ( service ) ) ; } }
Starts the extension . It registers the different metrics into the metric registry .