@Test public void afterAttempt_OtherException_shouldSendApiCallAttemptEvent() { RuntimeException runtimeException = new RuntimeException("unexpected"); AWSRequestMetrics metrics = getMetrics(1); requestHandler.afterAttempt(getContext(metrics, runtimeException)); 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); verifyConditionalEntries(event, runtimeException); }
@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);  }