@VisibleForTesting
  int metricDefineCount(String name) {
    return Optional.ofNullable(definedMetrics.getOrDefault(name, null))
        .map(Pair::getRight)
        .orElseGet(() -> 0);
  }
Remove a metric

@param key registered metric key
amoro-ams/src/main/java/org/apache/amoro/server/metrics/MetricRegistry.java