Package org.apache.hadoop.metrics.util

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


    }

    synchronized (registry) {
      // Iterate through the registry to propagate the different rpc metrics.
      for (String metricName : registry.getKeyList() ) {
        MetricsBase value = registry.get(metricName);
        value.pushMetric(metricsRecord);
      }
    }
    metricsRecord.update();
  }
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

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


    synchronized (registry) {
      // Iterate through the registry to propagate the different rpc metrics.
      for (String metricName : registry.getKeyList() ) {
        MetricsBase value = registry.get(metricName);
        value.pushMetric(metricsRecord);
      }
    }
    metricsRecord.update();
  }
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 {
          LOG.warn( String.format("unknown metrics type %s for attribute %s",
                        metric.getClass().getName(), name) );
        }
      }
    }

    throw new AttributeNotFoundException();
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 {
          LOG.warn( String.format("unknown metrics type %s for attribute %s",
                        metric.getClass().getName(), name) );
        }
      }
    }

    throw new AttributeNotFoundException();
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

      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 {
          LOG.warn( String.format("unknown metrics type %s for attribute %s",
                        metric.getClass().getName(), name) );
        }
      }
    }
   
    throw new AttributeNotFoundException();
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


    synchronized (registry) {
      // Iterate through the registry to propagate the different rpc metrics.
      for (String metricName : registry.getKeyList() ) {
        MetricsBase value = registry.get(metricName);
        value.pushMetric(metricsRecord);
      }
    }
    metricsRecord.update();
  }
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.