Turning on method tracing for spring-boot application that uses embedded jetty will add all RestController transactions to the "application#main" transaction as opposed to recording each call to the controller as a separate transaction.
Method tracing turned on by using:
-Delastic.apm.trace_methods=net.company.*
After turning on trace logging for the java elastic apm, I noticed that all http requests to the controller were starting at the QueuedThreadPool class in jetty. So I decided to exclude this class from elastic apm instrumentation like so:
-Delastic.apm.classes_excluded_from_instrumentation=org.eclipse.jetty.util.thread.QueuedThreadPool
Once i did the above I was able to see the controller requests being recored in kibana as separate transactions. Is this a good workaround for the issue?
Using the following versions of spring and elastic apm java agent:
-Spring boot version being used is 2.0.2
- Elastic apm agent version being used was 1.12.0
Other Things to note:
-
If we don't turn on method tracing then controller requests will get recored as separate transactions without an issue. However...this means that we will not be able to see full traces in the code base..but rather just traces for http requests. So this is not an ideal solution.
-
This problem does NOT occur when the spring-boot application is using embedded tomcat. When method tracing is turned on the spring boot application with embedded tomcat, all rest calls to the restcontrollers are recored as separate transactions as expected.
Would like to know if anyone else is experiencing this.