public void cleanupPerfLogMetrics() {
    Metrics metrics = MetricsFactory.getInstance();
    synchronized(openScopes) {
      if (metrics != null) {
        for (MetricsScope openScope : openScopes.values()) {
          metrics.endScope(openScope);
        }
      }
      openScopes.clear();
    }
  }
Cleans up any dangling perfLog metric call scopes.
common/src/java/org/apache/hadoop/hive/ql/log/PerfLogger.java