ExecMetrics { public Timer.Context getFlowSetupTimerContext() { return this.flowSetupTimer.time(); } @Inject  ExecMetrics(final MetricsManager metricsManager); void addFlowRunnerManagerMetrics(final FlowRunnerManager flowRunnerManager); Timer.Context getFlowSetupTimerContext(); void incrementFlowKillingCount(); void decrementFlowKillingCount(); void addFlowTimeToKill(final long time); void markFlowKilled(); void markFlowSuccess(); void markJobFail(); void markJobSuccess(); void markJobKilled(); void markOnePoll(); static final String NUM_RUNNING_FLOWS_NAME; static final String NUM_QUEUED_FLOWS_NAME; static final String PROJECT_DIR_CACHE_HIT_RATIO_NAME; static final String FLOW_SETUP_TIMER_NAME; static final String FLOW_KILLING_COUNTER_NAME; static final String FLOW_TIME_TO_KILL_HISTOGRAM_NAME; static final String FLOW_KILLED_METER_NAME; static final String FLOW_SUCCESS_METER_NAME; static final String JOB_FAIL_METER_NAME; static final String JOB_SUCCESS_METER_NAME; static final String JOB_KILLED_METER_NAME; static final String POLLING_FREQUENCY_METER_NAME; }
@Test public void testFlowSetupMetrics() throws InterruptedException { assertThat(this.testUtil.getTimerCount(ExecMetrics.FLOW_SETUP_TIMER_NAME)).isEqualTo(0); Timer.Context context = this.metrics.getFlowSetupTimerContext(); try { Thread.sleep(10); } finally { context.stop(); } assertThat(this.testUtil.getTimerCount(ExecMetrics.FLOW_SETUP_TIMER_NAME)).isEqualTo(1); Snapshot snapshot = this.testUtil.getTimerSnapshot(ExecMetrics.FLOW_SETUP_TIMER_NAME); double val = snapshot.getMax(); assertThat(snapshot.getMax()).isGreaterThanOrEqualTo(10); }