Search in sources :

Example 1 with MuleEvent

use of org.mule.api.MuleEvent in project newrelic-java-agent by newrelic.

the class HttpRequestToMuleEvent_Instrumentation method transform.

/**
 * Verify the method body produces the same URI information as in module-3.6.
 */
@Trace
public static MuleEvent transform(final HttpRequestContext requestContext, final MuleContext muleContext, final FlowConstruct flowConstruct, Boolean parseRequest, ListenerPath listenerPath) {
    MuleEvent event = Weaver.callOriginal();
    final MuleHttpConnectorRequest muleRequest = new MuleHttpConnectorRequest(event, requestContext);
    URI uri = resolveUriForNR(requestContext);
    NewRelic.getAgent().getTracedMethod().reportAsExternal(HttpParameters.library("MuleHTTP").uri(uri).procedure("writeResponse").inboundHeaders(muleRequest).build());
    final Transaction txn = AgentBridge.getAgent().getTransaction(false);
    txn.setWebRequest(muleRequest);
    final String txnName = event.getMessage().getInboundProperty("http.listener.path") + " (" + muleRequest.getMethod() + ")";
    txn.setTransactionName(TransactionNamePriority.FRAMEWORK_HIGH, true, "Mule/Connector", txnName);
    return event;
}
Also used : Transaction(com.newrelic.agent.bridge.Transaction) MuleEvent(org.mule.api.MuleEvent) MuleHttpConnectorRequest(com.nr.agent.instrumentation.mule3.MuleHttpConnectorRequest) URI(java.net.URI) Trace(com.newrelic.api.agent.Trace)

Example 2 with MuleEvent

use of org.mule.api.MuleEvent in project newrelic-java-agent by newrelic.

the class HttpRequestToMuleEvent_Instrumentation method transform.

/**
 * Verify the method body produces the same URI information as in module-3.7.
 */
@Trace
public static MuleEvent transform(final HttpRequestContext requestContext, final MuleContext muleContext, final FlowConstruct flowConstruct, Boolean parseRequest, String listenerPath) {
    MuleEvent event = Weaver.callOriginal();
    final MuleHttpConnectorRequest muleRequest = new MuleHttpConnectorRequest(event, requestContext);
    URI uri = resolveUriForNR(requestContext);
    NewRelic.getAgent().getTracedMethod().reportAsExternal(HttpParameters.library("MuleHTTP").uri(uri).procedure("writeResponse").inboundHeaders(muleRequest).build());
    final Transaction txn = AgentBridge.getAgent().getTransaction(false);
    txn.setWebRequest(muleRequest);
    final String txnName = event.getMessage().getInboundProperty("http.listener.path") + " (" + muleRequest.getMethod() + ")";
    txn.setTransactionName(TransactionNamePriority.FRAMEWORK_HIGH, true, "Mule/Connector", txnName);
    return event;
}
Also used : Transaction(com.newrelic.agent.bridge.Transaction) MuleEvent(org.mule.api.MuleEvent) MuleHttpConnectorRequest(com.nr.agent.instrumentation.mule3.MuleHttpConnectorRequest) URI(java.net.URI) Trace(com.newrelic.api.agent.Trace)

Aggregations

Transaction (com.newrelic.agent.bridge.Transaction)2 Trace (com.newrelic.api.agent.Trace)2 MuleHttpConnectorRequest (com.nr.agent.instrumentation.mule3.MuleHttpConnectorRequest)2 URI (java.net.URI)2 MuleEvent (org.mule.api.MuleEvent)2