public void reportStageEnd(String stageName, Status status) throws SemanticException {
    unRegisterMBeanSafe();
    if (isEnabled) {
      LOG.debug("Stage Ended {}, {}", stageName, status );
      Progress progress = replicationMetric.getProgress();
      Stage stage = progress.getStageByName(stageName);
      if(stage == null){
        stage = new Stage(stageName, status, -1L);
      }
      stage.setStatus(status);
      stage.setEndTime(getCurrentTimeInMillis());
      progress.addStage(stage);
      replicationMetric.setProgress(progress);
      Metadata metadata = replicationMetric.getMetadata();
      metadata.setReplicatedDBSizeInKB(sizeOfDataReplicatedInKB.get());
      metricCollector.addMetric(replicationMetric);
      if (Status.FAILED == status || Status.FAILED_ADMIN == status) {
        reportEnd(status);
      }
    }
  }
Abstract class for Replication Metric Collection.
ql/src/java/org/apache/hadoop/hive/ql/parse/repl/metric/ReplicationMetricCollector.java