public static void updateMetricsFromInitiator(String dbName, String tableName,
      String partitionName, Configuration conf, TxnStore txnHandler, long baseSize,
      Map<Path, Long> activeDeltaSizes, List<Path> obsoleteDeltaPaths) {
    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 initiator");
    double deltaPctThreshold =
        MetastoreConf.getDoubleVar(conf, MetastoreConf.ConfVars.METASTORE_DELTAMETRICS_DELTA_PCT_THRESHOLD);
    int deltasThreshold =
        MetastoreConf.getIntVar(conf, MetastoreConf.ConfVars.METASTORE_DELTAMETRICS_DELTA_NUM_THRESHOLD);
    int obsoleteDeltasThreshold =
        MetastoreConf.getIntVar(conf, MetastoreConf.ConfVars.METASTORE_DELTAMETRICS_OBSOLETE_DELTA_NUM_THRESHOLD);
    try {
      // We have an AcidDir from the initiator, therefore we can use that to calculate active,small, obsolete delta
      // count

      int numDeltas = activeDeltaSizes.size();
      int numSmallDeltas = 0;

      for (long deltaSize : activeDeltaSizes.values()) {
        if (baseSize != 0 && deltaSize / (float) baseSize < deltaPctThreshold) {
          numSmallDeltas++;
        }
      }

      int numObsoleteDeltas = filterOutBaseAndOriginalFiles(obsoleteDeltaPaths).size();

      updateDeltaMetrics(dbName, tableName, partitionName, NUM_DELTAS, numDeltas, deltasThreshold, txnHandler);
      updateDeltaMetrics(dbName, tableName, partitionName, NUM_SMALL_DELTAS, numSmallDeltas, deltasThreshold,
          txnHandler);
      updateDeltaMetrics(dbName, tableName, partitionName, CompactionMetricsData.MetricType.NUM_OBSOLETE_DELTAS,
          numObsoleteDeltas, obsoleteDeltasThreshold, txnHandler);

      LOG.debug("Finished updating delta file metrics from initiator.\n deltaPctThreshold = {}, deltasThreshold = {}, "
              + "obsoleteDeltasThreshold = {}, numDeltas = {}, numSmallDeltas = {},  numObsoleteDeltas = {}",
          deltaPctThreshold, deltasThreshold, obsoleteDeltasThreshold, numDeltas, numSmallDeltas, 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