use of com.nr.agent.instrumentation.asynchttpclient.OutboundWrapper in project newrelic-java-agent by newrelic.
the class AsyncHttpProvider method execute.
public <T> ListenableFuture<T> execute(Request request, NRAsyncHandler<T> handler) {
URI uri = null;
try {
uri = new URI(request.getUrl());
String scheme = uri.getScheme();
// only instrument HTTP or HTTPS calls
if ((scheme == null || scheme.equals("http") || scheme.equals("https")) && null != AgentBridge.getAgent().getTransaction(false) && AgentBridge.getAgent().getTransaction().isStarted()) {
Segment segment = NewRelic.getAgent().getTransaction().startSegment("execute");
segment.addOutboundRequestHeaders(new OutboundWrapper(request));
handler.uri = uri;
handler.segment = segment;
}
} catch (URISyntaxException uriSyntaxException) {
// if Java can't parse the URI, ning won't be able to either
// let's just proceed without instrumentation
}
// proceed
return Weaver.callOriginal();
}
use of com.nr.agent.instrumentation.asynchttpclient.OutboundWrapper in project newrelic-java-agent by newrelic.
the class AsyncHttpClient method executeRequest.
public <T> ListenableFuture<T> executeRequest(Request request, NRAsyncHandler<T> handler) {
URI uri = null;
try {
uri = new URI(request.getUrl());
String scheme = uri.getScheme();
// only instrument HTTP or HTTPS calls
if ((scheme == null || scheme.equals("http") || scheme.equals("https")) && null != AgentBridge.getAgent().getTransaction(false) && AgentBridge.getAgent().getTransaction().isStarted()) {
// start the activity
Segment segment = AgentBridge.getAgent().getTransaction().startSegment("External");
if (null != segment) {
segment.addOutboundRequestHeaders(new OutboundWrapper(request));
handler.uri = uri;
handler.segment = segment;
}
}
} catch (URISyntaxException uriSyntaxException) {
// if Java can't parse the URI, asynchttpclient won't be able to either
// let's just proceed without instrumentation
}
// proceed
return Weaver.callOriginal();
}
Aggregations