@Override
  public void getMetrics(MetricsCollector metricsCollector, boolean all) {
    MetricsRecordBuilder metricsRecordBuilder = metricsCollector.addRecord(metricsName);

    if (stochasticCosts != null) {
      synchronized (stochasticCosts) {
        for (Map.Entry<String, Map<String, Double>> tableEntry : stochasticCosts.entrySet()) {
          for (Map.Entry<String, Double> costEntry : tableEntry.getValue().entrySet()) {
            String attrName = tableEntry.getKey() + TABLE_FUNCTION_SEP + costEntry.getKey();
            Double cost = costEntry.getValue();
            String functionDesc = costFunctionDescs.get(costEntry.getKey());

            if (functionDesc == null) {
              functionDesc = costEntry.getKey();
            }

            metricsRecordBuilder.addGauge(Interns.info(attrName, functionDesc), cost);
          }
        }
      }
    }
    metricsRegistry.snapshot(metricsRecordBuilder, all);
  }
Reports stochastic load balancer costs to JMX
hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/master/balancer/MetricsStochasticBalancerSourceImpl.java