@Test
public void testFailureExample() {
tracer.attemptStarted(0);
tracer.connectionSelected(1);
ApiException error0 =
new NotFoundException("not found", null, new FakeStatusCode(Code.NOT_FOUND), false);
tracer.attemptPermanentFailure(error0);
tracer.operationFailed(error0);
verify(span)
.addAnnotation(
"Attempt started", ImmutableMap.of("attempt", AttributeValue.longAttributeValue(0)));
verify(span)
.addAnnotation(
"Connection selected", ImmutableMap.of("id", AttributeValue.longAttributeValue(1)));
verify(span)
.addAnnotation(
"Attempt failed, error not retryable",
ImmutableMap.of(
"attempt", AttributeValue.longAttributeValue(0),
"status", AttributeValue.stringAttributeValue("NOT_FOUND")));
verify(span)
.putAttributes(ImmutableMap.of("attempt count", AttributeValue.longAttributeValue(1)));
verify(span)
.end(
EndSpanOptions.builder()
.setStatus(Status.NOT_FOUND.withDescription("not found"))
.build());
verifyNoMoreInteractions(span);
}