当前位置: 首页>>代码示例>>Java>>正文


Java GangliaSink31类代码示例

本文整理汇总了Java中org.apache.hadoop.metrics2.sink.ganglia.GangliaSink31的典型用法代码示例。如果您正苦于以下问题:Java GangliaSink31类的具体用法?Java GangliaSink31怎么用?Java GangliaSink31使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


GangliaSink31类属于org.apache.hadoop.metrics2.sink.ganglia包,在下文中一共展示了GangliaSink31类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testGangliaMetrics2

import org.apache.hadoop.metrics2.sink.ganglia.GangliaSink31; //导入依赖的package包/类
@Test public void testGangliaMetrics2() throws Exception {
  ConfigBuilder cb = new ConfigBuilder().add("default.period", 10)
      .add("test.sink.gsink30.context", "test") // filter out only "test"
      .add("test.sink.gsink31.context", "test") // filter out only "test"
      .save(TestMetricsConfig.getTestFilename("hadoop-metrics2-test"));

  MetricsSystemImpl ms = new MetricsSystemImpl("Test");
  ms.start();
  TestSource s1 = ms.register("s1", "s1 desc", new TestSource("s1rec"));
  s1.s1.add(0);

  AbstractGangliaSink gsink30 = new GangliaSink30();
  gsink30.init(cb.subset("test"));
  MockDatagramSocket mockds30 = new MockDatagramSocket();
  GangliaMetricsTestHelper.setDatagramSocket(gsink30, mockds30);

  AbstractGangliaSink gsink31 = new GangliaSink31();
  gsink31.init(cb.subset("test"));
  MockDatagramSocket mockds31 = new MockDatagramSocket();
  GangliaMetricsTestHelper.setDatagramSocket(gsink31, mockds31);

  ms.register("gsink30", "gsink30 desc", gsink30);
  ms.register("gsink31", "gsink31 desc", gsink31);
  ms.onTimerEvent();  // trigger something interesting
  ms.stop();

  // check GanfliaSink30 data
  checkMetrics(mockds30.getCapturedSend());

  // check GanfliaSink31 data
  checkMetrics(mockds31.getCapturedSend());
}
 
开发者ID:Seagate,项目名称:hadoop-on-lustre,代码行数:33,代码来源:TestGangliaMetrics.java

示例2: testGangliaMetrics2

import org.apache.hadoop.metrics2.sink.ganglia.GangliaSink31; //导入依赖的package包/类
@Test public void testGangliaMetrics2() throws Exception {
  ConfigBuilder cb = new ConfigBuilder().add("default.period", 10)
      .add("test.sink.gsink30.context", "test") // filter out only "test"
      .add("test.sink.gsink31.context", "test") // filter out only "test"
      .save(TestMetricsConfig.getTestFilename("hadoop-metrics2-test"));

  MetricsSystemImpl ms = new MetricsSystemImpl("Test");
  ms.start();
  TestSource s1 = ms.register("s1", "s1 desc", new TestSource("s1rec"));
  s1.c1.incr();
  s1.xxx.incr();
  s1.g1.set(2);
  s1.yyy.incr(2);
  s1.s1.add(0);

  final int expectedCountFromGanglia30 = expectedMetrics.length;
  final int expectedCountFromGanglia31 = 2 * expectedMetrics.length;

  // Setup test for GangliaSink30
  AbstractGangliaSink gsink30 = new GangliaSink30();
  gsink30.init(cb.subset("test"));
  MockDatagramSocket mockds30 = new MockDatagramSocket();
  GangliaMetricsTestHelper.setDatagramSocket(gsink30, mockds30);

  // Setup test for GangliaSink31
  AbstractGangliaSink gsink31 = new GangliaSink31();
  gsink31.init(cb.subset("test"));
  MockDatagramSocket mockds31 = new MockDatagramSocket();
  GangliaMetricsTestHelper.setDatagramSocket(gsink31, mockds31);

  // register the sinks
  ms.register("gsink30", "gsink30 desc", gsink30);
  ms.register("gsink31", "gsink31 desc", gsink31);
  ms.publishMetricsNow(); // publish the metrics

  ms.stop();

  // check GanfliaSink30 data
  checkMetrics(mockds30.getCapturedSend(), expectedCountFromGanglia30);

  // check GanfliaSink31 data
  checkMetrics(mockds31.getCapturedSend(), expectedCountFromGanglia31);
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:44,代码来源:TestGangliaMetrics.java

示例3: testGangliaMetrics2

import org.apache.hadoop.metrics2.sink.ganglia.GangliaSink31; //导入依赖的package包/类
@Test public void testGangliaMetrics2() throws Exception {
  // Setting long interval to avoid periodic publishing.
  // We manually publish metrics by MeticsSystem#publishMetricsNow here.
  ConfigBuilder cb = new ConfigBuilder().add("*.period", 120)
      .add(testNamePrefix
          + ".sink.gsink30.context", testNamePrefix) // filter out only "test"
      .add(testNamePrefix
          + ".sink.gsink31.context", testNamePrefix) // filter out only "test"
      .save(TestMetricsConfig.getTestFilename("hadoop-metrics2-"
          + testNamePrefix));

  MetricsSystemImpl ms = new MetricsSystemImpl(testNamePrefix);
  ms.start();
  TestSource s1 = ms.register("s1", "s1 desc", new TestSource("s1rec"));
  s1.c1.incr();
  s1.xxx.incr();
  s1.g1.set(2);
  s1.yyy.incr(2);
  s1.s1.add(0);

  final int expectedCountFromGanglia30 = expectedMetrics.length;
  final int expectedCountFromGanglia31 = 2 * expectedMetrics.length;

  // Setup test for GangliaSink30
  AbstractGangliaSink gsink30 = new GangliaSink30();
  gsink30.init(cb.subset(testNamePrefix));
  MockDatagramSocket mockds30 = new MockDatagramSocket();
  GangliaMetricsTestHelper.setDatagramSocket(gsink30, mockds30);

  // Setup test for GangliaSink31
  AbstractGangliaSink gsink31 = new GangliaSink31();
  gsink31.init(cb.subset(testNamePrefix));
  MockDatagramSocket mockds31 = new MockDatagramSocket();
  GangliaMetricsTestHelper.setDatagramSocket(gsink31, mockds31);

  // register the sinks
  ms.register("gsink30", "gsink30 desc", gsink30);
  ms.register("gsink31", "gsink31 desc", gsink31);
  ms.publishMetricsNow(); // publish the metrics

  ms.stop();

  // check GanfliaSink30 data
  checkMetrics(mockds30.getCapturedSend(), expectedCountFromGanglia30);

  // check GanfliaSink31 data
  checkMetrics(mockds31.getCapturedSend(), expectedCountFromGanglia31);
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:49,代码来源:TestGangliaMetrics.java


注:本文中的org.apache.hadoop.metrics2.sink.ganglia.GangliaSink31类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。