Package org.apache.hadoop.metrics2

Examples of org.apache.hadoop.metrics2.MetricsException


    currentServiceName = getFirstConfigPrefix(conf);

    databaseUrl = conf.getString(DATABASE_URL_KEY);

    if (databaseUrl == null)
      throw new MetricsException(
          "databaseUrl required in the metrics2 configuration for SqlServerSink.");

    try {
      Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
    } catch (ClassNotFoundException cnfe) {
      throw new MetricsException(
          "SqlServerSink requires the Microsoft JDBC driver for SQL Server.");
    }

    hadoopConfig = new org.apache.hadoop.conf.Configuration();
    if (hadoopConfig != null) {
View Full Code Here


      boolean extended, boolean returnExisting) {
    if (returnExisting) {
      MutableMetric rate = metricsMap.get(name);
      if (rate != null) {
        if (rate instanceof MutableRate) return (MutableRate) rate;
        throw new MetricsException("Unexpected metrics type "+ rate.getClass()
                                   +" for "+ name);
      }
    }
    MutableRate ret = new MutableRate(name, desc, extended);
    return addNewMetricIfAbsent(name, ret, MutableRate.class);
View Full Code Here

    if (m != null) {
      if (m instanceof MutableStat) {
        ((MutableStat) m).add(value);
      }
      else {
        throw new MetricsException("Unsupported add(value) for metric "+ name);
      }
    }
    else {
      metricsMap.put(name, newRate(name)); // default is a rate metric
      add(name, value);
View Full Code Here

    MetricsTag tag = Interns.tag(info, value);

    if (!override) {
      MetricsTag existing = tagsMap.putIfAbsent(info.name(), tag);
      if (existing != null) {
        throw new MetricsException("Tag "+ info.name() +" already exists!");
      }
      return this;
    }

    tagsMap.put(info.name(), tag);
View Full Code Here

        return newGauge;
      }
    }

    if (!(metric instanceof MutableGaugeLong)) {
      throw new MetricsException("Metric already exists in registry for metric name: " + gaugeName +
              " and not of type MetricMutableGaugeLong");
    }

    return (MutableGaugeLong) metric;
  }
View Full Code Here

      }
    }


    if (!(counter instanceof MutableCounterLong)) {
      throw new MetricsException("Metric already exists in registry for metric name: " +
              counterName + " and not of type MetricMutableCounterLong");
    }

    return (MutableCounterLong) counter;
  }
View Full Code Here

      }
    }


    if (!(histo instanceof MutableHistogram)) {
      throw new MetricsException("Metric already exists in registry for metric name: " +
          histoName + " and not of type MutableHistogram");
    }

    return (MutableHistogram) histo;
  }
View Full Code Here

      }
    }


    if (!(histo instanceof MetricMutableQuantiles)) {
      throw new MetricsException("Metric already exists in registry for metric name: " +
          histoName + " and not of type MutableHistogram");
    }

    return (MetricMutableQuantiles) histo;
  }
View Full Code Here

  @SuppressWarnings("unchecked")
  private<T> T returnExistingWithCast(MutableMetric metric,
                                      Class<T> metricClass, String name) {
    if (!metricClass.isAssignableFrom(metric.getClass())) {
      throw new MetricsException("Metric already exists in registry for metric name: " +
              name + " and not of type " + metricClass +
              " but instead of type " + metric.getClass());
    }

    return (T) metric;
View Full Code Here

  @Override
  public synchronized void start() {
    checkNotNull(prefix, "prefix");
    if (monitoring) {
      LOG.warn(prefix +" metrics system already started!",
               new MetricsException("Illegal start"));
      return;
    }
    for (Callback cb : callbacks) cb.preStart();
    configure(prefix);
    startTimer();
View Full Code Here

TOP

Related Classes of org.apache.hadoop.metrics2.MetricsException

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.