Search in sources :

Example 6 with HttpCallContext

use of com.navercorp.pinpoint.plugin.httpclient4.HttpCallContext in project pinpoint by naver.

the class HttpClientExecuteMethodInternalInterceptor method after.

@Override
public void after(Object target, Object[] args, Object result, Throwable throwable) {
    if (isDebug) {
        logger.afterInterceptor(target, target.getClass().getName(), "", "internal", args);
    }
    if (!needGetStatusCode()) {
        return;
    }
    if (result != null && result instanceof HttpResponse) {
        HttpResponse response = (HttpResponse) result;
        if (response.getStatusLine() != null) {
            HttpCallContext context = new HttpCallContext();
            final StatusLine statusLine = response.getStatusLine();
            if (statusLine != null) {
                context.setStatusCode(statusLine.getStatusCode());
                InterceptorScopeInvocation transaction = interceptorScope.getCurrentInvocation();
                if (transaction != null && transaction.getAttachment() == null) {
                    transaction.setAttachment(context);
                }
            }
        }
    }
}
Also used : HttpCallContext(com.navercorp.pinpoint.plugin.httpclient4.HttpCallContext) InterceptorScopeInvocation(com.navercorp.pinpoint.bootstrap.interceptor.scope.InterceptorScopeInvocation)

Aggregations

InterceptorScopeInvocation (com.navercorp.pinpoint.bootstrap.interceptor.scope.InterceptorScopeInvocation)6 HttpCallContext (com.navercorp.pinpoint.plugin.httpclient4.HttpCallContext)6 Trace (com.navercorp.pinpoint.bootstrap.context.Trace)5 SpanEventRecorder (com.navercorp.pinpoint.bootstrap.context.SpanEventRecorder)2 HttpRequest (org.apache.http.HttpRequest)1