Search in sources :

Example 6 with JvmMetrics

use of org.apache.hadoop.metrics2.source.JvmMetrics in project hadoop by apache.

the class ApplicationHistoryServer method serviceInit.

@Override
protected void serviceInit(Configuration conf) throws Exception {
    // do security login first.
    try {
        doSecureLogin(conf);
    } catch (IOException ie) {
        throw new YarnRuntimeException("Failed to login", ie);
    }
    // init timeline services
    timelineStore = createTimelineStore(conf);
    addIfService(timelineStore);
    secretManagerService = createTimelineDelegationTokenSecretManagerService(conf);
    addService(secretManagerService);
    timelineDataManager = createTimelineDataManager(conf);
    addService(timelineDataManager);
    // init generic history service afterwards
    aclsManager = createApplicationACLsManager(conf);
    historyManager = createApplicationHistoryManager(conf);
    ahsClientService = createApplicationHistoryClientService(historyManager);
    addService(ahsClientService);
    addService((Service) historyManager);
    DefaultMetricsSystem.initialize("ApplicationHistoryServer");
    JvmMetrics jm = JvmMetrics.initSingleton("ApplicationHistoryServer", null);
    pauseMonitor = new JvmPauseMonitor();
    addService(pauseMonitor);
    jm.setPauseMonitor(pauseMonitor);
    super.serviceInit(conf);
}
Also used : YarnRuntimeException(org.apache.hadoop.yarn.exceptions.YarnRuntimeException) JvmMetrics(org.apache.hadoop.metrics2.source.JvmMetrics) IOException(java.io.IOException) JvmPauseMonitor(org.apache.hadoop.util.JvmPauseMonitor)

Example 7 with JvmMetrics

use of org.apache.hadoop.metrics2.source.JvmMetrics 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 8 with JvmMetrics

use of org.apache.hadoop.metrics2.source.JvmMetrics in project hadoop by apache.

the class TestJvmMetrics method testPresence.

@Test
public void testPresence() {
    pauseMonitor = new JvmPauseMonitor();
    pauseMonitor.init(new Configuration());
    pauseMonitor.start();
    JvmMetrics jvmMetrics = new JvmMetrics("test", "test");
    jvmMetrics.setPauseMonitor(pauseMonitor);
    MetricsRecordBuilder rb = getMetrics(jvmMetrics);
    MetricsCollector mc = rb.parent();
    verify(mc).addRecord(JvmMetrics);
    verify(rb).tag(ProcessName, "test");
    verify(rb).tag(SessionId, "test");
    for (JvmMetricsInfo info : JvmMetricsInfo.values()) {
        if (info.name().startsWith("Mem"))
            verify(rb).addGauge(eq(info), anyFloat());
        else if (info.name().startsWith("Gc"))
            verify(rb).addCounter(eq(info), anyLong());
        else if (info.name().startsWith("Threads"))
            verify(rb).addGauge(eq(info), anyInt());
        else if (info.name().startsWith("Log"))
            verify(rb).addCounter(eq(info), anyLong());
    }
}
Also used : MetricsCollector(org.apache.hadoop.metrics2.MetricsCollector) Configuration(org.apache.hadoop.conf.Configuration) JvmMetricsInfo(org.apache.hadoop.metrics2.source.JvmMetricsInfo) JvmPauseMonitor(org.apache.hadoop.util.JvmPauseMonitor) MetricsRecordBuilder(org.apache.hadoop.metrics2.MetricsRecordBuilder) Test(org.junit.Test)

Example 9 with JvmMetrics

use of org.apache.hadoop.metrics2.source.JvmMetrics in project hadoop by apache.

the class JobHistoryServer method serviceInit.

