当前位置: 首页>>代码示例>>Java>>正文


Java MetricsRecord.name方法代码示例

本文整理汇总了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;
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:31,代码来源:MetricsCache.java

示例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;
}
 
开发者ID:Seagate,项目名称:hadoop-on-lustre,代码行数:31,代码来源:MetricsCache.java

示例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;
}
 
开发者ID:sschwartzman,项目名称:newrelic-hadoop-plugin,代码行数:11,代码来源:NewRelicSink.java


注:本文中的org.apache.hadoop.metrics2.MetricsRecord.name方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。