use of com.navercorp.pinpoint.plugin.okhttp.v3.UserRequestGetter in project pinpoint by naver.
the class HttpEngineSendRequestMethodInterceptor 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 {
final SpanEventRecorder recorder = trace.currentSpanEventRecorder();
recorder.recordApi(methodDescriptor);
recorder.recordException(throwable);
// clear attachment.
final InterceptorScopeInvocation invocation = interceptorScope.getCurrentInvocation();
final Object attachment = getAttachment(invocation);
if (attachment != null) {
invocation.removeAttachment();
}
// typeCheck validate();
final Request request = ((UserRequestGetter) target)._$PINPOINT$_getUserRequest();
if (request != null) {
this.clientRequestRecorder.record(recorder, request, throwable);
this.cookieRecorder.record(recorder, request, throwable);
}
} finally {
trace.traceBlockEnd();
}
}
use of com.navercorp.pinpoint.plugin.okhttp.v3.UserRequestGetter in project pinpoint by naver.
the class HttpEngineSendRequestMethodInterceptor 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 {
final SpanEventRecorder recorder = trace.currentSpanEventRecorder();
recorder.recordApi(methodDescriptor);
recorder.recordException(throwable);
// clear attachment.
final InterceptorScopeInvocation invocation = interceptorScope.getCurrentInvocation();
final Object attachment = getAttachment(invocation);
if (attachment != null) {
invocation.removeAttachment();
}
// typeCheck validate();
final Request request = ((UserRequestGetter) target)._$PINPOINT$_getUserRequest();
if (request != null) {
this.clientRequestRecorder.record(recorder, request, throwable);
this.cookieRecorder.record(recorder, request, throwable);
}
} finally {
trace.traceBlockEnd();
}
}
use of com.navercorp.pinpoint.plugin.okhttp.v3.UserRequestGetter in project pinpoint by naver.
the class HttpEngineConnectMethodInterceptor method doInAfterTrace.
@Override
protected void doInAfterTrace(SpanEventRecorder recorder, Object target, Object[] args, Object result, Throwable throwable) {
recorder.recordApi(methodDescriptor);
recorder.recordServiceType(OkHttpConstants.OK_HTTP_CLIENT_INTERNAL);
recorder.recordException(throwable);
if (target instanceof UserRequestGetter) {
final Request request = ((UserRequestGetter) target)._$PINPOINT$_getUserRequest();
if (request != null && request.url() != null) {
final HttpUrl httpUrl = request.url();
final String hostAndPort = HostAndPort.toHostAndPortString(httpUrl.host(), httpUrl.port());
recorder.recordAttribute(AnnotationKey.HTTP_INTERNAL_DISPLAY, hostAndPort);
}
}
}
use of com.navercorp.pinpoint.plugin.okhttp.v3.UserRequestGetter in project pinpoint by naver.
the class HttpEngineConnectMethodFromUserRequestInterceptor method doInAfterTrace.
@Override
protected void doInAfterTrace(SpanEventRecorder recorder, Object target, Object[] args, Object result, Throwable throwable) {
recorder.recordApi(methodDescriptor);
recorder.recordServiceType(OkHttpConstants.OK_HTTP_CLIENT_INTERNAL);
recorder.recordException(throwable);
if (target instanceof UserRequestGetter) {
final Request request = ((UserRequestGetter) target)._$PINPOINT$_getUserRequest();
if (request != null && request.httpUrl() != null) {
final HttpUrl httpUrl = request.httpUrl();
final String hostAndPort = HostAndPort.toHostAndPortString(httpUrl.host(), httpUrl.port());
recorder.recordAttribute(AnnotationKey.HTTP_INTERNAL_DISPLAY, hostAndPort);
}
}
}
Aggregations