Java Code Examples for org.apache.hadoop.metrics2.MetricsTag

The following examples show how to use org.apache.hadoop.metrics2.MetricsTag. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: ambari-metrics   Source File: HadoopTimelineMetricsSink.java    License: Apache License 2.0 6 votes vote down vote up
@InterfaceAudience.Private
public void appendPrefix(MetricsRecord record, StringBuilder sb) {
  String contextName = record.context();
  Collection<MetricsTag> tags = record.tags();
  if (useTagsMap.containsKey(contextName)) {
    Set<String> useTags = useTagsMap.get(contextName);
    for (MetricsTag t : tags) {
      if (useTags == null || useTags.contains(t.name())) {

        // the context is always skipped here because it is always added

        // the hostname is always skipped to avoid case-mismatches
        // from different DNSes.

        if (t.info() != MsInfo.Context && t.info() != MsInfo.Hostname && t.value() != null) {
          sb.append('.').append(t.name()).append('=').append(t.value());
        }
      }
    }
  }
}
 
Example 2
Source Project: hadoop   Source File: FileSink.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void putMetrics(MetricsRecord record) {
  writer.print(record.timestamp());
  writer.print(" ");
  writer.print(record.context());
  writer.print(".");
  writer.print(record.name());
  String separator = ": ";
  for (MetricsTag tag : record.tags()) {
    writer.print(separator);
    separator = ", ";
    writer.print(tag.name());
    writer.print("=");
    writer.print(tag.value());
  }
  for (AbstractMetric metric : record.metrics()) {
    writer.print(separator);
    separator = ", ";
    writer.print(metric.name());
    writer.print("=");
    writer.print(metric.value());
  }
  writer.println();
}
 
Example 3
Source Project: hadoop   Source File: GangliaSink30.java    License: Apache License 2.0 6 votes vote down vote up
@InterfaceAudience.Private
public void appendPrefix(MetricsRecord record, StringBuilder sb) {
  String contextName = record.context();
  Collection<MetricsTag> tags = record.tags();
  if (useTagsMap.containsKey(contextName)) {
    Set<String> useTags = useTagsMap.get(contextName);
    for (MetricsTag t : tags) {
      if (useTags == null || useTags.contains(t.name())) {

        // the context is always skipped here because it is always added
        
        // the hostname is always skipped to avoid case-mismatches 
        // from different DNSes.

        if (t.info() != MsInfo.Context && t.info() != MsInfo.Hostname && t.value() != null) {
          sb.append('.').append(t.name()).append('=').append(t.value());
        }
      }
    }
  }          
}
 
Example 4
Source Project: hadoop   Source File: MetricsCache.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Update the cache and return the current cached record
 * @param mr the update record
 * @param includingTags cache tag values (for later lookup by name) if true
 * @return the updated cache record
 */
public Record update(MetricsRecord mr, boolean includingTags) {
  String name = mr.name();
  RecordCache recordCache = map.get(name);
  if (recordCache == null) {
    recordCache = new RecordCache();
    map.put(name, recordCache);
  }
  Collection<MetricsTag> tags = mr.tags();
  Record record = recordCache.get(tags);
  if (record == null) {
    record = new Record();
    recordCache.put(tags, record);
  }
  for (AbstractMetric m : mr.metrics()) {
    record.metrics.put(m.name(), m);
  }
  if (includingTags) {
    // mostly for some sinks that include tags as part of a dense schema
    for (MetricsTag t : mr.tags()) {
      record.tags.put(t.name(), t.value());
    }
  }
  return record;
}
 
Example 5
Source Project: hadoop   Source File: MBeanInfoBuilder.java    License: Apache License 2.0 6 votes vote down vote up
MBeanInfo get() {
  curRecNo = 0;
  for (MetricsRecordImpl rec : recs) {
    for (MetricsTag t : rec.tags()) {
      attrs.add(newAttrInfo("tag."+ t.name(), t.description(),
                "java.lang.String"));
    }
    for (AbstractMetric m : rec.metrics()) {
      m.visit(this);
    }
    ++curRecNo;
  }
  MetricsSystemImpl.LOG.debug(attrs);
  MBeanAttributeInfo[] attrsArray = new MBeanAttributeInfo[attrs.size()];
  return new MBeanInfo(name, description, attrs.toArray(attrsArray),
                       null, null, null); // no ops/ctors/notifications
}
 
