com.amazonaws.handlers.HandlerContextKey Java Examples

The following examples show how to use com.amazonaws.handlers.HandlerContextKey. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TracingRequestHandlerTest.java    From zipkin-aws with Apache License 2.0 6 votes vote down vote up
@Test
public void handlesAmazonServiceExceptions() {
  brave.Span braveSpan = tracing.tracer().nextSpan();
  AmazonServiceException exception = new ProvisionedThroughputExceededException("test");
  exception.setRequestId("abcd");

  DefaultRequest request = new DefaultRequest("test");
  request.addHandlerContext(new HandlerContextKey<>(brave.Span.class.getCanonicalName()), braveSpan);
  HandlerAfterAttemptContext context = HandlerAfterAttemptContext.builder()
      .withRequest(request)
      .withException(exception)
      .build();

  handler.afterAttempt(context);
  assertThat(spans).hasSize(1);
  MutableSpan reportedSpan = spans.get(0);
  assertThat(reportedSpan.traceId()).isEqualToIgnoringCase(braveSpan.context().traceIdString());
  assertThat(reportedSpan.error()).isEqualTo(exception);
  assertThat(reportedSpan.tags().get("aws.request_id")).isEqualToIgnoringCase("abcd");
}
 
Example #2
Source File: AWSRequest.java    From dremio-oss with Apache License 2.0 4 votes vote down vote up
@Override
public <X> void addHandlerContext(HandlerContextKey<X> key, X value) {
  throw new UnsupportedOperationException("Not supported by AWSRequest");
}
 
Example #3
Source File: AWSRequest.java    From dremio-oss with Apache License 2.0 4 votes vote down vote up
@Override
public <X> X getHandlerContext(HandlerContextKey<X> key) {
  throw new UnsupportedOperationException("Not supported by AWSRequest");
}