use of com.newrelic.agent.bridge.Transaction in project newrelic-java-agent by newrelic.
the class MuleUtils method reportToAgent.
/**
* Called outbound when using Http Transport. Verify this is consistent with usages of MuleHttpConnectorResponse in
* the mule-3.6 and mule-3.7 modules.
*/
public static void reportToAgent(final HttpResponse response) {
if (response == null) {
NewRelic.getAgent().getLogger().log(Level.FINE, "MuleUtils#reportToAgent httpResponse is null");
return;
}
final MuleHttpTransportResponse muleResponse = new MuleHttpTransportResponse(response);
NewRelic.getAgent().getTracedMethod().addOutboundRequestHeaders(muleResponse);
final Transaction txn = AgentBridge.getAgent().getTransaction(false);
if (txn != null) {
txn.setWebResponse(muleResponse);
txn.getCrossProcessState().processOutboundResponseHeaders(muleResponse, getContentLength(muleResponse));
}
}
use of com.newrelic.agent.bridge.Transaction 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;
}
use of com.newrelic.agent.bridge.Transaction in project newrelic-java-agent by newrelic.
the class AbstractMessageReceiver_Implementation method processMessage.
@Trace(dispatcher = true)
protected void processMessage(final MessageProcessTemplate messageProcessTemplate, final MessageProcessContext messageProcessContext) {
MessageSource messageSource = messageProcessContext.getMessageSource();
if (messageSource instanceof DefaultInboundEndpoint) {
DefaultInboundEndpoint endpoint = (DefaultInboundEndpoint) messageSource;
final Transaction txn = AgentBridge.getAgent().getTransaction();
// we only set transaction state on the outer-most one.
if (((com.newrelic.agent.bridge.TracedMethod) txn.getTracedMethod()).getParentTracedMethod() == null) {
final String protocol = endpoint.getConnector().getProtocol().toUpperCase();
final String path = endpoint.getEndpointURI().getPath();
final String txnName = protocol + path;
txn.setTransactionName(TransactionNamePriority.FRAMEWORK_LOW, false, "Mule", txnName);
}
}
Weaver.callOriginal();
}
use of com.newrelic.agent.bridge.Transaction in project newrelic-java-agent by newrelic.
the class MuleWorkManager_Instrumentation method executeWork.
@Trace
private void executeWork(WorkerContext work, WorkExecutor workExecutor) {
final Transaction txn = AgentBridge.getAgent().getTransaction(false);
if (txn != null) {
TracedMethod tm = (TracedMethod) txn.getTracedMethod();
if (tm != null) {
tm.setMetricName("Flow", "MuleWorkManager", "executeWork", name);
}
}
Weaver.callOriginal();
}
use of com.newrelic.agent.bridge.Transaction in project newrelic-java-agent by newrelic.
the class WorkerContext_Instrumentation method workAccepted.
@Trace(async = true, excludeFromTransactionTrace = true)
public synchronized void workAccepted(Object anObject) {
Transaction txn = AgentBridge.getAgent().getTransaction(false);
if (txn != null) {
String className = worker.getClass().getName();
if (MuleUtils.ignoreClass(className)) {
txn.ignore();
} else {
asyncToken = txn.getToken();
}
}
Weaver.callOriginal();
}
Aggregations