public synchronized void addMetric(ReplicationMetric replicationMetric) throws SemanticException {
    if (metricMap.size() >= maxSize) {
      throw new SemanticException("Metrics are not getting collected. ");
    } else {
      if (metricMap.size() > 0.8 * maxSize) { //soft limit
        LOG.warn("Metrics cache is more than 80 % full. Will start dropping metrics once full. ");
      }
      metricMap.put(replicationMetric.getScheduledExecutionId(), replicationMetric);
    }
  }
MetricCollector.
In memory collection of metrics
ql/src/java/org/apache/hadoop/hive/ql/parse/repl/metric/MetricCollector.java