code: public void putWorkerMetrics(String hostname, List<Metric> metrics) {
      if (metrics.isEmpty()) {
        return;
      }
      synchronized (mWorkerMetrics) {
        mWorkerMetrics.removeByField(ID_INDEX, getFullInstanceId(hostname, null));
        for (Metric metric : metrics) {
          if (metric.getHostname() == null) {
            continue; // ignore metrics whose hostname is null
          }
          mWorkerMetrics.add(metric);
        }
      }
    }
docs: Put the metrics from a worker with a hostname. If all the old metrics associated with this
  instance will be removed and then replaced by the latest.
  
  @param hostname the hostname of the instance
  @param metrics the new worker metrics