當前位置: 首頁>>代碼示例>>Java>>正文


Java JMXReporter類代碼示例

本文整理匯總了Java中org.apache.flink.metrics.jmx.JMXReporter的典型用法代碼示例。如果您正苦於以下問題:Java JMXReporter類的具體用法?Java JMXReporter怎麽用?Java JMXReporter使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


JMXReporter類屬於org.apache.flink.metrics.jmx包,在下文中一共展示了JMXReporter類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getFlinkConfiguration

import org.apache.flink.metrics.jmx.JMXReporter; //導入依賴的package包/類
protected static Configuration getFlinkConfiguration() {
	Configuration flinkConfig = new Configuration();
	flinkConfig.setString(AkkaOptions.WATCH_HEARTBEAT_PAUSE, "5 s");
	flinkConfig.setString(AkkaOptions.WATCH_HEARTBEAT_INTERVAL, "1 s");
	flinkConfig.setInteger(ConfigConstants.LOCAL_NUMBER_TASK_MANAGER, NUM_TMS);
	flinkConfig.setInteger(ConfigConstants.TASK_MANAGER_NUM_TASK_SLOTS, TM_SLOTS);
	flinkConfig.setLong(TaskManagerOptions.MANAGED_MEMORY_SIZE, 16L);
	flinkConfig.setString(ConfigConstants.RESTART_STRATEGY_FIXED_DELAY_DELAY, "0 s");
	flinkConfig.setString(ConfigConstants.METRICS_REPORTER_PREFIX + "my_reporter." + ConfigConstants.METRICS_REPORTER_CLASS_SUFFIX, JMXReporter.class.getName());
	return flinkConfig;
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:12,代碼來源:KafkaTestBase.java

示例2: getFlinkConfiguration

import org.apache.flink.metrics.jmx.JMXReporter; //導入依賴的package包/類
protected static Configuration getFlinkConfiguration() {
	Configuration flinkConfig = new Configuration();
	flinkConfig.setInteger(ConfigConstants.LOCAL_NUMBER_TASK_MANAGER, 1);
	flinkConfig.setInteger(ConfigConstants.TASK_MANAGER_NUM_TASK_SLOTS, 8);
	flinkConfig.setInteger(ConfigConstants.TASK_MANAGER_MEMORY_SIZE_KEY, 16);
	flinkConfig.setString(ConfigConstants.RESTART_STRATEGY_FIXED_DELAY_DELAY, "0 s");
	flinkConfig.setString(ConfigConstants.METRICS_REPORTERS_LIST, "my_reporter");
	flinkConfig.setString(ConfigConstants.METRICS_REPORTER_PREFIX + "my_reporter." + ConfigConstants.METRICS_REPORTER_CLASS_SUFFIX, JMXReporter.class.getName());
	return flinkConfig;
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:11,代碼來源:KafkaTestBase.java

示例3: testJobManagerJMXMetricAccess

import org.apache.flink.metrics.jmx.JMXReporter; //導入依賴的package包/類
/**
 * Tests that metrics registered on the JobManager are actually accessible via JMX.
 */
@Test
public void testJobManagerJMXMetricAccess() throws Exception {
	Deadline deadline = new FiniteDuration(2, TimeUnit.MINUTES).fromNow();
	Configuration flinkConfiguration = new Configuration();

	flinkConfiguration.setString(ConfigConstants.METRICS_REPORTER_PREFIX + "test." + ConfigConstants.METRICS_REPORTER_CLASS_SUFFIX, JMXReporter.class.getName());
	flinkConfiguration.setString(ConfigConstants.METRICS_REPORTER_PREFIX + "test.port", "9060-9075");

	flinkConfiguration.setString(MetricOptions.SCOPE_NAMING_JM_JOB, "jobmanager.<job_name>");

	TestingCluster flink = new TestingCluster(flinkConfiguration);

	try {
		flink.start();

		JobVertex sourceJobVertex = new JobVertex("Source");
		sourceJobVertex.setInvokableClass(BlockingInvokable.class);

		JobGraph jobGraph = new JobGraph("TestingJob", sourceJobVertex);
		jobGraph.setSnapshotSettings(new JobCheckpointingSettings(
			Collections.<JobVertexID>emptyList(),
			Collections.<JobVertexID>emptyList(),
			Collections.<JobVertexID>emptyList(),
			new CheckpointCoordinatorConfiguration(
				500,
				500,
				50,
				5,
				CheckpointRetentionPolicy.NEVER_RETAIN_AFTER_TERMINATION,
				true),
			null));

		flink.waitForActorsToBeAlive();

		flink.submitJobDetached(jobGraph);

		Future<Object> jobRunning = flink.getLeaderGateway(deadline.timeLeft())
			.ask(new TestingJobManagerMessages.WaitForAllVerticesToBeRunning(jobGraph.getJobID()), deadline.timeLeft());
		Await.ready(jobRunning, deadline.timeLeft());

		MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer();
		Set<ObjectName> nameSet = mBeanServer.queryNames(new ObjectName("org.apache.flink.jobmanager.job.lastCheckpointSize:job_name=TestingJob,*"), null);
		Assert.assertEquals(1, nameSet.size());
		assertEquals(-1L, mBeanServer.getAttribute(nameSet.iterator().next(), "Value"));

		Future<Object> jobFinished = flink.getLeaderGateway(deadline.timeLeft())
			.ask(new TestingJobManagerMessages.NotifyWhenJobRemoved(jobGraph.getJobID()), deadline.timeLeft());

		BlockingInvokable.unblock();

		// wait til the job has finished
		Await.ready(jobFinished, deadline.timeLeft());
	} finally {
		flink.stop();
	}
}
 
開發者ID:axbaretto,項目名稱:flink,代碼行數:60,代碼來源:JMXJobManagerMetricTest.java


注:本文中的org.apache.flink.metrics.jmx.JMXReporter類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。