Search in sources :

Example 6 with ClientRequestWrapper

use of com.navercorp.pinpoint.bootstrap.plugin.request.ClientRequestWrapper in project pinpoint by naver.

the class PromiseImplInterceptor method doInAfterTrace.

@Override
public void doInAfterTrace(SpanEventRecorder recorder, Object target, Object[] args, Object result, Throwable throwable) {
    recorder.recordApi(methodDescriptor);
    recorder.recordException(throwable);
    recorder.recordServiceType(VertxConstants.VERTX_HTTP_CLIENT);
    final HttpClientRequest request = (HttpClientRequest) args[0];
    String host = request.getHost();
    if (host == null) {
        host = "UNKNOWN";
    }
    final ClientRequestWrapper clientRequest = new HttpClientRequestWrapper(request, host);
    this.clientRequestRecorder.record(recorder, clientRequest, throwable);
    this.cookieRecorder.record(recorder, request, throwable);
}
Also used : HttpClientRequest(io.vertx.core.http.HttpClientRequest) HttpClientRequestWrapper(com.navercorp.pinpoint.plugin.vertx.HttpClientRequestWrapper) ClientRequestWrapper(com.navercorp.pinpoint.bootstrap.plugin.request.ClientRequestWrapper) HttpClientRequestWrapper(com.navercorp.pinpoint.plugin.vertx.HttpClientRequestWrapper)

Example 7 with ClientRequestWrapper

use of com.navercorp.pinpoint.bootstrap.plugin.request.ClientRequestWrapper in project pinpoint by naver.

the class HttpMethodBaseExecuteMethodInterceptor 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;
    }
    try {
        final SpanEventRecorder recorder = trace.currentSpanEventRecorder();
        recorder.recordApi(descriptor);
        recorder.recordException(throwable);
        if (target instanceof HttpMethod) {
            final HttpMethod httpMethod = (HttpMethod) target;
            final HttpConnection httpConnection = getHttpConnection(args);
            final ClientRequestWrapper requestWrapper = new HttpClient3RequestWrapper(httpMethod, httpConnection);
            this.clientRequestRecorder.record(recorder, requestWrapper, throwable);
            this.cookieRecorder.record(recorder, httpMethod, throwable);
            this.entityRecorder.record(recorder, httpMethod, throwable);
            this.responseHeaderRecorder.recordHeader(recorder, httpMethod);
        }
        if (result != null) {
            recorder.recordAttribute(AnnotationKey.HTTP_STATUS_CODE, result);
        }
        final HttpClient3CallContext callContext = getAndCleanAttachment();
        if (callContext != null) {
            recordIo(recorder, callContext);
        }
    } finally {
        trace.traceBlockEnd();
    }
}
Also used : Trace(com.navercorp.pinpoint.bootstrap.context.Trace) ClientRequestWrapper(com.navercorp.pinpoint.bootstrap.plugin.request.ClientRequestWrapper) HttpConnection(org.apache.commons.httpclient.HttpConnection) HttpClient3CallContext(com.navercorp.pinpoint.plugin.httpclient3.HttpClient3CallContext) SpanEventRecorder(com.navercorp.pinpoint.bootstrap.context.SpanEventRecorder) HttpClient3RequestWrapper(com.navercorp.pinpoint.plugin.httpclient3.HttpClient3RequestWrapper) HttpMethod(org.apache.commons.httpclient.HttpMethod)

Example 8 with ClientRequestWrapper

use of com.navercorp.pinpoint.bootstrap.plugin.request.ClientRequestWrapper in project pinpoint by naver.

