@Test public void afterAttempt_Succeed_shouldSendApiCallAttemptEvent() { HandlerAfterAttemptContext context = getContext(getMetrics(1)); requestHandler.afterAttempt(context); ArgumentCaptor<ApiCallAttemptMonitoringEvent> monitoringEventArgumentCaptor = ArgumentCaptor.forClass(ApiCallAttemptMonitoringEvent.class); verify(agentMonitoringListener, times(1)).handleEvent(monitoringEventArgumentCaptor.capture()); verify(customMonitoringListener, times(1)).handleEvent(any(ApiCallAttemptMonitoringEvent.class)); ApiCallAttemptMonitoringEvent event = monitoringEventArgumentCaptor.getValue(); verifyRequiredEntries(event); verifySuccessfulAttemptEvent(event); }
@Override public void afterAttempt(HandlerAfterAttemptContext context) { ApiCallAttemptMonitoringEvent event = generateApiCallAttemptMonitoringEvent(context); context.getRequest().addHandlerContext(LAST_CALL_ATTEMPT, event); handToMonitoringListeners(event); }
ClientSideMonitoringRequestHandler extends RequestHandler2 { @Override public void afterAttempt(HandlerAfterAttemptContext context) { ApiCallAttemptMonitoringEvent event = generateApiCallAttemptMonitoringEvent(context); context.getRequest().addHandlerContext(LAST_CALL_ATTEMPT, event); handToMonitoringListeners(event); } }
ClientSideMonitoringRequestHandler extends RequestHandler2 { @Override public void afterAttempt(HandlerAfterAttemptContext context) { ApiCallAttemptMonitoringEvent event = generateApiCallAttemptMonitoringEvent(context); context.getRequest().addHandlerContext(LAST_CALL_ATTEMPT, event); handToMonitoringListeners(event); } ClientSideMonitoringRequestHandler(String clientId, Collection<MonitoringListener> monitoringListeners); }
ClientSideMonitoringRequestHandler extends RequestHandler2 { @Override public void afterAttempt(HandlerAfterAttemptContext context) { ApiCallAttemptMonitoringEvent event = generateApiCallAttemptMonitoringEvent(context); context.getRequest().addHandlerContext(LAST_CALL_ATTEMPT, event); handToMonitoringListeners(event); } ClientSideMonitoringRequestHandler(String clientId, Collection<MonitoringListener> monitoringListeners); @Override void afterAttempt(HandlerAfterAttemptContext context); @Override void afterResponse(Request<?> request, Response<?> response); @Override void afterError(Request<?> request, Response<?> response, Exception e); }
ClientSideMonitoringRequestHandler extends RequestHandler2 { @Override public void afterAttempt(HandlerAfterAttemptContext context) { ApiCallAttemptMonitoringEvent event = generateApiCallAttemptMonitoringEvent(context); context.getRequest().addHandlerContext(LAST_CALL_ATTEMPT, event); handToMonitoringListeners(event); } ClientSideMonitoringRequestHandler(String clientId, Collection<MonitoringListener> monitoringListeners); @Override void afterAttempt(HandlerAfterAttemptContext context); @Override void afterResponse(Request<?> request, Response<?> response); @Override void afterError(Request<?> request, Response<?> response, Exception e);  }