/** Start timing the processing of a document */ public void startDocumentProcess() { finishDocumentProcess(); // Check we've finished the timing of the previous document documentTimerContext = MetricsFactory.getInstance().getTimer(pipelineName, DOCUMENT_TIMER).time(); }
/** Start timing the processing of a document */ public void startDocumentProcess() { finishDocumentProcess(); // Check we've finished the timing of the previous document documentTimerContext = MetricsFactory.getInstance().getTimer(pipelineName, DOCUMENT_TIMER).time(); }
@Test public void test() throws Exception { PipelineMetrics pm = MetricsFactory.getInstance().getPipelineMetrics(PIPELINE_NAME); assertEquals(PIPELINE_NAME, pm.getPipelineName()); pm.startDocumentProcess(); Thread.sleep(10); pm.finishDocumentProcess(); Timer t = MetricsFactory.getInstance().getTimer(PIPELINE_NAME, "documentProcessingTime"); assertEquals(1, t.getCount()); assertTrue(t.getMeanRate() > 0); assertEquals(pm, MetricsFactory.getInstance().getPipelineMetrics(PIPELINE_NAME)); } }