@Override
protected void serviceInit(Configuration conf) throws Exception {
    Configuration config = new YarnConfiguration(conf);
    config.setBoolean(Dispatcher.DISPATCHER_EXIT_ON_ERROR_KEY, true);
    // This is required for WebApps to use https if enabled.
    MRWebAppUtil.initialize(getConfig());
    try {
        doSecureLogin(conf);
    } catch (IOException ie) {
        throw new YarnRuntimeException("History Server Failed to login", ie);
    }
    jobHistoryService = new JobHistory();
    historyContext = (HistoryContext) jobHistoryService;
    stateStore = createStateStore(conf);
    this.jhsDTSecretManager = createJHSSecretManager(conf, stateStore);
    clientService = createHistoryClientService();
    aggLogDelService = new AggregatedLogDeletionService();
    hsAdminServer = new HSAdminServer(aggLogDelService, jobHistoryService);
    addService(stateStore);
    addService(new HistoryServerSecretManagerService());
    addService(jobHistoryService);
    addService(clientService);
    addService(aggLogDelService);
    addService(hsAdminServer);
    DefaultMetricsSystem.initialize("JobHistoryServer");
    JvmMetrics jm = JvmMetrics.initSingleton("JobHistoryServer", null);
    pauseMonitor = new JvmPauseMonitor();
    addService(pauseMonitor);
    jm.setPauseMonitor(pauseMonitor);
    super.serviceInit(config);
}
Also used : YarnRuntimeException(org.apache.hadoop.yarn.exceptions.YarnRuntimeException) HSAdminServer(org.apache.hadoop.mapreduce.v2.hs.server.HSAdminServer) YarnConfiguration(org.apache.hadoop.yarn.conf.YarnConfiguration) Configuration(org.apache.hadoop.conf.Configuration) YarnConfiguration(org.apache.hadoop.yarn.conf.YarnConfiguration) JvmMetrics(org.apache.hadoop.metrics2.source.JvmMetrics) AggregatedLogDeletionService(org.apache.hadoop.yarn.logaggregation.AggregatedLogDeletionService) IOException(java.io.IOException) JvmPauseMonitor(org.apache.hadoop.util.JvmPauseMonitor)

Example 10 with JvmMetrics

use of org.apache.hadoop.metrics2.source.JvmMetrics in project hadoop by apache.

the class NameNodeMetrics method create.

public static NameNodeMetrics create(Configuration conf, NamenodeRole r) {
    String sessionId = conf.get(DFSConfigKeys.DFS_METRICS_SESSION_ID_KEY);
    String processName = r.toString();
    MetricsSystem ms = DefaultMetricsSystem.instance();
    JvmMetrics jm = JvmMetrics.create(processName, sessionId, ms);
    // Percentile measurement is off by default, by watching no intervals
    int[] intervals = conf.getInts(DFSConfigKeys.DFS_METRICS_PERCENTILES_INTERVALS_KEY);
    return ms.register(new NameNodeMetrics(processName, 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)

Aggregations

JvmMetrics (org.apache.hadoop.metrics2.source.JvmMetrics)6 MetricsSystem (org.apache.hadoop.metrics2.MetricsSystem)5 JvmPauseMonitor (org.apache.hadoop.util.JvmPauseMonitor)4 Configuration (org.apache.hadoop.conf.Configuration)3 MetricsRecordBuilder (org.apache.hadoop.metrics2.MetricsRecordBuilder)3 DefaultMetricsSystem (org.apache.hadoop.metrics2.lib.DefaultMetricsSystem)3 IOException (java.io.IOException)2 JvmMetrics (org.apache.hadoop.hive.common.JvmMetrics)2 YarnConfiguration (org.apache.hadoop.yarn.conf.YarnConfiguration)2 YarnRuntimeException (org.apache.hadoop.yarn.exceptions.YarnRuntimeException)2 LlapMetricsSystem (org.apache.hadoop.hive.llap.metrics.LlapMetricsSystem)1 HSAdminServer (org.apache.hadoop.mapreduce.v2.hs.server.HSAdminServer)1 MetricsCollector (org.apache.hadoop.metrics2.MetricsCollector)1 JvmMetricsInfo (org.apache.hadoop.metrics2.source.JvmMetricsInfo)1 AggregatedLogDeletionService (org.apache.hadoop.yarn.logaggregation.AggregatedLogDeletionService)1 Test (org.junit.Test)1