当前位置: 首页>>代码示例>>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;未经允许,请勿转载。