public void add(String name, long value) {
    MutableMetric m = metricsMap.get(name);

    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);
    }
  }
Add sample to a stat metric by name.
@param name  of the metric
@param value of the snapshot to add
hbase-hadoop-compat/src/main/java/org/apache/hadoop/metrics2/lib/DynamicMetricsRegistry.java