use of pipelite.metrics.PipelineMetrics in project pipelite by enasequence.
the class MetricsTestAsserter method assertCompletedMetrics.
public static void assertCompletedMetrics(TestType testType, PipeliteMetrics metrics, String pipelineName, int processCnt) {
PipelineMetrics pipelineMetrics = metrics.pipeline(pipelineName);
// Assuming single stage in process.
assertThat(pipelineMetrics.process().getCompletedCount()).isEqualTo(processCnt * testType.expectedProcessCompletedCnt());
assertThat(pipelineMetrics.process().getFailedCount()).isEqualTo(processCnt * testType.expectedProcessFailedCnt());
assertThat(pipelineMetrics.stage().getFailedCount()).isEqualTo(processCnt * testType.expectedStageFailedCnt());
assertThat(pipelineMetrics.stage().getSuccessCount()).isEqualTo(processCnt * testType.expectedStageSuccessCnt());
assertThat(TimeSeriesMetrics.getCount(pipelineMetrics.process().getCompletedTimeSeries())).isEqualTo(processCnt * testType.expectedProcessCompletedCnt());
assertThat(TimeSeriesMetrics.getCount(pipelineMetrics.process().getFailedTimeSeries())).isEqualTo(processCnt * testType.expectedProcessFailedCnt());
assertThat(TimeSeriesMetrics.getCount(pipelineMetrics.stage().getFailedTimeSeries())).isEqualTo(processCnt * testType.expectedStageFailedCnt());
assertThat(TimeSeriesMetrics.getCount(pipelineMetrics.stage().getSuccessTimeSeries())).isEqualTo(processCnt * testType.expectedStageSuccessCnt());
}
use of pipelite.metrics.PipelineMetrics in project pipelite by enasequence.
the class PipelineController method getRunningProcessesHistoryPlot.
private String getRunningProcessesHistoryPlot(Duration duration, String type, String id) {
Collection<Table> tables = new ArrayList<>();
ZonedDateTime since = ZonedDateTime.now().minus(duration);
runnerService.getPipelineRunners().forEach(p -> {
PipelineMetrics metrics = pipeliteMetrics.pipeline(p.getPipelineName());
addRunningProcessesHistoryTable(metrics, tables, since, type);
});
Figure figure = TimeSeriesMetrics.getPlot("", tables);
return TimeSeriesMetrics.getPlotJavaScript(figure, id);
}
use of pipelite.metrics.PipelineMetrics in project pipelite by enasequence.
the class ProcessRunnerPoolTest method testSuccess.
@Test
public void testSuccess() {
AtomicLong lockProcessCnt = new AtomicLong();
AtomicLong unlockProcessCnt = new AtomicLong();
ProcessRunnerPool pool = createProcessRunnerPool(lockProcessCnt, unlockProcessCnt);
AtomicInteger runProcessCnt = new AtomicInteger();
for (int i = 0; i < PROCESS_CNT; i++) {
Process process = createProcess((request) -> StageExecutorResult.success());
pool.runProcess(PIPELINE_NAME, process, (p) -> runProcessCnt.incrementAndGet());
}
while (!pool.isIdle()) {
Time.wait(Duration.ofSeconds(1));
pool.runOneIteration();
}
PipelineMetrics pipelineMetrics = metrics.pipeline(PIPELINE_NAME);
assertThat(runProcessCnt.get()).isEqualTo(PROCESS_CNT);
assertThat(pipelineMetrics.process().getCompletedCount()).isEqualTo(PROCESS_CNT);
assertThat(pipelineMetrics.process().getFailedCount()).isZero();
assertThat(pipelineMetrics.process().getInternalErrorCount()).isZero();
assertThat(metrics.getProcessRunnerPoolOneIterationTimer().mean(TimeUnit.SECONDS)).isLessThan(5);
assertThat(metrics.getProcessRunnerOneIterationTimer().mean(TimeUnit.SECONDS)).isLessThan(5);
assertThat(TimeSeriesMetrics.getCount(pipelineMetrics.process().getCompletedTimeSeries())).isEqualTo(PROCESS_CNT);
assertThat(TimeSeriesMetrics.getCount(pipelineMetrics.process().getCompletedTimeSeries(), ZonedDateTime.now().minusHours(1))).isEqualTo(PROCESS_CNT);
assertThat(TimeSeriesMetrics.getCount(pipelineMetrics.process().getCompletedTimeSeries(), ZonedDateTime.now().plusHours(1))).isZero();
assertThat(TimeSeriesMetrics.getCount(pipelineMetrics.process().getFailedTimeSeries())).isZero();
assertThat(TimeSeriesMetrics.getCount(pipelineMetrics.process().getInternalErrorTimeSeries())).isZero();
assertThat(lockProcessCnt.get()).isEqualTo(PROCESS_CNT);
assertThat(unlockProcessCnt.get()).isEqualTo(PROCESS_CNT);
assertThat(pool.getActiveProcessCount()).isZero();
assertThat(pool.getActiveProcessRunners().size()).isZero();
}
use of pipelite.metrics.PipelineMetrics in project pipelite by enasequence.
the class PipelineRunnerAsyncTest method assertSubmitException.
private void assertSubmitException() {
TestPipeline f = submitException;
PipelineRunner pipelineRunner = pipeliteServices.runner().getPipelineRunner(f.pipelineName()).get();
assertThat(pipelineRunner.getActiveProcessRunners().size()).isEqualTo(0);
PipelineMetrics pipelineMetrics = metrics.pipeline(f.pipelineName());
assertThat(pipelineMetrics.process().getInternalErrorCount()).isEqualTo(PROCESS_CNT);
assertThat(pipelineMetrics.process().getCompletedCount()).isZero();
assertThat(pipelineMetrics.process().getFailedCount()).isEqualTo(PROCESS_CNT);
assertThat(pipelineMetrics.stage().getFailedCount()).isEqualTo(PROCESS_CNT);
assertThat(pipelineMetrics.stage().getSuccessCount()).isEqualTo(0);
assertThat(f.stageExecutor.firstExecuteCalledCount.get()).isEqualTo(PROCESS_CNT);
assertThat(f.stageExecutor.subsequentExecuteCalledCount.get()).isEqualTo(0);
}
use of pipelite.metrics.PipelineMetrics in project pipelite by enasequence.
the class PipelineRunnerAsyncTest method assertSubmitSuccessPollSuccess.
private void assertSubmitSuccessPollSuccess() {
TestPipeline f = submitSuccessPollSuccess;
PipelineRunner pipelineRunner = pipeliteServices.runner().getPipelineRunner(f.pipelineName()).get();
assertThat(pipelineRunner.getActiveProcessRunners().size()).isEqualTo(0);
PipelineMetrics pipelineMetrics = metrics.pipeline(f.pipelineName());
assertThat(pipelineMetrics.process().getInternalErrorCount()).isEqualTo(0);
assertThat(pipelineMetrics.process().getCompletedCount()).isEqualTo(PROCESS_CNT);
assertThat(pipelineMetrics.process().getFailedCount()).isZero();
assertThat(pipelineMetrics.stage().getFailedCount()).isEqualTo(0);
assertThat(pipelineMetrics.stage().getSuccessCount()).isEqualTo(PROCESS_CNT);
assertThat(f.stageExecutor.firstExecuteCalledCount.get()).isEqualTo(PROCESS_CNT);
assertThat(f.stageExecutor.subsequentExecuteCalledCount.get()).isEqualTo(PROCESS_CNT);
}
Aggregations