assertEquals(null, cmd.getFailedExecutionException()); assertNull(cmd.getExecutionException()); System.out.println("Execution time : " + cmd.getExecutionTimeInMilliseconds()); assertTrue(cmd.getExecutionTimeInMilliseconds() > -1); assertFalse(cmd.isSuccessfulExecution()); assertCommandExecutionEvents(cmd, HystrixEventType.CANCELLED);
assertEquals(null, cmd.getFailedExecutionException()); assertNull(cmd.getExecutionException()); assertTrue(cmd.getExecutionTimeInMilliseconds() > -1); assertFalse(cmd.isSuccessfulExecution()); assertCommandExecutionEvents(cmd, HystrixEventType.CANCELLED);
private void updateExecutionSuccessfulMetrics(ExecutionMetadata metadata, InvocationContext invocationContext, HystrixCommand cmd) { Optional<TimeoutMetricsCollection> metricsCollection = metadata.getTimeoutMetricsCollection(invocationContext .getMethod().getName()); if (metricsCollection.isPresent()) { metricsCollection.get().getExecutionDuration().update(cmd.getExecutionTimeInMilliseconds() * 1000000); metricsCollection.get().getCallsNotTimedOut().inc(); } metadata.getCbMetricsCollection(invocationContext.getMethod().getName()) .ifPresent(c -> c.getCallsSucceeded().inc()); }
/** * Copies various parameters like execution events,time and any exception after command execution.<br/><br/> * <b>Should be called only after execution of command completes</b> * @param executor Executor used to execute this request. * @return */ @SuppressWarnings({ "rawtypes", "unchecked" }) public Builder withCommandData(Executor executor) { HystrixCommand command = (HystrixCommand) executor; withEventList(command.getExecutionEvents()) .withExecutionTime(command.getExecutionTimeInMilliseconds()) .withException((Exception) command.getFailedExecutionException()); return this; }
metadata.getTimeoutMetricsCollection(invocationContext.getMethod().getName()) .ifPresent(c -> c.getExecutionDuration() .update(cmd.getExecutionTimeInMilliseconds() * 1000000)); metadata.getTimeoutMetricsCollection(invocationContext.getMethod().getName()) .ifPresent(c -> c.getCallsTimedOut().inc());