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


Java MetricsRecordBuilder.parent方法代码示例

本文整理汇总了Java中org.apache.hadoop.metrics2.MetricsRecordBuilder.parent方法的典型用法代码示例。如果您正苦于以下问题:Java MetricsRecordBuilder.parent方法的具体用法?Java MetricsRecordBuilder.parent怎么用?Java MetricsRecordBuilder.parent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.hadoop.metrics2.MetricsRecordBuilder的用法示例。


在下文中一共展示了MetricsRecordBuilder.parent方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testPresence

import org.apache.hadoop.metrics2.MetricsRecordBuilder; //导入方法依赖的package包/类
@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());
  }
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:25,代码来源:TestJvmMetrics.java

示例2: testHybrid

import org.apache.hadoop.metrics2.MetricsRecordBuilder; //导入方法依赖的package包/类
@Test public void testHybrid() {
  HybridMetrics metrics = new HybridMetrics();
  MetricsSource source = MetricsAnnotations.makeSource(metrics);

  assertSame(metrics, source);
  metrics.C0.incr();
  MetricsRecordBuilder rb = getMetrics(source);
  MetricsCollector collector = rb.parent();

  verify(collector).addRecord("foo");
  verify(collector).addRecord("bar");
  verify(collector).addRecord(info("HybridMetrics", "HybridMetrics"));
  verify(rb).setContext("foocontext");
  verify(rb).addCounter(info("C1", "C1 desc"), 1);
  verify(rb).setContext("barcontext");
  verify(rb).addGauge(info("G1", "G1 desc"), 1);
  verify(rb).add(tag(MsInfo.Context, "hybrid"));
  verify(rb).addCounter(info("C0", "C0 desc"), 1);
  verify(rb).addGauge(info("G0", "G0"), 0);
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:21,代码来源:TestMetricsAnnotations.java

示例3: testPresence

import org.apache.hadoop.metrics2.MetricsRecordBuilder; //导入方法依赖的package包/类
@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());
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:22,代码来源:TestJvmMetrics.java

示例4: testClasses

import org.apache.hadoop.metrics2.MetricsRecordBuilder; //导入方法依赖的package包/类
@Test public void testClasses() {
  MetricsRecordBuilder rb = getMetrics(
      MetricsAnnotations.makeSource(new MyMetrics3()));
  MetricsCollector collector = rb.parent();

  verify(collector).addRecord(info("MyMetrics3", "My metrics"));
  verify(rb).add(tag(MsInfo.Context, "foo"));
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:9,代码来源:TestMetricsAnnotations.java

示例5: getMetrics

import org.apache.hadoop.metrics2.MetricsRecordBuilder; //导入方法依赖的package包/类
/**
 * Call getMetrics on source and get a record builder mock to verify
 * @param source  the metrics source
 * @param all     if true, return all metrics even if not changed
 * @return the record builder mock to verifyÏ
 */
public static MetricsRecordBuilder getMetrics(MetricsSource source,
                                              boolean all) {
  MetricsRecordBuilder rb = mockMetricsRecordBuilder();
  MetricsCollector mc = rb.parent();
  source.getMetrics(mc, all);
  return rb;
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:14,代码来源:MetricsAsserts.java

示例6: getMetrics

import org.apache.hadoop.metrics2.MetricsRecordBuilder; //导入方法依赖的package包/类
/**
 * Call getMetrics on source and get a record builder mock to verify
 * @param source  the metrics source
 * @param all     if true, return all metrics even if not changed
 * @return the record builder mock to verify
 */
public static MetricsRecordBuilder getMetrics(MetricsSource source,
                                              boolean all) {
  MetricsRecordBuilder rb = mockMetricsRecordBuilder();
  MetricsCollector mc = rb.parent();
  source.getMetrics(mc, all);
  return rb;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:14,代码来源:MetricsAsserts.java


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