Example 6
Source Project: hadoop   Source File: MetricsSourceAdapter.java    License: Apache License 2.0 6 votes vote down vote up
Iterable<MetricsRecordImpl> getMetrics(MetricsCollectorImpl builder,
                                       boolean all) {
  builder.setRecordFilter(recordFilter).setMetricFilter(metricFilter);
  synchronized(this) {
    if (lastRecs == null && jmxCacheTS == 0) {
      all = true; // Get all the metrics to populate the sink caches
    }
  }
  try {
    source.getMetrics(builder, all);
  }
  catch (Exception e) {
    LOG.error("Error getting metrics from source "+ name, e);
  }
  for (MetricsRecordBuilderImpl rb : builder) {
    for (MetricsTag t : injectedTags) {
      rb.add(t);
    }
  }
  synchronized(this) {
    lastRecs = builder.getRecords();
    return lastRecs;
  }
}
 
Example 7
Source Project: big-c   Source File: AbstractPatternFilter.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public boolean accepts(MetricsTag tag) {
  // Accept if whitelisted
  Pattern ipat = includeTagPatterns.get(tag.name());
  if (ipat != null && ipat.matcher(tag.value()).matches()) {
    return true;
  }
  // Reject if blacklisted
  Pattern epat = excludeTagPatterns.get(tag.name());
  if (epat != null && epat.matcher(tag.value()).matches()) {
    return false;
  }
  // Reject if no match in whitelist only mode
  if (!includeTagPatterns.isEmpty() && excludeTagPatterns.isEmpty()) {
    return false;
  }
  return true;
}
 
Example 8
Source Project: hadoop   Source File: TestMetricsSystemImpl.java    License: Apache License 2.0 6 votes vote down vote up
private void checkMetricsRecords(List<MetricsRecord> recs) {
  LOG.debug(recs);
  MetricsRecord r = recs.get(0);
  assertEquals("name", "s1rec", r.name());
  assertEquals("tags", new MetricsTag[] {
    tag(MsInfo.Context, "test"),
    tag(MsInfo.Hostname, hostname)}, r.tags());
  assertEquals("metrics", MetricsLists.builder("")
    .addCounter(info("C1", "C1 desc"), 1L)
    .addGauge(info("G1", "G1 desc"), 2L)
    .addCounter(info("S1NumOps", "Number of ops for s1"), 1L)
    .addGauge(info("S1AvgTime", "Average time for s1"), 0.0)
    .metrics(), r.metrics());

  r = recs.get(1);
  assertTrue("NumActiveSinks should be 3", Iterables.contains(r.metrics(),
             new MetricGaugeInt(MsInfo.NumActiveSinks, 3)));
}
 
Example 9
Source Project: big-c   Source File: TestInterns.java    License: Apache License 2.0 6 votes vote down vote up
@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"));
    }
  }
  assertNotSame("t1 is gone", t1, tag("t1", "t desc", "t value"));
}
 
Example 10
Source Project: big-c   Source File: GangliaSink30.java    License: Apache License 2.0 6 votes vote down vote up
@InterfaceAudience.Private
public void appendPrefix(MetricsRecord record, StringBuilder sb) {
  String contextName = record.context();
  Collection<MetricsTag> tags = record.tags();
  if (useTagsMap.containsKey(contextName)) {
    Set<String> useTags = useTagsMap.get(contextName);
    for (MetricsTag t : tags) {
      if (useTags == null || useTags.contains(t.name())) {

        // the context is always skipped here because it is always added
        
        // the hostname is always skipped to avoid case-mismatches 
        // from different DNSes.

        if (t.info() != MsInfo.Context && t.info() != MsInfo.Hostname && t.value() != null) {
          sb.append('.').append(t.name()).append('=').append(t.value());
        }
      }
    }
  }          
}
 
