MetricsRegistry { public synchronized MutableQuantiles newQuantiles(String name, String desc, String sampleName, String valueName, int interval) { checkMetricName(name); if (interval <= 0) { throw new MetricsException("Interval should be positive. Value passed" + " is: " + interval); } MutableQuantiles ret = new MutableQuantiles(name, desc, sampleName, valueName, interval); metricsMap.put(name, ret); return ret; } MetricsRegistry(String name);  MetricsRegistry(MetricsInfo info); MetricsInfo info(); synchronized MutableMetric get(String name); synchronized MetricsTag getTag(String name); MutableCounterInt newCounter(String name, String desc, int iVal); synchronized MutableCounterInt newCounter(MetricsInfo info, int iVal); MutableCounterLong newCounter(String name, String desc, long iVal); synchronized MutableCounterLong newCounter(MetricsInfo info, long iVal); MutableGaugeInt newGauge(String name, String desc, int iVal); synchronized MutableGaugeInt newGauge(MetricsInfo info, int iVal); MutableGaugeLong newGauge(String name, String desc, long iVal); synchronized MutableGaugeLong newGauge(MetricsInfo info, long iVal); MutableGaugeFloat newGauge(String name, String desc, float iVal); synchronized MutableGaugeFloat newGauge(MetricsInfo info, float iVal); synchronized MutableQuantiles newQuantiles(String name, String desc,
      String sampleName, String valueName, int interval); synchronized MutableStat newStat(String name, String desc,
      String sampleName, String valueName, boolean extended); MutableStat newStat(String name, String desc,
                             String sampleName, String valueName); MutableRate newRate(String name); MutableRate newRate(String name, String description); MutableRate newRate(String name, String desc, boolean extended); @InterfaceAudience.Private synchronized MutableRate newRate(String name, String desc,
      boolean extended, boolean returnExisting); synchronized MutableRatesWithAggregation newRatesWithAggregation(
      String name); synchronized MutableRollingAverages newMutableRollingAverages(
      String name, String valueName); synchronized void add(String name, long value); MetricsRegistry setContext(String name); MetricsRegistry tag(String name, String description, String value); MetricsRegistry tag(String name, String description, String value,
                             boolean override); synchronized MetricsRegistry tag(MetricsInfo info, String value, boolean override); MetricsRegistry tag(MetricsInfo info, String value); synchronized void snapshot(MetricsRecordBuilder builder, boolean all); @Override String toString();  }
@Test public void testAddIllegalParameters() { final MetricsRegistry r = new MetricsRegistry("IllegalParamTest"); expectMetricsException("Interval should be positive. Value passed is: -20", new Runnable() { @Override public void run() { r.newQuantiles("q1", "New Quantile 1", "qq1", "qv1", (int)-20); } }); }