@Override
  public void run() {

    try {
      RawStore ms = HMSHandler.getMSForConf(conf);
      int maxRetainSecs=(int) MetastoreConf.getTimeVar(conf, MetastoreConf.ConfVars.RUNTIME_STATS_MAX_AGE, TimeUnit.SECONDS);
      int deleteCnt = ms.deleteRuntimeStats(maxRetainSecs);

      if (deleteCnt > 0L){
        LOG.info("Number of deleted entries: " + deleteCnt);
      }
    } catch (Exception e) {
      LOG.error("Exception while trying to delete: " + e.getMessage(), e);
    }
  }
Metastore task to handle RuntimeStat related expiration.
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/RuntimeStatsCleanerTask.java