protected void updateMetricsOnFinish(TEnvironment env, long runtime, boolean success) {
    ProcedureMetrics metrics = getProcedureMetrics(env);
    if (metrics == null) {
      return;
    }

    if (success) {
      Histogram timeHisto = metrics.getTimeHisto();
      if (timeHisto != null) {
        timeHisto.update(runtime);
      }
    } else {
      Counter failedCounter = metrics.getFailedCounter();
      if (failedCounter != null) {
        failedCounter.increment();
      }
    }
  }
This function will be called just after procedure execution is finished. Override this method
to update metrics at the end of the procedure. If {@link #getProcedureMetrics(Object)} returns
non-null {@link ProcedureMetrics}, the default implementation adds runtime of a procedure to a
time histogram for successfully completed procedures. Increments failed counter for failed
procedures.
<p/>
TODO: As any of the sub-procedures on failure rolls back all procedures in the stack, including
successfully finished siblings, this function may get called twice in certain cases for certain
procedures. Explore further if this can be called once.
@param env     The environment passed to the procedure executor
@param runtime Runtime of the procedure in milliseconds
@param success true if procedure is completed successfully
hbase-procedure/src/main/java/org/apache/hadoop/hbase/procedure2/Procedure.java