use of com.nr.agent.instrumentation.weblogic12.RequestWrapper in project newrelic-java-agent by newrelic.
the class NettyDispatcher method channelRead.
@Trace(dispatcher = true)
public static void channelRead(ChannelHandlerContext_Instrumentation ctx, Object msg) {
ctx.pipeline().token = AgentBridge.getAgent().getTransaction().getToken();
TracedMethod tracer = AgentBridge.getAgent().getTransaction().getTracedMethod();
if (tracer == null) {
// it happens.
AgentBridge.getAgent().getLogger().log(Level.FINEST, "Unable to dispatch netty tx. No tracer.");
} else {
tracer.setMetricName("NettyUpstreamDispatcher");
AgentBridge.getAgent().getTransaction().setTransactionName(TransactionNamePriority.SERVLET_NAME, true, "NettyDispatcher", "NettyDispatcher");
}
Transaction tx = AgentBridge.getAgent().getTransaction(false);
if (tx != null) {
tx.setWebRequest(new RequestWrapper((HttpRequest) msg));
}
}
use of com.nr.agent.instrumentation.weblogic12.RequestWrapper in project newrelic-java-agent by newrelic.
the class WebAppServletContext method execute.
@Trace(dispatcher = true)
void execute(ServletRequestImpl req, ServletResponseImpl rsp) {
HttpServletRequest request = getHttpServletRequest(req);
if (!AgentBridge.getAgent().getTransaction().isWebRequestSet()) {
if (request != null) {
AgentBridge.getAgent().getTransaction().setWebRequest(new RequestWrapper(request));
}
}
if (!AgentBridge.getAgent().getTransaction().isWebResponseSet()) {
if (req != null) {
AgentBridge.getAgent().getTransaction().setWebResponse(new ResponseWrapper(req.getResponse()));
}
}
Weaver.callOriginal();
if (request != null) {
Throwable exception = (Throwable) request.getAttribute("javax.servlet.error.exception");
if (exception != null) {
NewRelic.noticeError(exception);
}
}
if (request != null && request.isAsyncStarted()) {
AsyncContext asyncContext = request.getAsyncContext();
if (asyncContext != null) {
AgentBridge.asyncApi.suspendAsync(asyncContext);
}
}
AgentBridge.getAgent().getTransaction().addOutboundResponseHeaders();
AgentBridge.getAgent().getTransaction().markResponseSent();
}
use of com.nr.agent.instrumentation.weblogic12.RequestWrapper in project newrelic-java-agent by newrelic.
the class NettyDispatcher method upstreamDispatcher.
@Trace(dispatcher = true)
public static void upstreamDispatcher(ChannelHandlerContext_Instrumentation ctx, Object msg) {
try {
ctx.getPipeline().token = AgentBridge.getAgent().getTransaction().getToken();
TracedMethod tracer = AgentBridge.getAgent().getTransaction().getTracedMethod();
if (tracer == null) {
// it happens.
AgentBridge.getAgent().getLogger().log(Level.FINEST, "Unable to dispatch netty tx. No tracer.");
} else {
tracer.setMetricName("NettyUpstreamDispatcher");
AgentBridge.currentApiSource.set(WeavePackageType.INTERNAL);
AgentBridge.getAgent().getTransaction().setTransactionName(TransactionNamePriority.SERVLET_NAME, true, "NettyDispatcher", "NettyDispatcher");
}
Transaction tx = AgentBridge.getAgent().getTransaction(false);
if (tx != null) {
tx.setWebRequest(new RequestWrapper((DefaultHttpRequest) msg));
}
} catch (Throwable t) {
AgentBridge.instrumentation.noticeInstrumentationError(t, Weaver.getImplementationTitle());
} finally {
AgentBridge.currentApiSource.remove();
}
}
Aggregations