Search in sources :

Example 1 with UserResponseGetter

use of com.navercorp.pinpoint.plugin.okhttp.UserResponseGetter in project pinpoint by naver.

the class HttpEngineReadResponseMethodInterceptor method after.

@Override
public void after(Object target, Object[] args, Object result, Throwable throwable) {
    if (isDebug) {
        logger.afterInterceptor(target, args);
    }
    final Trace trace = traceContext.currentTraceObject();
    if (trace == null) {
        return;
    }
    if (!validate(target)) {
        return;
    }
    try {
        SpanEventRecorder recorder = trace.currentSpanEventRecorder();
        recorder.recordApi(methodDescriptor);
        recorder.recordException(throwable);
        if (statusCode) {
            // type check validate();
            Response response = ((UserResponseGetter) target)._$PINPOINT$_getUserResponse();
            if (response != null) {
                recorder.recordAttribute(AnnotationKey.HTTP_STATUS_CODE, response.code());
            }
        }
    } finally {
        trace.traceBlockEnd();
    }
}
Also used : Response(com.squareup.okhttp.Response) UserResponseGetter(com.navercorp.pinpoint.plugin.okhttp.UserResponseGetter)

Aggregations

UserResponseGetter (com.navercorp.pinpoint.plugin.okhttp.UserResponseGetter)1 Response (com.squareup.okhttp.Response)1