org.apache.hadoop.metrics.spi.AbstractMetricsContext.TagMap Java Examples

The following examples show how to use org.apache.hadoop.metrics.spi.AbstractMetricsContext.TagMap. 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 File: MetricsServlet.java    From RDFS with Apache License 2.0 6 votes vote down vote up
/**
 * Collects all metric data, and returns a map:
 *   contextName -> recordName -> [ (tag->tagValue), (metric->metricValue) ].
 * The values are either String or Number.  The final value is implemented
 * as a list of TagsMetricsPair.
 */
 Map<String, Map<String, List<TagsMetricsPair>>> makeMap(
     Collection<MetricsContext> contexts) throws IOException {
  Map<String, Map<String, List<TagsMetricsPair>>> map = 
    new TreeMap<String, Map<String, List<TagsMetricsPair>>>();

  for (MetricsContext context : contexts) {
    Map<String, List<TagsMetricsPair>> records = 
      new TreeMap<String, List<TagsMetricsPair>>();
    map.put(context.getContextName(), records);
  
    for (Map.Entry<String, Collection<OutputRecord>> r : 
        context.getAllRecords().entrySet()) {
      List<TagsMetricsPair> metricsAndTags = 
        new ArrayList<TagsMetricsPair>();
      records.put(r.getKey(), metricsAndTags);
      for (OutputRecord outputRecord : r.getValue()) {
        TagMap tagMap = outputRecord.getTagsCopy();
        MetricMap metricMap = outputRecord.getMetricsCopy();
        metricsAndTags.add(new TagsMetricsPair(tagMap, metricMap));
      }
    }
  }
  return map;
}
 
Example #2
Source File: MetricsServlet.java    From hadoop with Apache License 2.0 6 votes vote down vote up
/**
 * Collects all metric data, and returns a map:
 *   contextName -> recordName -> [ (tag->tagValue), (metric->metricValue) ].
 * The values are either String or Number.  The final value is implemented
 * as a list of TagsMetricsPair.
 */
 Map<String, Map<String, List<TagsMetricsPair>>> makeMap(
     Collection<MetricsContext> contexts) throws IOException {
  Map<String, Map<String, List<TagsMetricsPair>>> map = 
    new TreeMap<String, Map<String, List<TagsMetricsPair>>>();

  for (MetricsContext context : contexts) {
    Map<String, List<TagsMetricsPair>> records = 
      new TreeMap<String, List<TagsMetricsPair>>();
    map.put(context.getContextName(), records);
  
    for (Map.Entry<String, Collection<OutputRecord>> r : 
        context.getAllRecords().entrySet()) {
      List<TagsMetricsPair> metricsAndTags = 
        new ArrayList<TagsMetricsPair>();
      records.put(r.getKey(), metricsAndTags);
      for (OutputRecord outputRecord : r.getValue()) {
        TagMap tagMap = outputRecord.getTagsCopy();
        MetricMap metricMap = outputRecord.getMetricsCopy();
        metricsAndTags.add(new TagsMetricsPair(tagMap, metricMap));
      }
    }
  }
  return map;
}
 
Example #3
Source File: MetricsServlet.java    From big-c with Apache License 2.0 6 votes vote down vote up
/**
 * Collects all metric data, and returns a map:
 *   contextName -> recordName -> [ (tag->tagValue), (metric->metricValue) ].
 * The values are either String or Number.  The final value is implemented
 * as a list of TagsMetricsPair.
 */
 Map<String, Map<String, List<TagsMetricsPair>>> makeMap(
     Collection<MetricsContext> contexts) throws IOException {
  Map<String, Map<String, List<TagsMetricsPair>>> map = 
    new TreeMap<String, Map<String, List<TagsMetricsPair>>>();

  for (MetricsContext context : contexts) {
    Map<String, List<TagsMetricsPair>> records = 
      new TreeMap<String, List<TagsMetricsPair>>();
    map.put(context.getContextName(), records);
  
    for (Map.Entry<String, Collection<OutputRecord>> r : 
        context.getAllRecords().entrySet()) {
      List<TagsMetricsPair> metricsAndTags = 
        new ArrayList<TagsMetricsPair>();
      records.put(r.getKey(), metricsAndTags);
      for (OutputRecord outputRecord : r.getValue()) {
        TagMap tagMap = outputRecord.getTagsCopy();
        MetricMap metricMap = outputRecord.getMetricsCopy();
        metricsAndTags.add(new TagsMetricsPair(tagMap, metricMap));
      }
    }
  }
  return map;
}
 
Example #4
Source File: TestOutputRecord.java    From hadoop with Apache License 2.0 5 votes vote down vote up
public void testCopy() {
  TagMap tags = new TagMap();
  tags.put("tagkey", "tagval");
  MetricMap metrics = new MetricMap();
  metrics.put("metrickey", 123.4);
  OutputRecord r = new OutputRecord(tags, metrics);
  
  assertEquals(tags, r.getTagsCopy());    
  assertNotSame(tags, r.getTagsCopy());
  assertEquals(metrics, r.getMetricsCopy());
  assertNotSame(metrics, r.getMetricsCopy());
}
 
