use of com.navercorp.pinpoint.plugin.httpclient3.HttpClient3CallContext in project pinpoint by naver.
the class HttpMethodBaseRequestAndResponseMethodInterceptor method before.
@Override
public void before(Object target, Object[] args) {
if (isDebug) {
logger.beforeInterceptor(target, methodDescriptor.getClassName(), methodDescriptor.getMethodName(), "", args);
}
final Trace trace = traceContext.currentTraceObject();
if (trace == null) {
return;
}
InterceptorScopeInvocation invocation = interceptorScope.getCurrentInvocation();
if (invocation != null && invocation.getAttachment() != null && invocation.getAttachment() instanceof HttpClient3CallContext) {
HttpClient3CallContext callContext = (HttpClient3CallContext) invocation.getAttachment();
if (methodDescriptor.getMethodName().equals("writeRequest")) {
callContext.setWriteBeginTime(System.currentTimeMillis());
} else {
callContext.setReadBeginTime(System.currentTimeMillis());
}
logger.debug("Set call context {}", callContext);
}
}
use of com.navercorp.pinpoint.plugin.httpclient3.HttpClient3CallContext 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();
if (target instanceof HttpMethod) {
HttpMethod httpMethod = (HttpMethod) target;
recordDestination(trace, httpMethod, args);
recordRequest(trace, httpMethod, throwable);
}
if (result != null) {
recorder.recordAttribute(AnnotationKey.HTTP_STATUS_CODE, result);
}
recorder.recordApi(descriptor);
recorder.recordException(throwable);
final HttpClient3CallContext callContext = getAndCleanAttachment();
if (callContext != null) {
recordIo(recorder, callContext);
}
} finally {
trace.traceBlockEnd();
}
}
use of com.navercorp.pinpoint.plugin.httpclient3.HttpClient3CallContext in project pinpoint by naver.
the class HttpMethodBaseRequestAndResponseMethodInterceptor method after.
@Override
public void after(Object target, Object[] args, Object result, Throwable throwable) {
if (isDebug) {
logger.afterInterceptor(target, methodDescriptor.getClassName(), methodDescriptor.getMethodName(), "", args, result, throwable);
}
final Trace trace = traceContext.currentTraceObject();
if (trace == null) {
return;
}
InterceptorScopeInvocation invocation = interceptorScope.getCurrentInvocation();
if (invocation != null && invocation.getAttachment() != null && invocation.getAttachment() instanceof HttpClient3CallContext) {
HttpClient3CallContext callContext = (HttpClient3CallContext) invocation.getAttachment();
if (methodDescriptor.getMethodName().equals("writeRequest")) {
callContext.setWriteEndTime(System.currentTimeMillis());
callContext.setWriteFail(throwable != null);
} else {
callContext.setReadEndTime(System.currentTimeMillis());
callContext.setReadFail(throwable != null);
}
logger.debug("Set call context {}", callContext);
}
}
Aggregations