@Override
  public void afterCompile(QueryLifeTimeHookContext ctx, boolean hasError) {
    if (metrics != null && compilingQryScp != null) {
      metrics.endScope(compilingQryScp);
    }
  }
LifeTimeHook gathering metrics for the query lifecycle if the
metrics are enabled
ql/src/java/org/apache/hadoop/hive/ql/hooks/MetricsQueryLifeTimeHook.java