code: public void heartbeat(final List<Metric> metrics) throws IOException {
      connect();
      try {
        MetricsHeartbeatPRequest.Builder request = MetricsHeartbeatPRequest.newBuilder();
        request.setClientId(IdUtils.createOrGetAppIdFromConfig(mContext.getConf()));
        request.setHostname(NetworkAddressUtils.getClientHostName(mContext.getConf()));
        request.setOptions(MetricsHeartbeatPOptions.newBuilder().addAllMetrics(metrics).build());
        mClient.metricsHeartbeat(request.build());
      } catch (io.grpc.StatusRuntimeException e) {
        throw new UnavailableException(e);
      }
    }
docs: The method the worker should periodically execute to heartbeat back to the master.
  
  @param metrics a list of client metrics