the class DefaultClientExchangeHandlerImplStartMethodInterceptor 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;
    }
    try {
        SpanEventRecorder recorder = trace.currentSpanEventRecorder();
        final HttpRequest httpRequest = getHttpRequest(target);
        final NameIntValuePair<String> host = getHost(target);
        if (httpRequest != null) {
            // Accessing httpRequest here not BEFORE() because it can cause side effect.
            ClientRequestWrapper clientRequest = new HttpClient4RequestWrapper(httpRequest, host.getName(), host.getValue());
            this.clientRequestRecorder.record(recorder, clientRequest, throwable);
            this.cookieRecorder.record(recorder, httpRequest, throwable);
            this.entityRecorder.record(recorder, httpRequest, throwable);
        }
        recorder.recordApi(methodDescriptor);
        recorder.recordException(throwable);
    } finally {
        trace.traceBlockEnd();
    }
}
Also used : Trace(com.navercorp.pinpoint.bootstrap.context.Trace) HttpRequest(org.apache.http.HttpRequest) ClientRequestWrapper(com.navercorp.pinpoint.bootstrap.plugin.request.ClientRequestWrapper) SpanEventRecorder(com.navercorp.pinpoint.bootstrap.context.SpanEventRecorder) HttpClient4RequestWrapper(com.navercorp.pinpoint.plugin.httpclient4.HttpClient4RequestWrapper)

Example 9 with ClientRequestWrapper

use of com.navercorp.pinpoint.bootstrap.plugin.request.ClientRequestWrapper in project pinpoint by naver.

the class HttpClientOperationsSendInterceptor method doInAfterTrace.

@Override
public void doInAfterTrace(SpanEventRecorder recorder, Object target, Object[] args, Object result, Throwable throwable) {
    recorder.recordApi(methodDescriptor);
    recorder.recordException(throwable);
    final HttpClientRequest request = (HttpClientRequest) target;
    final ClientRequestWrapper clientRequestWrapper = new HttpClientRequestWrapper(request);
    this.clientRequestRecorder.record(recorder, clientRequestWrapper, throwable);
}
Also used : HttpClientRequest(reactor.netty.http.client.HttpClientRequest) ClientRequestWrapper(com.navercorp.pinpoint.bootstrap.plugin.request.ClientRequestWrapper)

Aggregations

ClientRequestWrapper (com.navercorp.pinpoint.bootstrap.plugin.request.ClientRequestWrapper)9 Trace (com.navercorp.pinpoint.bootstrap.context.Trace)5 SpanEventRecorder (com.navercorp.pinpoint.bootstrap.context.SpanEventRecorder)4 TraceId (com.navercorp.pinpoint.bootstrap.context.TraceId)2 HttpClient4RequestWrapper (com.navercorp.pinpoint.plugin.httpclient4.HttpClient4RequestWrapper)2 VertxHttpClientRequestWrapper (com.navercorp.pinpoint.plugin.vertx.VertxHttpClientRequestWrapper)2 HttpHeaders (io.netty.handler.codec.http.HttpHeaders)2 HttpRequest (io.netty.handler.codec.http.HttpRequest)2 HttpRequest (org.apache.http.HttpRequest)2 HttpClientRequest (reactor.netty.http.client.HttpClientRequest)2 AsyncContextAccessor (com.navercorp.pinpoint.bootstrap.async.AsyncContextAccessor)1 AsyncContext (com.navercorp.pinpoint.bootstrap.context.AsyncContext)1 InterceptorScopeInvocation (com.navercorp.pinpoint.bootstrap.interceptor.scope.InterceptorScopeInvocation)1 IntBooleanIntBooleanValue (com.navercorp.pinpoint.common.util.IntBooleanIntBooleanValue)1 HttpClient3CallContext (com.navercorp.pinpoint.plugin.httpclient3.HttpClient3CallContext)1 HttpClient3RequestWrapper (com.navercorp.pinpoint.plugin.httpclient3.HttpClient3RequestWrapper)1 HttpCallContext (com.navercorp.pinpoint.plugin.httpclient4.HttpCallContext)1 HttpClientRequestWrapper (com.navercorp.pinpoint.plugin.vertx.HttpClientRequestWrapper)1 HttpClientRequest (io.vertx.core.http.HttpClientRequest)1 HttpConnection (org.apache.commons.httpclient.HttpConnection)1