本文整理汇总了Java中org.apache.hadoop.metrics.spi.AbstractMetricsContext.TagMap类的典型用法代码示例。如果您正苦于以下问题:Java TagMap类的具体用法?Java TagMap怎么用?Java TagMap使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TagMap类属于org.apache.hadoop.metrics.spi.AbstractMetricsContext包,在下文中一共展示了TagMap类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: makeMap
import org.apache.hadoop.metrics.spi.AbstractMetricsContext.TagMap; //导入依赖的package包/类
/**
* 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;
}
示例2: testCopy
import org.apache.hadoop.metrics.spi.AbstractMetricsContext.TagMap; //导入依赖的package包/类
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());
}
示例3: OutputRecord
import org.apache.hadoop.metrics.spi.AbstractMetricsContext.TagMap; //导入依赖的package包/类
/** Creates a new instance of OutputRecord */
OutputRecord(TagMap tagMap, MetricMap metricMap) {
this.tagMap = tagMap;
this.metricMap = metricMap;
}
示例4: getTagsCopy
import org.apache.hadoop.metrics.spi.AbstractMetricsContext.TagMap; //导入依赖的package包/类
/**
* Returns a copy of this record's tags.
*/
public TagMap getTagsCopy() {
return new TagMap(tagMap);
}
示例5: getTagTable
import org.apache.hadoop.metrics.spi.AbstractMetricsContext.TagMap; //导入依赖的package包/类
TagMap getTagTable() {
return tagTable;
}
示例6: TagsMetricsPair
import org.apache.hadoop.metrics.spi.AbstractMetricsContext.TagMap; //导入依赖的package包/类
public TagsMetricsPair(TagMap tagMap, MetricMap metricMap) {
this.tagMap = tagMap;
this.metricMap = metricMap;
}