Examples of MetricsTag


Examples of org.apache.hadoop.metrics2.MetricsTag

   * Filters should default to accept
   */
  @Test public void emptyConfigShouldAccept() {
    SubsetConfiguration empty = new ConfigBuilder().subset("");
    shouldAccept(empty, "anything");
    shouldAccept(empty, Arrays.asList(new MetricsTag("key", "desc", "value")));
  }
View Full Code Here

Examples of org.apache.hadoop.metrics2.MetricsTag

  @Test public void includeOnlyShouldOnlyIncludeMatched() {
    SubsetConfiguration wl = new ConfigBuilder()
        .add("p.include", "foo")
        .add("p.include.tags", "foo:f").subset("p");
    shouldAccept(wl, "foo");
    shouldAccept(wl, Arrays.asList(new MetricsTag("bar", "", ""),
                                   new MetricsTag("foo", "", "f")));
    shouldReject(wl, "bar");
    shouldReject(wl, Arrays.asList(new MetricsTag("bar", "", "")));
    shouldReject(wl, Arrays.asList(new MetricsTag("foo", "", "boo")));
  }
View Full Code Here

Examples of org.apache.hadoop.metrics2.MetricsTag

  @Test public void excludeOnlyShouldOnlyExcludeMatched() {
    SubsetConfiguration bl = new ConfigBuilder()
        .add("p.exclude", "foo")
        .add("p.exclude.tags", "foo:f").subset("p");
    shouldAccept(bl, "bar");
    shouldAccept(bl, Arrays.asList(new MetricsTag("bar", "", "")));
    shouldReject(bl, "foo");
    shouldReject(bl, Arrays.asList(new MetricsTag("bar", "", ""),
                                   new MetricsTag("foo", "", "f")));
  }
View Full Code Here

Examples of org.apache.hadoop.metrics2.MetricsTag

        .add("p.include", "foo")
        .add("p.include.tags", "foo:f")
        .add("p.exclude", "bar")
        .add("p.exclude.tags", "bar:b").subset("p");
    shouldAccept(c, "foo");
    shouldAccept(c, Arrays.asList(new MetricsTag("foo", "", "f")));
    shouldReject(c, "bar");
    shouldReject(c, Arrays.asList(new MetricsTag("bar", "", "b")));
    shouldAccept(c, "foobar");
    shouldAccept(c, Arrays.asList(new MetricsTag("foobar", "", "")));
  }
View Full Code Here

Examples of org.apache.hadoop.metrics2.MetricsTag

        .add("p.include", "foo")
        .add("p.include.tags", "foo:f")
        .add("p.exclude", "foo")
        .add("p.exclude.tags", "foo:f").subset("p");
    shouldAccept(c, "foo");
    shouldAccept(c, Arrays.asList(new MetricsTag("foo", "", "f")));
  }
View Full Code Here

Examples of org.apache.hadoop.metrics2.MetricsTag

    when(mr.metrics()).thenReturn(metrics);
    return mr;
  }

  private MetricsTag makeTag(String name, String value) {
    return new MetricsTag(name, "", value);
  }
View Full Code Here

Examples of org.apache.hadoop.metrics2.MetricsTag

      .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());
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.