/** * Get the timer metric with the supplied name, within the scope of this monitor. * * @param name the name of the timer * @return the timer */ public Timer timer(String name) { return metrics.getTimer(name); }
/** * Get the timer metric with the supplied name, within the scope of this monitor. * * @param name the name of the timer * @return the timer */ public Timer timer(String name) { return metrics.getTimer(name); }
/** * Start a timer at the start of the function, and log that the function is about to begin. Logs * to TRACE level rather than DEBUG, as some functions are called so often we don't want to fill * up the logs! * * @param functionName The name of the function */ public void startFunctionTrace(String functionName) { logger.trace("Starting function {}", functionName); timers.put(functionName, metrics.getTimer(functionName).time()); }
/** * Start a timer at the start of the function, and log that the function is about to begin * * @param functionName The name of the function */ public void startFunction(String functionName) { logger.debug("Starting function {}", functionName); timers.put(functionName, metrics.getTimer(functionName).time()); }
/** * Start a timer at the start of the function, and log that the function is about to begin * * @param functionName The name of the function */ public void startFunction(String functionName) { logger.debug("Starting function {}", functionName); timers.put(functionName, metrics.getTimer(functionName).time()); }
/** * Start a timer at the start of the function, and log that the function is about to begin. Logs * to TRACE level rather than DEBUG, as some functions are called so often we don't want to fill * up the logs! * * @param functionName The name of the function */ public void startFunctionTrace(String functionName) { logger.trace("Starting function {}", functionName); timers.put(functionName, metrics.getTimer(functionName).time()); }
private Timer getTimer(HttpServletRequest req) { String path = String.format("%s:%s%s", req.getMethod(), req.getContextPath(), req.getServletPath()); return metrics.getTimer(path); }
private Timer getTimer(HttpServletRequest req) { String path = String.format("%s:%s%s", req.getMethod(), req.getContextPath(), req.getServletPath()); return metrics.getTimer(path); }
@Test public void testGetTimer() { metrics.getTimer("timer"); verify(factory).getTimer(anyString(), eq("timer")); }
@Test public void testTiming() { UimaMonitor monitor = new UimaMonitor(PIPELINE, this.getClass()); monitor.startFunction(FUNCTION); try { Thread.sleep(100); } catch (InterruptedException e) { // Do nothing } monitor.finishFunction(FUNCTION); Metrics m = MetricsFactory.getMetrics(PIPELINE, this.getClass()); assertTrue(m.getTimer(FUNCTION).getSnapshot().getValues()[0] > 0); }