Example #5
Source File: TestOutputRecord.java    From big-c with Apache License 2.0 5 votes vote down vote up
public void testCopy() {
  TagMap tags = new TagMap();
  tags.put("tagkey", "tagval");
  MetricMap metrics = new MetricMap();
  metrics.put("metrickey", 123.4);
  OutputRecord r = new OutputRecord(tags, metrics);
  
  assertEquals(tags, r.getTagsCopy());    
  assertNotSame(tags, r.getTagsCopy());
  assertEquals(metrics, r.getMetricsCopy());
  assertNotSame(metrics, r.getMetricsCopy());
}
 
Example #6
Source File: TestOutputRecord.java    From RDFS with Apache License 2.0 5 votes vote down vote up
public void testCopy() {
  TagMap tags = new TagMap();
  tags.put("tagkey", "tagval");
  MetricMap metrics = new MetricMap();
  metrics.put("metrickey", 123.4);
  OutputRecord r = new OutputRecord(tags, metrics);
  
  assertEquals(tags, r.getTagsCopy());    
  assertNotSame(tags, r.getTagsCopy());
  assertEquals(metrics, r.getMetricsCopy());
  assertNotSame(metrics, r.getMetricsCopy());
}
 
Example #7
Source File: MetricsRecordImpl.java    From hadoop-gpu with Apache License 2.0 4 votes vote down vote up
TagMap getTagTable() {
  return tagTable;
}
 
Example #8
Source File: OutputRecord.java    From hadoop with Apache License 2.0 4 votes vote down vote up
/** Creates a new instance of OutputRecord */
OutputRecord(TagMap tagMap, MetricMap metricMap) {
  this.tagMap = tagMap;
  this.metricMap = metricMap;
}
 
Example #9
Source File: OutputRecord.java    From hadoop-gpu with Apache License 2.0 4 votes vote down vote up
/** Creates a new instance of OutputRecord */
OutputRecord(TagMap tagMap, MetricMap metricMap) {
  this.tagMap = tagMap;
  this.metricMap = metricMap;
}
 
Example #10
Source File: MetricsServlet.java    From RDFS with Apache License 2.0 4 votes vote down vote up
public TagsMetricsPair(TagMap tagMap, MetricMap metricMap) {
  this.tagMap = tagMap;
  this.metricMap = metricMap;
}
 
Example #11
Source File: MetricsRecordImpl.java    From RDFS with Apache License 2.0 4 votes vote down vote up
TagMap getTagTable() {
  return tagTable;
}
 
Example #12
Source File: OutputRecord.java    From RDFS with Apache License 2.0 4 votes vote down vote up
/**
 * Returns a copy of this record's tags.
 */
public TagMap getTagsCopy() {
  return new TagMap(tagMap);
}
 
Example #13
Source File: OutputRecord.java    From RDFS with Apache License 2.0 4 votes vote down vote up
/** Creates a new instance of OutputRecord */
OutputRecord(TagMap tagMap, MetricMap metricMap) {
  this.tagMap = tagMap;
  this.metricMap = metricMap;
}
 
Example #14
Source File: MetricsServlet.java    From big-c with Apache License 2.0 4 votes vote down vote up
public TagsMetricsPair(TagMap tagMap, MetricMap metricMap) {
  this.tagMap = tagMap;
  this.metricMap = metricMap;
}
 
Example #15
Source File: MetricsRecordImpl.java    From big-c with Apache License 2.0 4 votes vote down vote up
TagMap getTagTable() {
  return tagTable;
}
 
Example #16
Source File: OutputRecord.java    From big-c with Apache License 2.0 4 votes vote down vote up
/**
 * Returns a copy of this record's tags.
 */
public TagMap getTagsCopy() {
  return new TagMap(tagMap);
}
 
Example #17
Source File: OutputRecord.java    From big-c with Apache License 2.0 4 votes vote down vote up
/** Creates a new instance of OutputRecord */
OutputRecord(TagMap tagMap, MetricMap metricMap) {
  this.tagMap = tagMap;
  this.metricMap = metricMap;
}
 
Example #18
Source File: MetricsServlet.java    From hadoop with Apache License 2.0 4 votes vote down vote up
public TagsMetricsPair(TagMap tagMap, MetricMap metricMap) {
  this.tagMap = tagMap;
  this.metricMap = metricMap;
}
 
Example #19
Source File: MetricsRecordImpl.java    From hadoop with Apache License 2.0 4 votes vote down vote up
TagMap getTagTable() {
  return tagTable;
}
 
Example #20
Source File: OutputRecord.java    From hadoop with Apache License 2.0 4 votes vote down vote up
/**
 * Returns a copy of this record's tags.
 */
public TagMap getTagsCopy() {
  return new TagMap(tagMap);
}