本文整理汇总了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());
}
}
示例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);
}
示例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());
}
}
示例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"));
}
示例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;
}
示例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;
}