I want to monitor a critical part of our Java Application (Glassfish v3.1.2 JSF2 application). I want to track a specific function call as a new transaction. This method can be called within the "/Faces Servlet" or any other JAX-RS transactions.
The @Trace annotation seems to be perfect for my case but reading the doc it is not clear if it supports nested transactions (like the REQUIRES_NEW J2EE transaction semantic).
Here is the method I want to track
@Trace(dispatcher=true, matricName="Internal/Query")
public void query(Query q) {
long st = -System.currentTimeMillis();
// do my stuff
st += System.currentTimeMillis();
NewRelic.addCustomParameter("Client", q.getClient());
// Add useful parameters
NewRelic.recordResponseTimeMetric("Internal/Query/queryTime", st); // Is this needed?
}
And for example a JAX-RS WS like this :
@GET
public Response wsquery(...) { // <- Start NewRelic Transaction T1
myBean.query(q1); // <- Start nested Transaction T1.1
myBean.query(q2); // <- Start nested Transaction T1.2
}
Will I Have 3 transactions tracked? One for the JAX-RS call to wsquery and two for Internal/Query.
Thanks.
Based off of the information provided it's not certain exactly what you're going to get. I recommend giving it a test. You can also bump up the logging level to the "finest" level and see exactly what is being instrumented. If you run into issues beyond that contact us at http://support.newrelic.com