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


Java MetricsBase类代码示例

本文整理汇总了Java中org.apache.hadoop.metrics.util.MetricsBase的典型用法代码示例。如果您正苦于以下问题:Java MetricsBase类的具体用法?Java MetricsBase怎么用?Java MetricsBase使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


MetricsBase类属于org.apache.hadoop.metrics.util包,在下文中一共展示了MetricsBase类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: readFields

import org.apache.hadoop.metrics.util.MetricsBase; //导入依赖的package包/类
public void readFields(DataInput in) throws IOException {
  int version = in.readByte();
  if (version > (int)SCANMETRICS_VERSION) {
    throw new IOException("version " + version + " not supported");
  }

  int metricsCount = in.readInt();
  for (int i=0; i<metricsCount; i++) {
    String metricsName = in.readUTF();
    long v = in.readLong();
    MetricsBase mb = registry.get(metricsName);
    if ( mb instanceof MetricsTimeVaryingLong) {
      ((MetricsTimeVaryingLong) mb).inc(v);
    } else {
      LOG.warn("unsupported metrics type. metrics name: "
        + mb.getName() + ", metrics description: " + mb.getDescription());
    }
  }
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:20,代码来源:ScanMetrics.java

示例2: doUpdates

import org.apache.hadoop.metrics.util.MetricsBase; //导入依赖的package包/类
@Override
public void doUpdates(MetricsContext context) {
  // Get the fair scheduler metrics
  if (scheduler != null) {
    scheduler.submitMetrics(metricsRecord);
  }

  // Get the number of pending calls.
  setNumPendingCalls(sessionNotifier.getNumPendingCalls());

  // Not synchronized on the ClusterManagerMetrics object.
  // The list of metrics in the registry is modified only in the constructor.
  // And pushMetrics() is thread-safe.
  for (MetricsBase m : registry.getMetricsList()) {
    m.pushMetric(metricsRecord);
  }

  metricsRecord.update();
}
 
开发者ID:iVCE,项目名称:RDFS,代码行数:20,代码来源:ClusterManagerMetrics.java

示例3: copyMinusHBaseMetrics

import org.apache.hadoop.metrics.util.MetricsBase; //导入依赖的package包/类
private static MetricsRegistry copyMinusHBaseMetrics(final MetricsRegistry mr) {
  MetricsRegistry copy = new MetricsRegistry();
  for (MetricsBase metric : mr.getMetricsList()) {
    if (metric instanceof MetricsRate || metric instanceof MetricsString ||
        metric instanceof MetricsHistogram || metric instanceof ExactCounterMetric) {
      continue;
    }
    copy.add(metric.getName(), metric);
  }
  return copy;
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:12,代码来源:MetricsMBeanBase.java

示例4: getMetricsTimeVaryingLongArray

import org.apache.hadoop.metrics.util.MetricsBase; //导入依赖的package包/类
public MetricsTimeVaryingLong[] getMetricsTimeVaryingLongArray() {
  Collection<MetricsBase> mbs = registry.getMetricsList();
  ArrayList<MetricsTimeVaryingLong> mlv =
    new ArrayList<MetricsTimeVaryingLong>();
  for (MetricsBase mb : mbs) {
    if ( mb instanceof MetricsTimeVaryingLong) {
      mlv.add((MetricsTimeVaryingLong) mb);
    }
  }
  return mlv.toArray(new MetricsTimeVaryingLong[mlv.size()]);
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:12,代码来源:ScanMetrics.java

示例5: doUpdates

import org.apache.hadoop.metrics.util.MetricsBase; //导入依赖的package包/类
/**
 * Push the metrics to the monitoring subsystem on doUpdate() call.
 */
public void doUpdates(final MetricsContext context) {
  // getMetricsList() and pushMetric() are thread safe methods
  for (MetricsBase m : registry.getMetricsList()) {
    m.pushMetric(metricsRecord);
  }
  metricsRecord.update();
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:11,代码来源:ThriftMetrics.java

示例6: doUpdates

import org.apache.hadoop.metrics.util.MetricsBase; //导入依赖的package包/类
@Override
public void doUpdates(MetricsContext context) {
  synchronized (this) {
    for (MetricsBase m : registry.getMetricsList()) {
      m.pushMetric(metricsRecord);
    }
  }
  metricsRecord.update();
}
 
开发者ID:rhli,项目名称:hadoop-EAR,代码行数:10,代码来源:TaskErrorCollector.java

示例7: doUpdates

import org.apache.hadoop.metrics.util.MetricsBase; //导入依赖的package包/类
public void doUpdates(MetricsContext unused) {
  synchronized (this) {
    for (MetricsBase m : registry.getMetricsList()) {
      m.pushMetric(metricsRecord);
    }
  }
  metricsRecord.update();
}
 
开发者ID:rhli,项目名称:hadoop-EAR,代码行数:9,代码来源:NamespaceNotifierMetrics.java

示例8: doUpdates

import org.apache.hadoop.metrics.util.MetricsBase; //导入依赖的package包/类
@Override
public void doUpdates(MetricsContext context) {
  // Get the fair scheduler metrics
  if (scheduler != null) {
    scheduler.submitMetrics(metricsRecord);
  }

  for (Map.Entry<ResourceType, Long> currStart :
      typeToSchedulerCurrentCycleStart.entrySet()) {
    long start = currStart.getValue();
    if (start > 0) {
      // This means that there's a scheduling cycle in progress.
      int currCycleRun = (int)(System.currentTimeMillis() - start);
      typeToSchedulerRunTime.get(currStart.getKey()).set(currCycleRun);
    }
  }

  // Get the number of pending calls.
  setNumPendingCalls(sessionNotifier.getNumPendingCalls());

  // Not synchronized on the ClusterManagerMetrics object.
  // The list of metrics in the registry is modified only in the constructor.
  // And pushMetrics() is thread-safe.
  for (MetricsBase m : registry.getMetricsList()) {
    m.pushMetric(metricsRecord);
  }

  metricsRecord.update();
}
 
开发者ID:rhli,项目名称:hadoop-EAR,代码行数:30,代码来源:ClusterManagerMetrics.java

示例9: doUpdates

import org.apache.hadoop.metrics.util.MetricsBase; //导入依赖的package包/类
/**
 * Push the metrics to the monitoring subsystem on doUpdate() call.
 */
public void doUpdates(MetricsContext context) {
  synchronized (this) {
    for (MetricsBase m : registry.getMetricsList()) {
      m.pushMetric(metricsRecord);
    }
  }
  metricsRecord.update();
}
 
开发者ID:rhli,项目名称:hadoop-EAR,代码行数:12,代码来源:RpcMetrics.java

示例10: doUpdates

import org.apache.hadoop.metrics.util.MetricsBase; //导入依赖的package包/类
/**
 * Since this object is a registered updater, this method will be called
 * periodically, e.g. every 5 seconds.
 */
public void doUpdates(MetricsContext unused) {
	synchronized (this) {
		for (MetricsBase m : registry.getMetricsList()) {
			m.pushMetric(metricsRecord);
		}
	}
	metricsRecord.setMetric("client.ls.calls", getAndResetLsCalls());
	metricsRecord.update();
}
 
开发者ID:rhli,项目名称:hadoop-EAR,代码行数:14,代码来源:DFSClientMetrics.java

示例11: doUpdates

import org.apache.hadoop.metrics.util.MetricsBase; //导入依赖的package包/类
/**
 * Since this object is a registered updater, this method will be called
 * periodically, e.g. every 5 seconds.
 */
public void doUpdates(MetricsContext unused) {
  synchronized (this) {
    for (MetricsBase m : registry.getMetricsList()) {
      m.pushMetric(metricsRecord);
    }
  }
  metricsRecord.update();
}
 
开发者ID:rhli,项目名称:hadoop-EAR,代码行数:13,代码来源:NameNodeMetrics.java

示例12: doUpdates

import org.apache.hadoop.metrics.util.MetricsBase; //导入依赖的package包/类
/**
 * Since this object is a registered updater, this method will be called
 * periodically, e.g. every 5 seconds.
 */
@Override
public void doUpdates(MetricsContext unused) {
  synchronized (this) {
    for (MetricsBase m : registry.getMetricsList()) {
      m.pushMetric(metricsRecord);
    }
  }
  metricsRecord.update();
}
 
开发者ID:rhli,项目名称:hadoop-EAR,代码行数:14,代码来源:BalancerMetrics.java

示例13: doUpdates

import org.apache.hadoop.metrics.util.MetricsBase; //导入依赖的package包/类
@Override
public void doUpdates(MetricsContext context) {
  synchronized (this) {

    for (MetricsBase m : registry.getMetricsList()) {
      m.pushMetric(metricsRecord);
    }
  }
  metricsRecord.update();
}
 
开发者ID:rhli,项目名称:hadoop-EAR,代码行数:11,代码来源:IPCLoggerChannelMetrics.java

示例14: copyMinusHBaseMetrics

import org.apache.hadoop.metrics.util.MetricsBase; //导入依赖的package包/类
private static MetricsRegistry copyMinusHBaseMetrics(final MetricsRegistry mr) {
  MetricsRegistry copy = new MetricsRegistry();
  for (MetricsBase metric : mr.getMetricsList()) {
    if (metric instanceof MetricsRate || metric instanceof MetricsString) {
      continue;
    }
    copy.add(metric.getName(), metric);
  }
  return copy;
}
 
开发者ID:lifeng5042,项目名称:RStore,代码行数:11,代码来源:MetricsMBeanBase.java

示例15: init

import org.apache.hadoop.metrics.util.MetricsBase; //导入依赖的package包/类
protected void init() {
  List<MBeanAttributeInfo> attributes = new ArrayList<MBeanAttributeInfo>();
  MBeanInfo parentInfo = super.getMBeanInfo();
  List<String> parentAttributes = new ArrayList<String>();
  for (MBeanAttributeInfo attr : parentInfo.getAttributes()) {
    attributes.add(attr);
    parentAttributes.add(attr.getName());
  }

  this.registryLength = this.registry.getMetricsList().size();

  for (MetricsBase metric : this.registry.getMetricsList()) {
    if (metric.getName() == null || parentAttributes.contains(metric.getName()))
      continue;

    // add on custom HBase metric types
    if (metric instanceof MetricsRate) {
      attributes.add( new MBeanAttributeInfo(metric.getName(),
          "java.lang.Float", metric.getDescription(), true, false, false) );
      extendedAttributes.put(metric.getName(), metric);
    } else if (metric instanceof MetricsString) {
      attributes.add( new MBeanAttributeInfo(metric.getName(),
          "java.lang.String", metric.getDescription(), true, false, false) );
      extendedAttributes.put(metric.getName(), metric);
      LOG.info("MetricsString added: " + metric.getName());
    }
    // else, its probably a hadoop metric already registered. Skip it.
  }

  LOG.info("new MBeanInfo");
  this.extendedInfo = new MBeanInfo( this.getClass().getName(),
      this.description, attributes.toArray( new MBeanAttributeInfo[0] ),
      parentInfo.getConstructors(), parentInfo.getOperations(),
      parentInfo.getNotifications() );
}
 
开发者ID:lifeng5042,项目名称:RStore,代码行数:36,代码来源:MetricsMBeanBase.java


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