@Override
  public void removeGauge(String name) {
    try {
      gaugesLock.lock();
      gauges.remove(name);
      // Metrics throws an Exception if we don't do this when the key already exists
      if (metricRegistry.getGauges().containsKey(name)) {
        metricRegistry.remove(name);
      }
    } finally {
      gaugesLock.unlock();
    }
  }
Closes scope, and records the time taken
standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/common/metrics/metrics2/CodahaleMetrics.java