Search in sources :

Example 81 with MetricsSystem

use of org.apache.hadoop.metrics2.MetricsSystem in project hadoop by apache.

the class TestMetricsSystemImpl method testRegisterSourceWithoutName.

@Test
public void testRegisterSourceWithoutName() {
    MetricsSystem ms = new MetricsSystemImpl();
    TestSource ts = new TestSource("ts");
    TestSource2 ts2 = new TestSource2("ts2");
    ms.register(ts);
    ms.register(ts2);
    ms.init("TestMetricsSystem");
    // if metrics source is registered without name,
    // the class name will be used as the name
    MetricsSourceAdapter sa = ((MetricsSystemImpl) ms).getSourceAdapter("TestSource");
    assertNotNull(sa);
    MetricsSourceAdapter sa2 = ((MetricsSystemImpl) ms).getSourceAdapter("TestSource2");
    assertNotNull(sa2);
    ms.shutdown();
}
Also used : DefaultMetricsSystem(org.apache.hadoop.metrics2.lib.DefaultMetricsSystem) MetricsSystem(org.apache.hadoop.metrics2.MetricsSystem) Test(org.junit.Test)

Example 82 with MetricsSystem

use of org.apache.hadoop.metrics2.MetricsSystem in project hadoop by apache.

the class TestMetricsSystemImpl method testRegisterDupError.

@Test(expected = MetricsException.class)
public void testRegisterDupError() {
    MetricsSystem ms = new MetricsSystemImpl("test");
    TestSource ts = new TestSource("ts");
    ms.register(ts);
    ms.register(ts);
}
Also used : DefaultMetricsSystem(org.apache.hadoop.metrics2.lib.DefaultMetricsSystem) MetricsSystem(org.apache.hadoop.metrics2.MetricsSystem) Test(org.junit.Test)

Example 83 with MetricsSystem

use of org.apache.hadoop.metrics2.MetricsSystem in project hadoop by apache.

the class Nfs3Metrics method create.

public static Nfs3Metrics create(Configuration conf, String gatewayName) {
    String sessionId = conf.get(DFSConfigKeys.DFS_METRICS_SESSION_ID_KEY);
    MetricsSystem ms = DefaultMetricsSystem.instance();
    JvmMetrics jm = JvmMetrics.create(gatewayName, sessionId, ms);
    // Percentile measurement is [50th,75th,90th,95th,99th] currently
    int[] intervals = conf.getInts(NfsConfigKeys.NFS_METRICS_PERCENTILES_INTERVALS_KEY);
    return ms.register(new Nfs3Metrics(gatewayName, sessionId, intervals, jm));
}
Also used : JvmMetrics(org.apache.hadoop.metrics2.source.JvmMetrics) MetricsSystem(org.apache.hadoop.metrics2.MetricsSystem) DefaultMetricsSystem(org.apache.hadoop.metrics2.lib.DefaultMetricsSystem)

Example 84 with MetricsSystem

use of org.apache.hadoop.metrics2.MetricsSystem in project ozone by apache.

the class EventWatcher method start.

public void start(EventQueue queue) {
    queue.addHandler(startEvent, this::handleStartEvent);
    queue.addHandler(completionEvent, (completionPayload, publisher) -> {
        try {
            handleCompletion(completionPayload, publisher);
        } catch (LeaseNotFoundException e) {
            // It's already done. Too late, we already retried it.
            // Not a real problem.
            LOG.warn("Completion event without active lease. Id={}", completionPayload.getId());
        }
    });
    MetricsSystem ms = DefaultMetricsSystem.instance();
    ms.register(name, "EventWatcher metrics", metrics);
}
Also used : LeaseNotFoundException(org.apache.hadoop.ozone.lease.LeaseNotFoundException) MetricsSystem(org.apache.hadoop.metrics2.MetricsSystem) DefaultMetricsSystem(org.apache.hadoop.metrics2.lib.DefaultMetricsSystem)

Aggregations

MetricsSystem (org.apache.hadoop.metrics2.MetricsSystem)80 DefaultMetricsSystem (org.apache.hadoop.metrics2.lib.DefaultMetricsSystem)58 Test (org.junit.Test)23 MetricsSource (org.apache.hadoop.metrics2.MetricsSource)6 MetricsSystemImpl (org.apache.hadoop.metrics2.impl.MetricsSystemImpl)5 MyMetrics1 (org.apache.hadoop.metrics2.sink.RollingFileSystemSinkTestBase.MyMetrics1)5 JvmMetrics (org.apache.hadoop.hive.common.JvmMetrics)3 JvmMetrics (org.apache.hadoop.metrics2.source.JvmMetrics)3 After (org.junit.After)3 Path (org.apache.hadoop.fs.Path)2 LlapMetricsSystem (org.apache.hadoop.hive.llap.metrics.LlapMetricsSystem)2 MetricsCollectorImpl (org.apache.hadoop.metrics2.impl.MetricsCollectorImpl)2 MetricsRegistry (org.apache.hadoop.metrics2.lib.MetricsRegistry)2 ContainerId (org.apache.hadoop.yarn.api.records.ContainerId)2 QueueMetrics (org.apache.hadoop.yarn.server.resourcemanager.scheduler.QueueMetrics)2 Matchers.anyString (org.mockito.Matchers.anyString)2 ConsoleReporter (com.codahale.metrics.ConsoleReporter)1 MetricRegistry (com.codahale.metrics.MetricRegistry)1 ChannelFuture (io.netty.channel.ChannelFuture)1 URI (java.net.URI)1