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

The following examples show how to use org.apache.hadoop.metrics.spi.AbstractMetricsContext.TagMap. 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: hadoop   Source File: MetricsServlet.java    License: 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 Project: big-c   Source File: MetricsServlet.java    License: 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 Project: RDFS   Source File: MetricsServlet.java    License: 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 Project: hadoop   Source File: TestOutputRecord.java    License: 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 Project: big-c   Source File: TestOutputRecord.java    License: 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 Project: RDFS   Source File: TestOutputRecord.java    License: 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 Project: hadoop   Source File: OutputRecord.java    License: 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 8
Source Project: hadoop   Source File: OutputRecord.java    License: 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 9
Source Project: hadoop   Source File: MetricsRecordImpl.java    License: Apache License 2.0 4 votes vote down vote up
TagMap getTagTable() {
  return tagTable;
}
 
Example 10
Source Project: hadoop   Source File: MetricsServlet.java    License: 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 Project: big-c   Source File: OutputRecord.java    License: 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 12
Source Project: big-c   Source File: OutputRecord.java    License: 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 Project: big-c   Source File: MetricsRecordImpl.java    License: Apache License 2.0 4 votes vote down vote up
TagMap getTagTable() {
  return tagTable;
}
 
Example 14
Source Project: big-c   Source File: MetricsServlet.java    License: 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 Project: RDFS   Source File: OutputRecord.java    License: 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 16
Source Project: RDFS   Source File: OutputRecord.java    License: 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 Project: RDFS   Source File: MetricsRecordImpl.java    License: Apache License 2.0 4 votes vote down vote up
TagMap getTagTable() {
  return tagTable;
}
 
Example 18
Source Project: RDFS   Source File: MetricsServlet.java    License: 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 Project: hadoop-gpu   Source File: OutputRecord.java    License: 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 20
Source Project: hadoop-gpu   Source File: MetricsRecordImpl.java    License: Apache License 2.0 4 votes vote down vote up
TagMap getTagTable() {
  return tagTable;
}