本文整理汇总了Java中org.apache.hadoop.metrics2.MetricsRecord.name方法的典型用法代码示例。如果您正苦于以下问题:Java MetricsRecord.name方法的具体用法?Java MetricsRecord.name怎么用?Java MetricsRecord.name使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.hadoop.metrics2.MetricsRecord
的用法示例。
在下文中一共展示了MetricsRecord.name方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: update
import org.apache.hadoop.metrics2.MetricsRecord; //导入方法依赖的package包/类
/**
* 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;
}
示例2: update
import org.apache.hadoop.metrics2.MetricsRecord; //导入方法依赖的package包/类
/**
* Update the cache and return the cached record
* @param mr the update record
* @param includingTags cache tag values (for later lookup by name) if true
* @return the updated cached record
*/
public Record update(MetricsRecord mr, boolean includingTags) {
String name = mr.name();
RecMap recMap = map.get(name);
if (recMap == null) {
recMap = new RecMap();
map.put(name, recMap);
}
Collection<MetricsTag> tags = (Collection<MetricsTag>)mr.tags();
Record rec = recMap.get(tags);
if (rec == null) {
rec = new Record();
recMap.put(tags, rec);
}
for (Metric m : mr.metrics()) {
rec.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()) {
rec.tags.put(t.name(), t.value());
}
}
return rec;
}
示例3: getMetricBaseName
import org.apache.hadoop.metrics2.MetricsRecord; //导入方法依赖的package包/类
public String getMetricBaseName(MetricsRecord record, String metricPrefix) {
String metricBaseName = "";
if(!metricPrefix.isEmpty())
metricBaseName = metricPrefix + div + record.context();
else
metricBaseName = record.context();
if (!record.context().equalsIgnoreCase(record.name()) && !record.name().isEmpty())
metricBaseName = metricBaseName + div + record.name();
return metricBaseName;
}