use of com.navercorp.pinpoint.plugin.vertx.VertxHttpClientRequestWrapper in project pinpoint by naver.
the class Http1xClientConnectionCreateRequestInterceptor method after.
@Override
public void after(Object target, Object[] args, Object result, Throwable throwable) {
if (isDebug) {
logger.afterInterceptor(target, args, result, throwable);
}
final Trace trace = traceContext.currentTraceObject();
if (trace == null) {
return;
}
if (!trace.canSampled()) {
if (result instanceof HttpRequest) {
final HttpRequest request = (HttpRequest) result;
requestTraceWriter.write(request);
}
return;
}
try {
final SpanEventRecorder recorder = trace.currentSpanEventRecorder();
recorder.recordApi(descriptor);
recorder.recordException(throwable);
recorder.recordServiceType(VertxConstants.VERTX_HTTP_CLIENT);
if (!validate(args, result)) {
return;
}
final HttpRequest request = (HttpRequest) result;
final HttpHeaders headers = request.headers();
if (headers == null) {
return;
}
String host = ArrayArgumentUtils.getArgument(args, 4, String.class, "UNKNOWN");
// generate next trace id.
final TraceId nextId = trace.getTraceId().getNextTraceId();
recorder.recordNextSpanId(nextId.getSpanId());
requestTraceWriter.write(request, nextId, host);
final ClientRequestWrapper clientRequest = new VertxHttpClientRequestWrapper(request, host);
this.clientRequestRecorder.record(recorder, clientRequest, throwable);
this.cookieRecorder.record(recorder, request, throwable);
} catch (Throwable t) {
if (logger.isWarnEnabled()) {
logger.warn("AFTER. Caused:{}", t.getMessage(), t);
}
} finally {
trace.traceBlockEnd();
}
}
use of com.navercorp.pinpoint.plugin.vertx.VertxHttpClientRequestWrapper in project pinpoint by naver.
the class HttpClientStreamInterceptor method after.
@Override
public void after(Object target, Object[] args, Object result, Throwable throwable) {
if (isDebug) {
logger.afterInterceptor(target, args, result, throwable);
}
final Trace trace = traceContext.currentTraceObject();
if (trace == null) {
return;
}
try {
final SpanEventRecorder recorder = trace.currentSpanEventRecorder();
recorder.recordApi(descriptor);
recorder.recordException(throwable);
recorder.recordServiceType(VertxConstants.VERTX_HTTP_CLIENT);
if (!validate(args)) {
return;
}
final HttpRequest request = (HttpRequest) args[0];
final HttpHeaders headers = request.headers();
if (headers == null) {
return;
}
final String host = (String) args[1];
ClientRequestWrapper clientRequest = new VertxHttpClientRequestWrapper(request, host);
this.clientRequestRecorder.record(recorder, clientRequest, throwable);
this.cookieRecorder.record(recorder, request, throwable);
} catch (Throwable t) {
if (logger.isWarnEnabled()) {
logger.warn("AFTER. Caused:{}", t.getMessage(), t);
}
} finally {
trace.traceBlockEnd();
}
}
Aggregations