Package org.apache.hadoop.metrics2.util

Examples of org.apache.hadoop.metrics2.util.MetricSampleQuantiles


   * @return a metric object
   */
  public MetricMutableGaugeLong getLongGauge(String gaugeName,
      long potentialStartingValue) {
    // Try and get the guage.
    MetricMutable metric = metricsMap.get(gaugeName);

    // If it's not there then try and put a new one in the storage.
    if (metric == null) {

      // Create the potential new gauge.
View Full Code Here


   * @return a metric object
   */
  public MetricMutableCounterLong getLongCounter(String counterName,
      long potentialStartingValue) {
    // See getLongGauge for description on how this works.
    MetricMutable counter = metricsMap.get(counterName);
    if (counter == null) {
      MetricMutableCounterLong newCounter = mf.newCounter(counterName, "",
          potentialStartingValue);
      counter = metricsMap.putIfAbsent(counterName, newCounter);
      if (counter == null) {
View Full Code Here

    return (MetricMutableCounterLong) counter;
  }

  public MetricMutableHistogram getHistogram(String histoName) {
    // See getLongGauge for description on how this works.
    MetricMutable histo = metricsMap.get(histoName);
    if (histo == null) {
      MetricMutableHistogram newHisto = new MetricMutableHistogram(histoName,
          "");
      histo = metricsMap.putIfAbsent(histoName, newHisto);
      if (histo == null) {
View Full Code Here

    return (MetricMutableHistogram) histo;
  }

  public MetricMutableQuantiles getQuantile(String histoName) {
    // See getLongGauge for description on how this works.
    MetricMutable histo = metricsMap.get(histoName);
    if (histo == null) {
      MetricMutableQuantiles newHisto = new MetricMutableQuantiles(histoName,
          "");
      histo = metricsMap.putIfAbsent(histoName, newHisto);
      if (histo == null) {
View Full Code Here

  private <T extends MetricMutable> T addNewMetricIfAbsent(String name, T ret,
      Class<T> metricClass) {
    // If the value we get back is null then the put was successful and we will
    // return that. Otherwise metric should contain the thing that was in
    // before the put could be completed.
    MetricMutable metric = metricsMap.putIfAbsent(name, ret);
    if (metric == null) {
      return ret;
    }

    return returnExistingWithCast(metric, metricClass, name);
View Full Code Here

   * @param initValue of the metric
   * @return a new counter object
   */
  public MetricMutableCounterInt newCounter(String name, String description,
      int initValue) {
    MetricMutableCounterInt ret = mf.newCounter(name, description, initValue);
    return addNewMetricIfAbsent(name, ret, MetricMutableCounterInt.class);
  }
View Full Code Here

   *
   * @param key the name of the counter
   * @param delta the ammount to increment
   */
  public void incCounters(String key, long delta) {
    MetricMutableCounterLong counter = metricsRegistry.getLongCounter(key, 0l);
    counter.incr(delta);

  }
View Full Code Here

   * @param initValue of the metric
   * @return a new counter object
   */
  public MetricMutableCounterLong newCounter(String name, String description,
      long initValue) {
    MetricMutableCounterLong ret = mf.newCounter(name, description, initValue);
    return addNewMetricIfAbsent(name, ret, MetricMutableCounterLong.class);
  }
View Full Code Here

  public MetricMutableCounterLong getLongCounter(String counterName,
      long potentialStartingValue) {
    // See getLongGauge for description on how this works.
    MetricMutable counter = metricsMap.get(counterName);
    if (counter == null) {
      MetricMutableCounterLong newCounter = mf.newCounter(counterName, "",
          potentialStartingValue);
      counter = metricsMap.putIfAbsent(counterName, newCounter);
      if (counter == null) {
        return newCounter;
      }
View Full Code Here

  @Test
  public void testIncCounters() throws Exception {
    String key = "testinccounter";
    bmsi.incCounters(key, 100);
    MetricMutableCounterLong c = (MetricMutableCounterLong) bmsi.metricsRegistry
        .get(key);
    assertEquals(key, c.name);
    bmsi.incCounters(key, 100);
    assertSame(c, bmsi.metricsRegistry.get(key));
  }
View Full Code Here

TOP

Related Classes of org.apache.hadoop.metrics2.util.MetricSampleQuantiles

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.