Example 11
Source Project: big-c   Source File: MetricsCache.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Update the cache and return the current cached record
 * @param mr the update record
 * @param includingTags cache tag values (for later lookup by name) if true
 * @return the updated cache record
 */
public Record update(MetricsRecord mr, boolean includingTags) {
  String name = mr.name();
  RecordCache recordCache = map.get(name);
  if (recordCache == null) {
    recordCache = new RecordCache();
    map.put(name, recordCache);
  }
  Collection<MetricsTag> tags = mr.tags();
  Record record = recordCache.get(tags);
  if (record == null) {
    record = new Record();
    recordCache.put(tags, record);
  }
  for (AbstractMetric m : mr.metrics()) {
    record.metrics.put(m.name(), m);
  }
  if (includingTags) {
    // mostly for some sinks that include tags as part of a dense schema
    for (MetricsTag t : mr.tags()) {
      record.tags.put(t.name(), t.value());
    }
  }
  return record;
}
 
Example 12
Source Project: big-c   Source File: MBeanInfoBuilder.java    License: Apache License 2.0 6 votes vote down vote up
MBeanInfo get() {
  curRecNo = 0;
  for (MetricsRecordImpl rec : recs) {
    for (MetricsTag t : rec.tags()) {
      attrs.add(newAttrInfo("tag."+ t.name(), t.description(),
                "java.lang.String"));
    }
    for (AbstractMetric m : rec.metrics()) {
      m.visit(this);
    }
    ++curRecNo;
  }
  MetricsSystemImpl.LOG.debug(attrs);
  MBeanAttributeInfo[] attrsArray = new MBeanAttributeInfo[attrs.size()];
  return new MBeanInfo(name, description, attrs.toArray(attrsArray),
                       null, null, null); // no ops/ctors/notifications
}
 
Example 13
Source Project: big-c   Source File: MetricsSourceAdapter.java    License: Apache License 2.0 6 votes vote down vote up
Iterable<MetricsRecordImpl> getMetrics(MetricsCollectorImpl builder,
                                       boolean all) {
  builder.setRecordFilter(recordFilter).setMetricFilter(metricFilter);
  synchronized(this) {
    if (lastRecs == null && jmxCacheTS == 0) {
      all = true; // Get all the metrics to populate the sink caches
    }
  }
  try {
    source.getMetrics(builder, all);
  }
  catch (Exception e) {
    LOG.error("Error getting metrics from source "+ name, e);
  }
  for (MetricsRecordBuilderImpl rb : builder) {
    for (MetricsTag t : injectedTags) {
      rb.add(t);
    }
  }
  synchronized(this) {
    lastRecs = builder.getRecords();
    return lastRecs;
  }
}
 
Example 14
Source Project: big-c   Source File: MetricsSourceAdapter.java    License: Apache License 2.0 6 votes vote down vote up
private int updateAttrCache() {
  LOG.debug("Updating attr cache...");
  int recNo = 0;
  int numMetrics = 0;
  for (MetricsRecordImpl record : lastRecs) {
    for (MetricsTag t : record.tags()) {
      setAttrCacheTag(t, recNo);
      ++numMetrics;
    }
    for (AbstractMetric m : record.metrics()) {
      setAttrCacheMetric(m, recNo);
      ++numMetrics;
    }
    ++recNo;
  }
  LOG.debug("Done. # tags & metrics="+ numMetrics);
  return numMetrics;
}
 
Example 15
Source Project: big-c   Source File: MetricsRecords.java    License: Apache License 2.0 5 votes vote down vote up
public static void assertTag(MetricsRecord record, String tagName,
    String expectedValue) {
  MetricsTag processIdTag = getFirstTagByName(record,
      tagName);
  assertNotNull(processIdTag);
  assertEquals(expectedValue, processIdTag.value());
}
 
