public static void updateMetricsFromCleaner(String dbName, String tableName, String partitionName,
      List<Path> deletedFiles, Configuration conf, TxnStore txnHandler) {
    if (!metricsEnabled) {
      LOG.debug("Acid metric collection is not enabled. To turn it on, \"metastore.acidmetrics.thread.on\" and "
          + "\"metastore.metrics.enabled\" must be set to true and HMS restarted.");
      return;
    }
    LOG.debug("Updating delta file metrics from cleaner");
    int obsoleteDeltasThreshold = MetastoreConf.getIntVar(conf,
        MetastoreConf.ConfVars.METASTORE_DELTAMETRICS_DELTA_NUM_THRESHOLD);
    try {
      CompactionMetricsData prevObsoleteDelta =
          txnHandler.getCompactionMetricsData(dbName, tableName, partitionName,
              CompactionMetricsData.MetricType.NUM_OBSOLETE_DELTAS);
      int numObsoleteDeltas = 0;
      if (prevObsoleteDelta != null) {
        numObsoleteDeltas = prevObsoleteDelta.getMetricValue() - filterOutBaseAndOriginalFiles(deletedFiles).size();
        updateDeltaMetrics(dbName, tableName, partitionName, CompactionMetricsData.MetricType.NUM_OBSOLETE_DELTAS,
            numObsoleteDeltas, obsoleteDeltasThreshold, txnHandler);
      }

      LOG.debug("Finished updating delta file metrics from cleaner.\n obsoleteDeltasThreshold = {}, "
          + "numObsoleteDeltas = {}", obsoleteDeltasThreshold, numObsoleteDeltas);

    } catch (Throwable t) {
      LOG.warn("Unknown throwable caught while updating delta metrics. Metrics will not be updated.", t);
    }
  }
Collect and publish ACID and compaction related metrics.
Everything should be behind 2 feature flags: {@link MetastoreConf.ConfVars#METRICS_ENABLED} and
{@link MetastoreConf.ConfVars#METASTORE_ACIDMETRICS_THREAD_ON}.
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/metrics/AcidMetricService.java