gobblin-cluster/src/main/java/org/apache/gobblin/cluster/GobblinHelixJobSchedulerMetrics.java [52:94]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    this.timeBeforeJobScheduling = metricContext.contextAwareTimer(TIMER_BEFORE_JOB_SCHEDULING,
        windowSizeInMin, TimeUnit.MINUTES);
    this.timeBeforeJobLaunching = metricContext.contextAwareTimer(TIMER_BEFORE_JOB_LAUNCHING,
        windowSizeInMin, TimeUnit.MINUTES);
    this.timeBetwenJobSchedulingAndLaunching = metricContext.contextAwareTimer(TIMER_BETWEEN_JOB_SCHEDULING_AND_LAUNCHING,
        windowSizeInMin, TimeUnit.MINUTES);
    this.numCancellationStart = new AtomicLong(0);
    this.numCancellationComplete = new AtomicLong(0);

    this.contextAwareMetrics.add(metricContext.newContextAwareGauge(SCHEDULE_CANCELLATION_START, ()->this.numCancellationStart.get()));
    this.contextAwareMetrics.add(metricContext.newContextAwareGauge(SCHEDULE_CANCELLATION_END, ()->this.numCancellationComplete.get()));
    this.contextAwareMetrics.add(timeBeforeJobScheduling);
    this.contextAwareMetrics.add(timeBeforeJobLaunching);
    this.contextAwareMetrics.add(timeBetwenJobSchedulingAndLaunching);

    this.threadPoolExecutor = (ThreadPoolExecutor) jobExecutor;

    // executor metrics
    this.contextAwareMetrics.add(metricContext.newContextAwareGauge(JobExecutionLauncher.StandardMetrics.EXECUTOR_ACTIVE_COUNT, ()->this.threadPoolExecutor.getActiveCount()));
    this.contextAwareMetrics.add(metricContext.newContextAwareGauge(JobExecutionLauncher.StandardMetrics.EXECUTOR_MAX_POOL_SIZE, ()->this.threadPoolExecutor.getMaximumPoolSize()));
    this.contextAwareMetrics.add(metricContext.newContextAwareGauge(JobExecutionLauncher.StandardMetrics.EXECUTOR_POOL_SIZE, ()->this.threadPoolExecutor.getPoolSize()));
    this.contextAwareMetrics.add(metricContext.newContextAwareGauge(JobExecutionLauncher.StandardMetrics.EXECUTOR_CORE_POOL_SIZE, ()->this.threadPoolExecutor.getCorePoolSize()));
    this.contextAwareMetrics.add(metricContext.newContextAwareGauge(JobExecutionLauncher.StandardMetrics.EXECUTOR_QUEUE_SIZE, ()->this.threadPoolExecutor.getQueue().size()));
  }

  void updateTimeBeforeJobScheduling (Properties jobProps) {
    long jobCreationTime = Long.parseLong(jobProps.getProperty(ConfigurationKeys.FLOW_EXECUTION_ID_KEY, "0"));
    Instrumented.updateTimer(Optional.of(timeBeforeJobScheduling),
        System.currentTimeMillis() - jobCreationTime,
        TimeUnit.MILLISECONDS);
  }

  void updateTimeBeforeJobLaunching (Properties jobProps) {
    long jobCreationTime = Long.parseLong(jobProps.getProperty(ConfigurationKeys.FLOW_EXECUTION_ID_KEY, "0"));
    Instrumented.updateTimer(Optional.of(timeBeforeJobLaunching),
        System.currentTimeMillis() - jobCreationTime,
        TimeUnit.MILLISECONDS);
  }

  void updateTimeBetweenJobSchedulingAndJobLaunching (long scheduledTime, long launchingTime) {
    Instrumented.updateTimer(Optional.of(timeBetwenJobSchedulingAndLaunching),
        launchingTime - scheduledTime,
        TimeUnit.MILLISECONDS);
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



gobblin-temporal/src/main/java/org/apache/gobblin/temporal/joblauncher/GobblinTemporalJobSchedulerMetrics.java [51:93]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    this.timeBeforeJobScheduling = metricContext.contextAwareTimer(TIMER_BEFORE_JOB_SCHEDULING,
        windowSizeInMin, TimeUnit.MINUTES);
    this.timeBeforeJobLaunching = metricContext.contextAwareTimer(TIMER_BEFORE_JOB_LAUNCHING,
        windowSizeInMin, TimeUnit.MINUTES);
    this.timeBetwenJobSchedulingAndLaunching = metricContext.contextAwareTimer(TIMER_BETWEEN_JOB_SCHEDULING_AND_LAUNCHING,
        windowSizeInMin, TimeUnit.MINUTES);
    this.numCancellationStart = new AtomicLong(0);
    this.numCancellationComplete = new AtomicLong(0);

    this.contextAwareMetrics.add(metricContext.newContextAwareGauge(SCHEDULE_CANCELLATION_START, ()->this.numCancellationStart.get()));
    this.contextAwareMetrics.add(metricContext.newContextAwareGauge(SCHEDULE_CANCELLATION_END, ()->this.numCancellationComplete.get()));
    this.contextAwareMetrics.add(timeBeforeJobScheduling);
    this.contextAwareMetrics.add(timeBeforeJobLaunching);
    this.contextAwareMetrics.add(timeBetwenJobSchedulingAndLaunching);

    this.threadPoolExecutor = (ThreadPoolExecutor) jobExecutor;

    // executor metrics
    this.contextAwareMetrics.add(metricContext.newContextAwareGauge(JobExecutionLauncher.StandardMetrics.EXECUTOR_ACTIVE_COUNT, ()->this.threadPoolExecutor.getActiveCount()));
    this.contextAwareMetrics.add(metricContext.newContextAwareGauge(JobExecutionLauncher.StandardMetrics.EXECUTOR_MAX_POOL_SIZE, ()->this.threadPoolExecutor.getMaximumPoolSize()));
    this.contextAwareMetrics.add(metricContext.newContextAwareGauge(JobExecutionLauncher.StandardMetrics.EXECUTOR_POOL_SIZE, ()->this.threadPoolExecutor.getPoolSize()));
    this.contextAwareMetrics.add(metricContext.newContextAwareGauge(JobExecutionLauncher.StandardMetrics.EXECUTOR_CORE_POOL_SIZE, ()->this.threadPoolExecutor.getCorePoolSize()));
    this.contextAwareMetrics.add(metricContext.newContextAwareGauge(JobExecutionLauncher.StandardMetrics.EXECUTOR_QUEUE_SIZE, ()->this.threadPoolExecutor.getQueue().size()));
  }

  void updateTimeBeforeJobScheduling (Properties jobProps) {
    long jobCreationTime = Long.parseLong(jobProps.getProperty(ConfigurationKeys.FLOW_EXECUTION_ID_KEY, "0"));
    Instrumented.updateTimer(Optional.of(timeBeforeJobScheduling),
        System.currentTimeMillis() - jobCreationTime,
        TimeUnit.MILLISECONDS);
  }

  void updateTimeBeforeJobLaunching (Properties jobProps) {
    long jobCreationTime = Long.parseLong(jobProps.getProperty(ConfigurationKeys.FLOW_EXECUTION_ID_KEY, "0"));
    Instrumented.updateTimer(Optional.of(timeBeforeJobLaunching),
        System.currentTimeMillis() - jobCreationTime,
        TimeUnit.MILLISECONDS);
  }

  void updateTimeBetweenJobSchedulingAndJobLaunching (long scheduledTime, long launchingTime) {
    Instrumented.updateTimer(Optional.of(timeBetwenJobSchedulingAndLaunching),
        launchingTime - scheduledTime,
        TimeUnit.MILLISECONDS);
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



