@VisibleForTesting
  void collectMetrics() {
    for (Map.Entry<String, LlapManagementProtocolClientImpl> entry : llapClients.entrySet()) {
      String identity = entry.getKey();
      LlapManagementProtocolClientImpl client = entry.getValue();
      try {
        LlapDaemonProtocolProtos.GetDaemonMetricsResponseProto metrics =
                client.getDaemonMetrics(null,
                        LlapDaemonProtocolProtos.GetDaemonMetricsRequestProto.newBuilder().build());
        LlapMetrics newMetrics = new LlapMetrics(metrics);
        instanceStatisticsMap.put(identity, newMetrics);
        if (listener != null) {
          try {
            listener.newDaemonMetrics(identity, newMetrics);
          } catch (Throwable t) {
            LOG.warn("LlapMetricsListener thrown an unexpected exception", t);
          }
        }
      } catch (ServiceException ex) {
        LOG.error(ex.getMessage(), ex);
        instanceStatisticsMap.remove(identity);
      }
    }
    if (listener != null) {
      try {
        listener.newClusterMetrics(getMetrics());
      } catch (Throwable t) {
        LOG.warn("LlapMetricsListener thrown an unexpected exception", t);
      }
    }
  }
Collect metrics from the llap daemons in every given milliseconds.
llap-tez/src/java/org/apache/hadoop/hive/llap/tezplugins/metrics/LlapMetricsCollector.java