Example 16
Source Project: big-c   Source File: TestGraphiteMetrics.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testFailureAndPutMetrics() throws IOException {
  GraphiteSink sink = new GraphiteSink();
  List<MetricsTag> tags = new ArrayList<MetricsTag>();
  tags.add(new MetricsTag(MsInfo.Context, "all"));
  tags.add(new MetricsTag(MsInfo.Hostname, "host"));
  Set<AbstractMetric> metrics = new HashSet<AbstractMetric>();
  metrics.add(makeMetric("foo1", 1.25));
  metrics.add(makeMetric("foo2", 2.25));
  MetricsRecord record = new MetricsRecordImpl(MsInfo.Context, (long) 10000, tags, metrics);

  final GraphiteSink.Graphite mockGraphite = makeGraphite();
  Whitebox.setInternalState(sink, "graphite", mockGraphite);

  // throw exception when first try
  doThrow(new IOException("IO exception")).when(mockGraphite).write(anyString());

  sink.putMetrics(record);
  verify(mockGraphite).write(anyString());
  verify(mockGraphite).close();

  // reset mock and try again
  reset(mockGraphite);
  when(mockGraphite.isConnected()).thenReturn(false);

  ArgumentCaptor<String> argument = ArgumentCaptor.forClass(String.class);
  sink.putMetrics(record);

  verify(mockGraphite).write(argument.capture());
  String result = argument.getValue();

  assertEquals(true,
      result.equals("null.all.Context.Context=all.Hostname=host.foo1 1.25 10\n" +
      "null.all.Context.Context=all.Hostname=host.foo2 2.25 10\n") ||
      result.equals("null.all.Context.Context=all.Hostname=host.foo2 2.25 10\n" +
      "null.all.Context.Context=all.Hostname=host.foo1 1.25 10\n"));
}
 
Example 17
Source Project: phoenix   Source File: TraceMetricsSourceTest.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * If the source does not write any metrics when there are no spans, i.e. when initialized,
 * then the metrics system will discard the source, so it needs to always emit some metrics.
 */
@Test
public void testWritesInfoWhenNoSpans(){
  TraceMetricSource source = new TraceMetricSource();
  MetricsCollector collector = Mockito.mock(MetricsCollector.class);
  MetricsRecordBuilder builder = Mockito.mock(MetricsRecordBuilder.class);
  Mockito.when(collector.addRecord(Mockito.anyString())).thenReturn(builder);

  source.getMetrics(collector, true);

  // verify that we add a record and that the record has some info
  Mockito.verify(collector).addRecord(Mockito.anyString());
  Mockito.verify(builder).add(Mockito.any(MetricsTag.class));
}
 
Example 18
Source Project: hbase   Source File: TestBalancerStatusTagInJMXMetrics.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Gets the balancer status tag from the Metrics registry
 */
public String getStatus() throws Exception {
  MetricsSource source =
      DefaultMetricsSystem.instance().getSource(MetricsBalancerSource.METRICS_JMX_CONTEXT);
  if (source instanceof MetricsBalancerSourceImpl) {
    MetricsTag status = ((MetricsBalancerSourceImpl) source).getMetricsRegistry()
        .getTag(MetricsBalancerSource.BALANCER_STATUS);
    return status.value();
  } else {
    LOG.warn("Balancer JMX Metrics not registered");
    throw new Exception("MetricsBalancer JMX Context not found");
  }
}
 
Example 19
Source Project: big-c   Source File: TestMetricsCache.java    License: Apache License 2.0 5 votes vote down vote up
@Test public void testOverflow() {
  MetricsCache cache = new MetricsCache();
  MetricsCache.Record cr;
  Collection<MetricsTag> t0 = Arrays.asList(makeTag("t0", "0"));
  for (int i = 0; i < MetricsCache.MAX_RECS_PER_NAME_DEFAULT + 1; ++i) {
    cr = cache.update(makeRecord("r",
        Arrays.asList(makeTag("t"+ i, ""+ i)),
        Arrays.asList(makeMetric("m", i))));
    checkMetricValue("new metric value", cr, "m", i);
    if (i < MetricsCache.MAX_RECS_PER_NAME_DEFAULT) {
      assertNotNull("t0 is still there", cache.get("r", t0));
    }
  }
  assertNull("t0 is gone", cache.get("r", t0));
}
 
