use of com.navercorp.pinpoint.plugin.httpclient4.HttpClient4RequestWrapper in project pinpoint by naver.
the class HttpRequestExecutorExecuteMethodInterceptor 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();
final HttpRequest httpRequest = getHttpRequest(args);
final NameIntValuePair<String> host = getHost();
if (httpRequest != null) {
ClientRequestWrapper clientRequest = new HttpClient4RequestWrapper(httpRequest, host.getName(), host.getValue());
this.clientRequestRecorder.record(recorder, clientRequest, throwable);
this.cookieRecorder.record(recorder, httpRequest, throwable);
}
if (statusCode) {
final Integer statusCodeValue = getStatusCode(result);
if (statusCodeValue != null) {
recorder.recordAttribute(AnnotationKey.HTTP_STATUS_CODE, statusCodeValue);
}
recordResponseHeader(recorder, result);
}
recorder.recordApi(methodDescriptor);
recorder.recordException(throwable);
final InterceptorScopeInvocation invocation = interceptorScope.getCurrentInvocation();
final Object attachment = getAttachment(invocation);
if (attachment instanceof HttpCallContext) {
final HttpCallContext callContext = (HttpCallContext) attachment;
logger.debug("Check call context {}", callContext);
if (io) {
final IntBooleanIntBooleanValue value = new IntBooleanIntBooleanValue((int) callContext.getWriteElapsedTime(), callContext.isWriteFail(), (int) callContext.getReadElapsedTime(), callContext.isReadFail());
recorder.recordAttribute(AnnotationKey.HTTP_IO, value);
}
// clear
invocation.removeAttachment();
}
} finally {
trace.traceBlockEnd();
}
}
use of com.navercorp.pinpoint.plugin.httpclient4.HttpClient4RequestWrapper 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();
}
}
Aggregations