Example usage for org.apache.hadoop.metrics2.lib MetricsAnnotations newSourceBuilder

List of usage examples for org.apache.hadoop.metrics2.lib MetricsAnnotations newSourceBuilder

Introduction

In this page you can find the example usage for org.apache.hadoop.metrics2.lib MetricsAnnotations newSourceBuilder.

Prototype

public static MetricsSourceBuilder newSourceBuilder(Object source) 

Source Link

Usage

From source file:com.twitter.hraven.hadoopJobMonitor.metrics.HadoopJobMonitorMetrics.java

License:Apache License

static HadoopJobMonitorMetrics create(Configuration conf) {
    MetricsSystem ms = DefaultMetricsSystem.instance();

    HadoopJobMonitorMetrics metricObject = new HadoopJobMonitorMetrics();
    MetricsSourceBuilder sb = MetricsAnnotations.newSourceBuilder(metricObject);
    final MetricsSource s = sb.build();
    ms.register("HadoopJobMonitorMetrics", "The Metrics of HadoopJobMonitor service", s);

    ScheduledExecutorService heartbeatExecutor = Executors
            .newSingleThreadScheduledExecutor(new SimpleThreadFactory());
    heartbeatExecutor.scheduleAtFixedRate(metricObject.new Heart(), 0, 1, TimeUnit.MINUTES);
    return metricObject;
}