use of com.nr.agent.instrumentation.spray.can.client.InboundHttpHeaders in project newrelic-java-agent by newrelic.
the class ClientFrontendPipeline_Instrumentation method apply.
@Trace(async = true)
public final void apply(final Tcp.Event event) {
if (event instanceof Http.MessageEvent && ((Http.MessageEvent) event).ev() instanceof HttpMessageEnd) {
final HttpMessageEnd httpMessageEnd = (HttpMessageEnd) ((Http.MessageEvent) event).ev();
if (this.$outer.spray$can$client$ClientFrontend$$anon$$anon$$openRequests().size() == 1) {
RequestRecord_Instrumentation requestRecord = this.$outer.spray$can$client$ClientFrontend$$anon$$anon$$openRequests().head();
HttpRequestPart request = requestRecord.request();
if (request instanceof HttpRequest_Instrumentation) {
Segment segment = ((HttpRequest_Instrumentation) request).segment;
try {
boolean isSSL = ((HttpRequest_Instrumentation) request).isSSL;
InetSocketAddress hostAndPort = ((HttpRequest_Instrumentation) request).remoteAddress;
segment.reportAsExternal(HttpParameters.library("SprayCanClient").uri(new URI((isSSL ? "https" : "http"), null, hostAndPort.getHostName(), hostAndPort.getPort(), ((HttpRequest_Instrumentation) request).uri().path().toString(), null, null)).procedure("connection").inboundHeaders(new InboundHttpHeaders((HttpResponse) httpMessageEnd)).build());
segment.end();
} catch (Exception e) {
NewRelic.getAgent().getLogger().log(Level.FINE, e, "Unable to record SprayCanClient externals");
}
}
}
}
Weaver.callOriginal();
}
Aggregations