Is it possible to monitor background transactions using the Java Agent?
This FAQ covers monitoring background processes using the Ruby agent - http://support.newrelic.com/faqs/general/how-do-i-monitor-backgroun...
Is it possible to do the same with the Java Agent?
Comments are currently closed for this discussion. You can start a new one.
Support Staff 2 Posted by Saxon D'Aubin on 10 Mar, 2010 04:33 PM
Hi,
Yes, you can monitor background transactions with the Java agent using annotations. Just mark the entry method of the background task with our com.newrelic.agent.Trace annotation:
Add this to the common section of newrelic.yml:
You'll need to include the agent jar in your compilation classpath.
If you're using the latest agent (1.2.004.1), you can define your own trace annotation class:
}
Then configure the agent to use this annotation in newrelic.yml:
Please let me know if you need any help.
3 Posted by thairu on 12 Mar, 2010 02:39 AM
Thanks. This got it working for me. Curious though - What does @Trace(dispatcher=false) do? Is that a no-op?
Support Staff 4 Posted by Saxon D'Aubin on 12 Mar, 2010 05:18 PM
RPM displays transactions, and an individual transaction contains all of the tracer points that were touched during that transaction. We display transactions as either web transactions or background transactions. The first tracer point in a transaction must be a dispatcher. In the case of web transactions, we've built in instrumentation for the http dispatchers of common servlet containers. We've also built in some background dispatcher tracers, but anything we haven't covered can be instrumented with the @Trace(dispatcher=true) annotation.
So, no, @Trace(dispatcher=false) is not a no-op. It's the default value for the dispatcher flag, so it's equivalent to @Trace, and it simply adds a tracer to a method to provide further breakdown of web and background transactions.
5 Posted by thairu on 12 Mar, 2010 07:44 PM
Thanks!