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