Package org.apache.hadoop.metrics.util

Examples of org.apache.hadoop.metrics.util.MetricsBase


    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());
      }
    }
  }
View Full Code Here


      return super.getAttribute(name);
    } catch (AttributeNotFoundException ex) {

      checkAndUpdateAttributes();

      MetricsBase metric = this.extendedAttributes.get(name);
      if (metric != null) {
        if (metric instanceof MetricsRate) {
          return ((MetricsRate) metric).getPreviousIntervalValue();
        } else if (metric instanceof MetricsString) {
          return ((MetricsString)metric).getValue();
        } else if (metric instanceof MetricsHistogram)  {
          MetricsHistogram hist = (MetricsHistogram) metric;
          if (name.endsWith(MetricsHistogram.NUM_OPS_METRIC_NAME)) {
            return hist.getCount();
          } else if (name.endsWith(MetricsHistogram.MIN_METRIC_NAME)) {
            return hist.getMin();
          } else if (name.endsWith(MetricsHistogram.MAX_METRIC_NAME)) {
            return hist.getMax();
          } else if (name.endsWith(MetricsHistogram.MEAN_METRIC_NAME)) {
            return (float) hist.getMean();
          } else if (name.endsWith(MetricsHistogram.STD_DEV_METRIC_NAME)) {
            return (float) hist.getStdDev();
          } else if (name.endsWith(MetricsHistogram.MEDIAN_METRIC_NAME)) {
            Snapshot s = hist.getSnapshot();
            return (float) s.getMedian();
          } else if (name.endsWith(MetricsHistogram.SEVENTY_FIFTH_PERCENTILE_METRIC_NAME)) {
            Snapshot s = hist.getSnapshot();
            return (float) s.get75thPercentile();
          } else if (name.endsWith(MetricsHistogram.NINETY_FIFTH_PERCENTILE_METRIC_NAME)) {
            Snapshot s = hist.getSnapshot();
            return (float) s.get95thPercentile();
          } else if (name.endsWith(MetricsHistogram.NINETY_NINETH_PERCENTILE_METRIC_NAME)) {
            Snapshot s = hist.getSnapshot();
            return (float) s.get99thPercentile();
          }

        } else {
          LOG.warn( String.format("unknown metrics type %s for attribute %s",
                        metric.getClass().getName(), name) );
        }
      }
    }

    throw new AttributeNotFoundException();
View Full Code Here

    this.ledger = ledger;
    doubleBuf = new EditsDoubleBuffer(FSEditLog.sizeFlushBuffer);
    outputStream = new BookKeeperJournalOutputStream(ledger);
    if (metrics != null) { // Metrics is non-null only when used inside name node
      String metricsName = "sync_bk_" + parentPath + "_edit";
      MetricsBase retrMetrics = metrics.registry.get(metricsName);
      if (retrMetrics != null) {
        sync = (MetricsTimeVaryingRate) retrMetrics;
      } else {
        sync = new MetricsTimeVaryingRate(metricsName, metrics.registry,
            "Journal Sync for BookKeeper" + ledger.getId());
View Full Code Here

    this.segmentTxId = txId;
    this.writeTimeoutMs = writeTimeoutMs;
    this.journalId = journalId;
    if (metrics != null) { // Metrics is non-null only when used inside name node
      String metricsName = "sync_qjm_" + journalId + "_edit";
      MetricsBase retrMetrics = metrics.registry.get(metricsName);
      if (retrMetrics != null) {
        sync = (MetricsTimeVaryingRate) retrMetrics;    
      } else {
        sync = new MetricsTimeVaryingRate(metricsName, metrics.registry,
            "Journal Sync for " + journalId);
View Full Code Here

    fc = rp.getChannel();
    fc.position(fc.size());
    if (metrics != null) { // Metrics is non-null only when used inside name node
      String parentDirName = name.getParent();
      String metricsName = "sync_" + parentDirName + "_edit";
      MetricsBase retrMetrics = metrics.registry.get(metricsName);
      if (retrMetrics != null) {
        sync = (MetricsTimeVaryingRate) retrMetrics;    
      } else {
        sync = new MetricsTimeVaryingRate(metricsName, metrics.registry,
            "Journal Sync for " + parentDirName);
View Full Code Here

TOP

Related Classes of org.apache.hadoop.metrics.util.MetricsBase

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.