Example usage for org.apache.hadoop.metrics2.lib DefaultMetricsSystem INSTANCE

List of usage examples for org.apache.hadoop.metrics2.lib DefaultMetricsSystem INSTANCE

Introduction

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

Prototype

DefaultMetricsSystem INSTANCE

To view the source code for org.apache.hadoop.metrics2.lib DefaultMetricsSystem INSTANCE.

Click Source Link

Usage

From source file:com.alibaba.wasp.metrics.BaseSourceImpl.java

License:Apache License

public BaseSourceImpl(String metricsName, String metricsDescription, String metricsContext,
        String metricsJmxContext) {

    this.metricsName = metricsName;
    this.metricsDescription = metricsDescription;
    this.metricsContext = metricsContext;
    this.metricsJmxContext = metricsJmxContext;

    metricsRegistry = new DynamicMetricsRegistry(metricsName).setContext(metricsContext);
    DefaultMetricsSystemInitializer.INSTANCE.init(metricsName);

    // Register this instance.
    DefaultMetricsSystem.INSTANCE.registerSource(metricsJmxContext, metricsDescription, this);
    init();//  w  w  w. j  av  a2s.  c o  m
}

From source file:com.github.joshelser.dropwizard.metrics.hadoop.StandaloneExample.java

License:Apache License

public static void main(String[] args) throws Exception {
    final MetricRegistry metrics = new MetricRegistry();

    final HadoopMetrics2Reporter metrics2Reporter = HadoopMetrics2Reporter.forRegistry(metrics).build(
            DefaultMetricsSystem.initialize("StandaloneTest"), // The application-level name
            "Test", // Component name
            "Test", // Component description
            "Test"); // Name for each metric record
    final ConsoleReporter consoleReporter = ConsoleReporter.forRegistry(metrics).build();

    MetricsSystem metrics2 = DefaultMetricsSystem.instance();
    // Writes to stdout without a filename configuration
    // Will be invoked every 10seconds by default
    FileSink sink = new FileSink();
    metrics2.register("filesink", "filesink", sink);
    sink.init(new SubsetConfiguration(null, null) {
        public String getString(String key) {
            if (key.equals("filename")) {
                return null;
            }//w w  w.  jav  a2s.  c o m
            return super.getString(key);
        }
    });

    // How often should the dropwizard reporter be invoked
    metrics2Reporter.start(500, TimeUnit.MILLISECONDS);
    // How often will the dropwziard metrics be logged to the console
    consoleReporter.start(2, TimeUnit.SECONDS);

    generateMetrics(metrics, 5000, 25, TimeUnit.MILLISECONDS, metrics2Reporter, 10);
}

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;
}

From source file:de.huberlin.wbi.hiway.common.WFAppMetrics.java

License:Apache License

public static WFAppMetrics create() {
    return create(DefaultMetricsSystem.instance());
}

From source file:io.fabric8.hadoop.HadoopFactory.java

License:Apache License

public void destroy() throws ConfigurationException {
    updated(null);
    DefaultMetricsSystem.INSTANCE.shutdown();
}

From source file:org.apache.kylin.rest.metrics.QueryMetrics.java

License:Apache License

public QueryMetrics registerWith(String name) {
    return DefaultMetricsSystem.instance().register(name, "Query", this);
}

From source file:org.apache.tajo.pullserver.PullServerAuxService.java

License:Apache License

@SuppressWarnings("UnusedDeclaration")
public PullServerAuxService() {
    this(DefaultMetricsSystem.instance());
}

From source file:org.apache.tajo.pullserver.TajoPullServerService.java

License:Apache License

@SuppressWarnings("UnusedDeclaration")
public TajoPullServerService() {
    this(DefaultMetricsSystem.instance());
}

From source file:org.apache.tez.auxservices.ShuffleHandler.java

License:Apache License

public ShuffleHandler() {
    this(DefaultMetricsSystem.instance());
}

From source file:org.apache.tez.engine.common.shuffle.server.ShuffleHandler.java

License:Apache License

public ShuffleHandler(ExternalSorter sorter) {
    this(DefaultMetricsSystem.instance());
    this.sorter = sorter;
}