Example 20
Source Project: hadoop   Source File: MetricsRegistry.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Sample all the mutable metrics and put the snapshot in the builder
 * @param builder to contain the metrics snapshot
 * @param all get all the metrics even if the values are not changed.
 */
public synchronized void snapshot(MetricsRecordBuilder builder, boolean all) {
  for (MetricsTag tag : tags()) {
    builder.add(tag);
  }
  for (MutableMetric metric : metrics()) {
    metric.snapshot(builder, all);
  }
}
 
Example 21
Source Project: hadoop   Source File: MetricsCache.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected boolean removeEldestEntry(Map.Entry<Collection<MetricsTag>,
                                              Record> eldest) {
  boolean overflow = size() > maxRecsPerName;
  if (overflow && !gotOverflow) {
    LOG.warn("Metrics cache overflow at "+ size() +" for "+ eldest);
    gotOverflow = true;
  }
  return overflow;
}
 
Example 22
Source Project: hadoop   Source File: MetricsSourceAdapter.java    License: Apache License 2.0 5 votes vote down vote up
MetricsSourceAdapter(String prefix, String name, String description,
                     MetricsSource source, Iterable<MetricsTag> injectedTags,
                     MetricsFilter recordFilter, MetricsFilter metricFilter,
                     int jmxCacheTTL, boolean startMBeans) {
  this.prefix = checkNotNull(prefix, "prefix");
  this.name = checkNotNull(name, "name");
  this.source = checkNotNull(source, "source");
  attrCache = Maps.newHashMap();
  infoBuilder = new MBeanInfoBuilder(name, description);
  this.injectedTags = injectedTags;
  this.recordFilter = recordFilter;
  this.metricFilter = metricFilter;
  this.jmxCacheTTL = checkArg(jmxCacheTTL, jmxCacheTTL > 0, "jmxCacheTTL");
  this.startMBeans = startMBeans;
}
 
Example 23
Source Project: hadoop   Source File: MetricsSourceAdapter.java    License: Apache License 2.0 5 votes vote down vote up
MetricsSourceAdapter(String prefix, String name, String description,
                     MetricsSource source, Iterable<MetricsTag> injectedTags,
                     int period, MetricsConfig conf) {
  this(prefix, name, description, source, injectedTags,
       conf.getFilter(RECORD_FILTER_KEY),
       conf.getFilter(METRIC_FILTER_KEY),
       period + 1, // hack to avoid most of the "innocuous" races.
       conf.getBoolean(START_MBEANS_KEY, true));
}
 
Example 24
Source Project: big-c   Source File: TestMetricsCache.java    License: Apache License 2.0 5 votes vote down vote up
private MetricsRecord makeRecord(String name, Collection<MetricsTag> tags,
                                 Collection<AbstractMetric> metrics) {
  MetricsRecord mr = mock(MetricsRecord.class);
  when(mr.name()).thenReturn(name);
  when(mr.tags()).thenReturn(tags);
  when(mr.metrics()).thenReturn(metrics);
  return mr;
}
 
Example 25
Source Project: big-c   Source File: TestGraphiteMetrics.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testPutMetrics2() {
    GraphiteSink sink = new GraphiteSink();
    List<MetricsTag> tags = new ArrayList<MetricsTag>();
    tags.add(new MetricsTag(MsInfo.Context, "all"));
  tags.add(new MetricsTag(MsInfo.Hostname, null));
    Set<AbstractMetric> metrics = new HashSet<AbstractMetric>();
    metrics.add(makeMetric("foo1", 1));
    metrics.add(makeMetric("foo2", 2));
    MetricsRecord record = new MetricsRecordImpl(MsInfo.Context, (long) 10000, tags, metrics);


    ArgumentCaptor<String> argument = ArgumentCaptor.forClass(String.class);
    final GraphiteSink.Graphite mockGraphite = makeGraphite();
    Whitebox.setInternalState(sink, "graphite", mockGraphite);
    sink.putMetrics(record);

    try {
        verify(mockGraphite).write(argument.capture());
    } catch (IOException e) {
        e.printStackTrace();
    }

    String result = argument.getValue();

    assertEquals(true,
        result.equals("null.all.Context.Context=all.foo1 1 10\n" + 
        "null.all.Context.Context=all.foo2 2 10\n") ||
        result.equals("null.all.Context.Context=all.foo2 2 10\n" + 
        "null.all.Context.Context=all.foo1 1 10\n"));
}
 
