use of akka.http.javadsl.server.Complete in project pinpoint by naver.
the class RequestContextImplCompleteInterceptor method doInAfterTrace.
@Override
protected void doInAfterTrace(SpanEventRecorder recorder, Object target, Object[] args, Object result, Throwable throwable) {
try {
if (result instanceof Future && ((Future) result).isCompleted()) {
Option value = ((Future) result).value();
if (value == null) {
return;
}
Object routeResult = value.get();
if (routeResult instanceof Success) {
Object success = ((Success) routeResult).get();
if (success instanceof Complete) {
akka.http.javadsl.model.HttpResponse response = ((Complete) success).getResponse();
if (response == null) {
return;
}
akka.http.javadsl.model.StatusCode status = response.status();
if (status == null) {
return;
}
recorder.recordAttribute(AnnotationKey.HTTP_STATUS_CODE, status.intValue());
}
} else if (routeResult instanceof Failure) {
Throwable failure = ((Failure) routeResult).exception();
recorder.recordException(failure);
}
}
} finally {
recorder.recordApi(methodDescriptor);
recorder.recordServiceType(AkkaHttpConstants.AKKA_HTTP_SERVER_INTERNAL);
recorder.recordException(throwable);
}
}