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();
}
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);
}
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));
}
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);
}
Aggregations