Example 26
Source Project: big-c   Source File: TestPatternFilter.java    License: Apache License 2.0 5 votes vote down vote up
private static void shouldAcceptImpl(final boolean expectAcceptList,  
    SubsetConfiguration conf, List<MetricsTag> tags, boolean[] expectedAcceptedSpec) {
  final MetricsFilter globFilter = newGlobFilter(conf);
  final MetricsFilter regexFilter = newRegexFilter(conf);
  
  // Test acceptance of the tag list:  
  assertEquals("accepts "+ tags, expectAcceptList, globFilter.accepts(tags));
  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);
    if (actGlob) {
      acceptedCount++;
    }
  }
  if (expectAcceptList) {
    // At least one individual tag should be accepted:
    assertTrue("No tag of the following accepted: " + tags, acceptedCount > 0);
  } else {
    // At least one individual tag should be rejected: 
    assertTrue("No tag of the following rejected: " + tags, acceptedCount < tags.size());
  }
}
 
Example 27
Source Project: hadoop   Source File: TestMetricsCache.java    License: Apache License 2.0 5 votes vote down vote up
@Test public void testOverflow() {
  MetricsCache cache = new MetricsCache();
  MetricsCache.Record cr;
  Collection<MetricsTag> t0 = Arrays.asList(makeTag("t0", "0"));
  for (int i = 0; i < MetricsCache.MAX_RECS_PER_NAME_DEFAULT + 1; ++i) {
    cr = cache.update(makeRecord("r",
        Arrays.asList(makeTag("t"+ i, ""+ i)),
        Arrays.asList(makeMetric("m", i))));
    checkMetricValue("new metric value", cr, "m", i);
    if (i < MetricsCache.MAX_RECS_PER_NAME_DEFAULT) {
      assertNotNull("t0 is still there", cache.get("r", t0));
    }
  }
  assertNull("t0 is gone", cache.get("r", t0));
}
 
Example 28
Source Project: hadoop   Source File: TestMetricsCache.java    License: Apache License 2.0 5 votes vote down vote up
private MetricsRecord makeRecord(String name, Collection<MetricsTag> tags,
                                 Collection<AbstractMetric> metrics) {
  MetricsRecord mr = mock(MetricsRecord.class);
  when(mr.name()).thenReturn(name);
  when(mr.tags()).thenReturn(tags);
  when(mr.metrics()).thenReturn(metrics);
  return mr;
}
 
Example 29
Source Project: phoenix   Source File: PhoenixMetricsSink.java    License: Apache License 2.0 5 votes vote down vote up
private void addDynamicEntry(List<String> keys, List<Object> values,
        List<String> variableValues, String family, MetricsTag tag,
        MetricInfo metric, int count) {
    // <family><.dynColumn><count> <VARCHAR>
    keys.add(getDynamicColumnName(family, metric.columnName, count) + " VARCHAR");

    // build the annotation value
    String val = tag.description() + " - " + tag.value();
    values.add(VARIABLE_VALUE);
    variableValues.add(val);
}
 
Example 30
Source Project: hadoop   Source File: MetricsRecords.java    License: Apache License 2.0 5 votes vote down vote up
public static void assertTag(MetricsRecord record, String tagName,
    String expectedValue) {
  MetricsTag processIdTag = getFirstTagByName(record,
      tagName);
  assertNotNull(processIdTag);
  assertEquals(expectedValue, processIdTag.value());
}