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


Java GangliaSink30.appendPrefix方法代码示例

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


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

示例1: testTagsForPrefix

import org.apache.hadoop.metrics2.sink.ganglia.GangliaSink30; //导入方法依赖的package包/类
@Test
public void testTagsForPrefix() throws Exception {
  ConfigBuilder cb = new ConfigBuilder()
    .add("test.sink.ganglia.tagsForPrefix.all", "*")
    .add("test.sink.ganglia.tagsForPrefix.some", "NumActiveSinks, " +
            "NumActiveSources")
    .add("test.sink.ganglia.tagsForPrefix.none", "");
  GangliaSink30 sink = new GangliaSink30();
  sink.init(cb.subset("test.sink.ganglia"));

  List<MetricsTag> tags = new ArrayList<MetricsTag>();
  tags.add(new MetricsTag(MsInfo.Context, "all"));
  tags.add(new MetricsTag(MsInfo.NumActiveSources, "foo"));
  tags.add(new MetricsTag(MsInfo.NumActiveSinks, "bar"));
  tags.add(new MetricsTag(MsInfo.NumAllSinks, "haa"));
  tags.add(new MetricsTag(MsInfo.Hostname, "host"));
  Set<AbstractMetric> metrics = new HashSet<AbstractMetric>();
  MetricsRecord record = new MetricsRecordImpl(MsInfo.Context, (long) 1, tags, metrics);

  StringBuilder sb = new StringBuilder();
  sink.appendPrefix(record, sb);
  assertEquals(".NumActiveSources=foo.NumActiveSinks=bar.NumAllSinks=haa", sb.toString());

  tags.set(0, new MetricsTag(MsInfo.Context, "some"));
  sb = new StringBuilder();
  sink.appendPrefix(record, sb);
  assertEquals(".NumActiveSources=foo.NumActiveSinks=bar", sb.toString());

  tags.set(0, new MetricsTag(MsInfo.Context, "none"));
  sb = new StringBuilder();
  sink.appendPrefix(record, sb);
  assertEquals("", sb.toString());

  tags.set(0, new MetricsTag(MsInfo.Context, "nada"));
  sb = new StringBuilder();
  sink.appendPrefix(record, sb);
  assertEquals("", sb.toString());
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:39,代码来源:TestGangliaMetrics.java

示例2: testTagsForPrefix

import org.apache.hadoop.metrics2.sink.ganglia.GangliaSink30; //导入方法依赖的package包/类
@Test
public void testTagsForPrefix() throws Exception {
  ConfigBuilder cb = new ConfigBuilder()
    .add("test.sink.ganglia.tagsForPrefix.all", "*")
    .add("test.sink.ganglia.tagsForPrefix.some", "NumActiveSinks, NumActiveSources")
    .add("test.sink.ganglia.tagsForPrefix.none", "");
  GangliaSink30 sink = new GangliaSink30();
  sink.init(cb.subset("test.sink.ganglia"));

  List<MetricsTag> tags = new ArrayList<MetricsTag>();
  tags.add(new MetricsTag(MsInfo.Context, "all"));
  tags.add(new MetricsTag(MsInfo.NumActiveSources, "foo"));
  tags.add(new MetricsTag(MsInfo.NumActiveSinks, "bar"));
  tags.add(new MetricsTag(MsInfo.NumAllSinks, "haa"));
  tags.add(new MetricsTag(MsInfo.Hostname, "host"));
  Set<AbstractMetric> metrics = new HashSet<AbstractMetric>();
  MetricsRecord record = new MetricsRecordImpl(MsInfo.Context, (long) 1, tags, metrics);

  StringBuilder sb = new StringBuilder();
  sink.appendPrefix(record, sb);
  assertEquals(".NumActiveSources=foo.NumActiveSinks=bar.NumAllSinks=haa", sb.toString());

  tags.set(0, new MetricsTag(MsInfo.Context, "some"));
  sb = new StringBuilder();
  sink.appendPrefix(record, sb);
  assertEquals(".NumActiveSources=foo.NumActiveSinks=bar", sb.toString());

  tags.set(0, new MetricsTag(MsInfo.Context, "none"));
  sb = new StringBuilder();
  sink.appendPrefix(record, sb);
  assertEquals("", sb.toString());

  tags.set(0, new MetricsTag(MsInfo.Context, "nada"));
  sb = new StringBuilder();
  sink.appendPrefix(record, sb);
  assertEquals("", sb.toString());
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:38,代码来源:TestGangliaMetrics.java

示例3: testTagsForPrefix

import org.apache.hadoop.metrics2.sink.ganglia.GangliaSink30; //导入方法依赖的package包/类
@Test
public void testTagsForPrefix() throws Exception {
  ConfigBuilder cb = new ConfigBuilder()
      .add(testNamePrefix + ".sink.ganglia.tagsForPrefix.all", "*")
      .add(testNamePrefix + ".sink.ganglia.tagsForPrefix.some",
        "NumActiveSinks, " + "NumActiveSources")
      .add(testNamePrefix + ".sink.ganglia.tagsForPrefix.none", "");
  GangliaSink30 sink = new GangliaSink30();
  sink.init(cb.subset(testNamePrefix + ".sink.ganglia"));

  List<MetricsTag> tags = new ArrayList<MetricsTag>();
  tags.add(new MetricsTag(MsInfo.Context, "all"));
  tags.add(new MetricsTag(MsInfo.NumActiveSources, "foo"));
  tags.add(new MetricsTag(MsInfo.NumActiveSinks, "bar"));
  tags.add(new MetricsTag(MsInfo.NumAllSinks, "haa"));
  tags.add(new MetricsTag(MsInfo.Hostname, "host"));
  Set<AbstractMetric> metrics = new HashSet<AbstractMetric>();
  MetricsRecord record = new MetricsRecordImpl(MsInfo.Context, (long) 1, tags, metrics);

  StringBuilder sb = new StringBuilder();
  sink.appendPrefix(record, sb);
  assertEquals(".NumActiveSources=foo.NumActiveSinks=bar.NumAllSinks=haa", sb.toString());

  tags.set(0, new MetricsTag(MsInfo.Context, "some"));
  sb = new StringBuilder();
  sink.appendPrefix(record, sb);
  assertEquals(".NumActiveSources=foo.NumActiveSinks=bar", sb.toString());

  tags.set(0, new MetricsTag(MsInfo.Context, "none"));
  sb = new StringBuilder();
  sink.appendPrefix(record, sb);
  assertEquals("", sb.toString());

  tags.set(0, new MetricsTag(MsInfo.Context, "nada"));
  sb = new StringBuilder();
  sink.appendPrefix(record, sb);
  assertEquals("", sb.toString());
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:39,代码来源:TestGangliaMetrics.java


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