Search in sources :

Example 1 with RequestWrapper

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));
    }
}
Also used : HttpRequest(io.netty.handler.codec.http.HttpRequest) Transaction(com.newrelic.agent.bridge.Transaction) RequestWrapper(com.agent.instrumentation.netty40.RequestWrapper) TracedMethod(com.newrelic.api.agent.TracedMethod) Trace(com.newrelic.api.agent.Trace)

Example 2 with RequestWrapper

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();
}
Also used : HttpServletRequest(javax.servlet.http.HttpServletRequest) RequestWrapper(com.nr.agent.instrumentation.weblogic12.RequestWrapper) ResponseWrapper(com.nr.agent.instrumentation.weblogic12.ResponseWrapper) AsyncContext(javax.servlet.AsyncContext) Trace(com.newrelic.api.agent.Trace)

Example 3 with RequestWrapper

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();
    }
}
Also used : Transaction(com.newrelic.agent.bridge.Transaction) DefaultHttpRequest(org.jboss.netty.handler.codec.http.DefaultHttpRequest) RequestWrapper(com.agent.instrumentation.netty38.RequestWrapper) TracedMethod(com.newrelic.api.agent.TracedMethod) Trace(com.newrelic.api.agent.Trace)

Aggregations

Trace (com.newrelic.api.agent.Trace)3 Transaction (com.newrelic.agent.bridge.Transaction)2 TracedMethod (com.newrelic.api.agent.TracedMethod)2 RequestWrapper (com.agent.instrumentation.netty38.RequestWrapper)1 RequestWrapper (com.agent.instrumentation.netty40.RequestWrapper)1 RequestWrapper (com.nr.agent.instrumentation.weblogic12.RequestWrapper)1 ResponseWrapper (com.nr.agent.instrumentation.weblogic12.ResponseWrapper)1 HttpRequest (io.netty.handler.codec.http.HttpRequest)1 AsyncContext (javax.servlet.AsyncContext)1 HttpServletRequest (javax.servlet.http.HttpServletRequest)1 DefaultHttpRequest (org.jboss.netty.handler.codec.http.DefaultHttpRequest)1