@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()); } }
@Test public void testPresence() { JvmPauseMonitor pauseMonitor = new JvmPauseMonitor(new Configuration()); 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()); } }
@Override protected void serviceInit(Configuration conf) throws Exception { // init timeline services first 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); }
@Test public void testDoubleStop() throws Throwable { pauseMonitor = new JvmPauseMonitor(); pauseMonitor.init(new Configuration()); pauseMonitor.start(); pauseMonitor.stop(); pauseMonitor.stop(); }
@Test public void testDoubleStart() throws Throwable { pauseMonitor = new JvmPauseMonitor(); pauseMonitor.init(new Configuration()); pauseMonitor.start(); pauseMonitor.start(); pauseMonitor.stop(); }
@Test public void testStopBeforeStart() throws Throwable { pauseMonitor = new JvmPauseMonitor(); try { pauseMonitor.init(new Configuration()); pauseMonitor.stop(); pauseMonitor.start(); Assert.fail("Expected an exception, got " + pauseMonitor); } catch (ServiceStateException e) { GenericTestUtils.assertExceptionContains("cannot enter state", e); } }
@Test public void testStopBeforeInit() throws Throwable { pauseMonitor = new JvmPauseMonitor(); try { pauseMonitor.stop(); pauseMonitor.init(new Configuration()); Assert.fail("Expected an exception, got " + pauseMonitor); } catch (ServiceStateException e) { GenericTestUtils.assertExceptionContains("cannot enter state", e); } }
@Override protected void serviceInit(Configuration conf) throws Exception { Configuration config = new YarnConfiguration(conf); doSecureLogin(conf); proxy = new WebAppProxy(); addService(proxy); DefaultMetricsSystem.initialize("WebAppProxyServer"); JvmMetrics jm = JvmMetrics.initSingleton("WebAppProxyServer", null); pauseMonitor = new JvmPauseMonitor(); addService(pauseMonitor); jm.setPauseMonitor(pauseMonitor); super.serviceInit(config); }
@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); }
@Override protected void serviceInit(Configuration conf) throws Exception { Configuration config = new YarnConfiguration(conf); doSecureLogin(conf); proxy = new WebAppProxy(); addService(proxy); DefaultMetricsSystem.initialize("WebAppProxyServer"); JvmMetrics jm = JvmMetrics.initSingleton("WebAppProxyServer", null); pauseMonitor = new JvmPauseMonitor(conf); jm.setPauseMonitor(pauseMonitor); super.serviceInit(config); }
@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(conf); jm.setPauseMonitor(pauseMonitor); super.serviceInit(conf); }
@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(getConfig()); jm.setPauseMonitor(pauseMonitor); super.serviceInit(config); }
/** * Initialize name-node. * * @param conf the configuration */ protected void initialize(Configuration conf) throws IOException { if (conf.get(HADOOP_USER_GROUP_METRICS_PERCENTILES_INTERVALS) == null) { String intervals = conf.get(DFS_METRICS_PERCENTILES_INTERVALS_KEY); if (intervals != null) { conf.set(HADOOP_USER_GROUP_METRICS_PERCENTILES_INTERVALS, intervals); } } UserGroupInformation.setConfiguration(conf); loginAsNameNodeUser(conf); NameNode.initMetrics(conf, this.getRole()); StartupProgressMetrics.register(startupProgress); if (NamenodeRole.NAMENODE == role) { startHttpServer(conf); } loadNamesystem(conf); rpcServer = createRpcServer(conf); final String nsId = getNameServiceId(conf); tokenServiceName = HAUtil.isHAEnabled(conf, nsId) ? nsId : NetUtils .getHostPortString(rpcServer.getRpcAddress()); if (NamenodeRole.NAMENODE == role) { httpServer.setNameNodeAddress(getNameNodeAddress()); httpServer.setFSImage(getFSImage()); } pauseMonitor = new JvmPauseMonitor(conf); pauseMonitor.start(); startCommonServices(conf); }
public void setPauseMonitor(final JvmPauseMonitor pauseMonitor) { this.pauseMonitor = pauseMonitor; }
/** * Initialize name-node. * * @param conf the configuration */ protected void initialize(Configuration conf) throws IOException { if (conf.get(HADOOP_USER_GROUP_METRICS_PERCENTILES_INTERVALS) == null) { String intervals = conf.get(DFS_METRICS_PERCENTILES_INTERVALS_KEY); if (intervals != null) { conf.set(HADOOP_USER_GROUP_METRICS_PERCENTILES_INTERVALS, intervals); } } UserGroupInformation.setConfiguration(conf); loginAsNameNodeUser(conf); NameNode.initMetrics(conf, this.getRole()); StartupProgressMetrics.register(startupProgress); if (NamenodeRole.NAMENODE == role) { startHttpServer(conf); } this.spanReceiverHost = SpanReceiverHost.get(conf, DFSConfigKeys.DFS_SERVER_HTRACE_PREFIX); loadNamesystem(conf); rpcServer = createRpcServer(conf); if (clientNamenodeAddress == null) { // This is expected for MiniDFSCluster. Set it now using // the RPC server's bind address. clientNamenodeAddress = NetUtils.getHostPortString(rpcServer.getRpcAddress()); LOG.info("Clients are to use " + clientNamenodeAddress + " to access" + " this namenode/service."); } if (NamenodeRole.NAMENODE == role) { httpServer.setNameNodeAddress(getNameNodeAddress()); httpServer.setFSImage(getFSImage()); } pauseMonitor = new JvmPauseMonitor(conf); pauseMonitor.start(); metrics.getJvmMetrics().setPauseMonitor(pauseMonitor); startCommonServices(conf); }
/** * Initialize name-node. * * @param conf the configuration */ protected void initialize(Configuration conf) throws IOException { if (conf.get(HADOOP_USER_GROUP_METRICS_PERCENTILES_INTERVALS) == null) { String intervals = conf.get(DFS_METRICS_PERCENTILES_INTERVALS_KEY); if (intervals != null) { conf.set(HADOOP_USER_GROUP_METRICS_PERCENTILES_INTERVALS, intervals); } } UserGroupInformation.setConfiguration(conf); loginAsNameNodeUser(conf); NameNode.initMetrics(conf, this.getRole()); StartupProgressMetrics.register(startupProgress); if (NamenodeRole.NAMENODE == role) { startHttpServer(conf); } loadNamesystem(conf); rpcServer = createRpcServer(conf); if (clientNamenodeAddress == null) { // This is expected for MiniDFSCluster. Set it now using // the RPC server's bind address. clientNamenodeAddress = NetUtils.getHostPortString(rpcServer.getRpcAddress()); LOG.info("Clients are to use " + clientNamenodeAddress + " to access" + " this namenode/service."); } if (NamenodeRole.NAMENODE == role) { httpServer.setNameNodeAddress(getNameNodeAddress()); httpServer.setFSImage(getFSImage()); } pauseMonitor = new JvmPauseMonitor(); pauseMonitor.init(conf); pauseMonitor.start(); metrics.getJvmMetrics().setPauseMonitor(pauseMonitor); startCommonServices(conf); startMetricsLogger(conf); }
/** * Initialize name-node. * * @param conf the configuration */ protected void initialize(Configuration conf) throws IOException { if (conf.get(HADOOP_USER_GROUP_METRICS_PERCENTILES_INTERVALS) == null) { String intervals = conf.get(DFS_METRICS_PERCENTILES_INTERVALS_KEY); if (intervals != null) { conf.set(HADOOP_USER_GROUP_METRICS_PERCENTILES_INTERVALS, intervals); } } UserGroupInformation.setConfiguration(conf); loginAsNameNodeUser(conf); NameNode.initMetrics(conf, this.getRole()); StartupProgressMetrics.register(startupProgress); if (NamenodeRole.NAMENODE == role) { startHttpServer(conf); } this.spanReceiverHost = SpanReceiverHost.getInstance(conf); loadNamesystem(conf); rpcServer = createRpcServer(conf); if (clientNamenodeAddress == null) { // This is expected for MiniDFSCluster. Set it now using // the RPC server's bind address. clientNamenodeAddress = NetUtils.getHostPortString(rpcServer.getRpcAddress()); LOG.info("Clients are to use " + clientNamenodeAddress + " to access" + " this namenode/service."); } if (NamenodeRole.NAMENODE == role) { httpServer.setNameNodeAddress(getNameNodeAddress()); httpServer.setFSImage(getFSImage()); } pauseMonitor = new JvmPauseMonitor(conf); pauseMonitor.start(); metrics.getJvmMetrics().setPauseMonitor(pauseMonitor); startCommonServices(conf); }