Examples of MetricsTag


Examples of org.apache.hadoop.metrics2.MetricsTag

    MetricsInfo info = info("m", "m desc");
    assertSame("same info", info, info("m", "m desc"));
  }

  @Test public void testTag() {
    MetricsTag tag = tag("t", "t desc", "t value");
    assertSame("same tag", tag, tag("t", "t desc", "t value"));
  }
View Full Code Here

Examples of org.apache.hadoop.metrics2.MetricsTag

    }
    assertNotSame("i1 is gone", i1,  info("m1", "m desc"));
  }

  @Test public void testTagOverflow() {
    MetricsTag t0 = tag("t0", "t desc", "t value");
    for (int i = 0; i < MAX_TAG_NAMES + 1; ++i) {
      tag("t"+ i, "t desc", "t value");
      if (i < MAX_TAG_NAMES) {
        assertSame("t0 still there", t0, tag("t0", "t desc", "t value"));
      }
    }
    assertNotSame("t0 is gone", t0, tag("t0", "t desc", "t value"));

    MetricsTag t1 = tag("t1", "t desc", "t value");
    for (int i = 0; i < MAX_TAG_VALUES; ++i) {
      tag("t1", "t desc", "t value"+ i);
      if (i < MAX_TAG_VALUES -1) {
        assertSame("t1 is still there", t1, tag("t1", "t desc", "t value"));
      }
View Full Code Here

Examples of org.apache.hadoop.metrics2.MetricsTag

    assertEquals("accepts "+ tags, expectAcceptList, regexFilter.accepts(tags));
   
    // Test results on each of the individual tags:
    int acceptedCount = 0;
    for (int i=0; i<tags.size(); i++) {
      MetricsTag tag = tags.get(i);
      boolean actGlob = globFilter.accepts(tag);
      boolean actRegex = regexFilter.accepts(tag);
      assertEquals("accepts "+tag, expectedAcceptedSpec[i], actGlob);
      // Both the filters should give the same result:
      assertEquals(actGlob, actRegex);
View Full Code Here

Examples of org.apache.hadoop.metrics2.MetricsTag

   * @param value of the tag
   * @param override existing tag if true
   * @return the registry (for keep adding tags etc.)
   */
  public DynamicMetricsRegistry tag(MetricsInfo info, String value, boolean override) {
    MetricsTag tag = Interns.tag(info, value);

    if (!override) {
      MetricsTag existing = tagsMap.putIfAbsent(info.name(), tag);
      if (existing != null) {
        throw new MetricsException("Tag "+ info.name() +" already exists!");
      }
      return this;
    }
View Full Code Here

Examples of org.apache.hadoop.metrics2.MetricsTag

   * @param value of the tag
   * @param override existing tag if true
   * @return the registry (for keep adding tags etc.)
   */
  public DynamicMetricsRegistry tag(MetricsInfo info, String value, boolean override) {
    MetricsTag tag = Interns.tag(info, value);

    if (!override) {
      MetricsTag existing = tagsMap.putIfAbsent(info.name(), tag);
      if (existing != null) {
        throw new MetricsException("Tag "+ info.name() +" already exists!");
      }
      return this;
    }
View Full Code Here

Examples of org.apache.hadoop.metrics2.MetricsTag

   * @param override  existing tag if true
   * @return  the registry (for keep adding tags)
   */
  public DynamicMetricsRegistry tag(String name, String description, String value,
                             boolean override) {
    MetricsTag tag = new MetricsTag(name, description, value);

    if (!override) {
      MetricsTag existing = tagsMap.putIfAbsent(name, tag);
      if (existing != null) {
        throw new MetricsException("Tag "+ name +" already exists!");
      }
      return this;
    }
View Full Code Here

Examples of org.apache.hadoop.metrics2.MetricsTag

  static void checkMetricsRecords(List<MetricsRecord> recs, String expected) {
    LOG.debug(recs);
    MetricsRecord r = recs.get(0);
    assertEquals("name", expected, r.name());
    assertEquals("tags", new MetricsTag[] {
      new MetricsTag("context", "Metrics context", "test"),
      new MetricsTag("hostName", "Local hostname", hostname)}, r.tags());
    assertEquals("metrics", new Metric[] {
      new MetricCounterLong("c1", "c1 desc", 1),
      new MetricGaugeLong("g1", "g1 desc", 2),
      new MetricCounterLong("s1_num_ops", "Number of ops for s1 desc", 1),
      new MetricGaugeDouble("s1_avg_time", "Average time for s1 desc", 0)},
View Full Code Here

Examples of org.apache.hadoop.metrics2.MetricsTag

   * @return  the registry (for keep adding tags)
   */
  public MetricsRegistry tag(String name, String description, String value,
                             boolean override) {
    if (!override) checkTagName(name);
    tagsMap.put(name, new MetricsTag(name, description, value));
    return this;
  }
View Full Code Here

Examples of org.apache.hadoop.metrics2.MetricsTag

  @Override
  public MetricsRecordBuilder tag(String name, String description,
                                  String value) {
    if (acceptable) {
      tags.add(new MetricsTag(name, description, value));
    }
    return this;
  }
View Full Code Here

Examples of org.apache.hadoop.metrics2.MetricsTag

    configureSources();
    configureSystem();
  }

  private synchronized void configureSystem() {
    injectedTags.add(new MetricsTag("hostName", "Local hostname",
                                    getHostname()));
  }
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.