Search in sources :

Example 1 with AbstractClientHttpResponse

use of org.springframework.http.client.AbstractClientHttpResponse in project pinpoint by naver.

the class ListenableFutureInterceptor method doInAfterTrace.

@Override
protected void doInAfterTrace(SpanEventRecorder recorder, Object target, Object[] args, Object result, Throwable throwable) {
    recorder.recordServiceType(RestTemplateConstants.SERVICE_TYPE);
    recorder.recordException(throwable);
    recorder.recordApi(methodDescriptor);
    if (args.length == 1 && args[0] instanceof AbstractClientHttpResponse) {
        AbstractClientHttpResponse response = (AbstractClientHttpResponse) args[0];
        try {
            HttpStatus statusCode = response.getStatusCode();
            if (statusCode != null) {
                recorder.recordAttribute(AnnotationKey.HTTP_STATUS_CODE, statusCode.value());
            }
            this.responseHeaderRecorder.recordHeader(recorder, response);
        } catch (IOException ioException) {
            logger.warn("Failed to after process. {}", ioException.getMessage(), ioException);
        }
    }
}
Also used : HttpStatus(org.springframework.http.HttpStatus) AbstractClientHttpResponse(org.springframework.http.client.AbstractClientHttpResponse) IOException(java.io.IOException)

Aggregations

IOException (java.io.IOException)1 HttpStatus (org.springframework.http.HttpStatus)1 AbstractClientHttpResponse (org.springframework.http.client.AbstractClientHttpResponse)1