private static void waitForTasksToFinish(List<Future<?>> collectTasks, ExecutorService collectorExecutor) {
    try {
      CompletableFuture.allOf(collectTasks.toArray(new CompletableFuture[0])).get();
    } catch (InterruptedException e) {
      LOG.info("Interrupted while collecting session metrics", e);
      Thread.currentThread().interrupt();
    } catch (ExecutionException e) { // ExecutionException wraps the original exception
      LOG.error("Exception while collecting session metrics", e.getCause());
      throw new RuntimeException(e.getCause());
    } finally {
      collectorExecutor.shutdown();
    }
  }
TezSessionPoolManagerMetrics collects, aggregates and exposes data from Tez sessions to Hive's own MetricsFactory.
This is independent of the Tez DagClient which is active only while running DAGs.
ql/src/java/org/apache/hadoop/hive/ql/exec/tez/TezSessionPoolManagerMetrics.java