本文整理汇总了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());
}
}
}
示例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();
}
示例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;
}
示例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()]);
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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;
}
示例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() );
}