use of com.ning.http.client.Request in project pinpoint by naver.
the class ExecuteRequestInterceptor method before.
@Override
public void before(Object target, Object[] args) {
if (isDebug) {
logger.beforeInterceptor(target, args);
}
final Trace trace = traceContext.currentRawTraceObject();
if (trace == null) {
return;
}
Request httpRequest = getHttpReqeust(args);
if (httpRequest == null) {
return;
}
final boolean sampling = trace.canSampled();
if (!sampling) {
this.requestTraceWriter.write(httpRequest);
return;
}
trace.traceBlockBegin();
final SpanEventRecorder recorder = trace.currentSpanEventRecorder();
final TraceId nextId = trace.getTraceId().getNextTraceId();
recorder.recordNextSpanId(nextId.getSpanId());
recorder.recordServiceType(NingAsyncHttpClientConstants.ASYNC_HTTP_CLIENT);
String host = getHost(httpRequest);
requestTraceWriter.write(httpRequest, nextId, host);
}
use of com.ning.http.client.Request in project pinpoint by naver.
the class ExecuteRequestInterceptor method after.
@Override
public void after(Object target, Object[] args, Object result, Throwable throwable) {
if (isDebug) {
// Do not log result
logger.afterInterceptor(target, args);
}
final Trace trace = traceContext.currentTraceObject();
if (trace == null) {
return;
}
Request httpReqeust = getHttpReqeust(args);
if (httpReqeust == null) {
return;
}
try {
final SpanEventRecorder recorder = trace.currentSpanEventRecorder();
final Request httpRequest = (Request) args[0];
// Accessing httpRequest here not BEFORE() because it can cause side effect.
this.clientRequestRecorder.record(recorder, httpRequest, throwable);
this.cookieRecorder.record(recorder, httpRequest, throwable);
this.entityRecorder.record(recorder, httpRequest, throwable);
recorder.recordApi(descriptor);
recorder.recordException(throwable);
} finally {
trace.traceBlockEnd();
}
}
Aggregations