code: public void removeAll() {
          for(Iterator<Map.Entry<MetricName, Metric>> it = metrics.entrySet().iterator(); it.hasNext();) {
              Map.Entry<MetricName, Metric> entry = it.next();
              Metric metric = entry.getValue();
              if(metric != null) {
                  onMetricRemoved(entry.getKey(), metric);
              }
              it.remove();
          }
      }
docs: Removes all the metrics in registry.