Java APM : Public API + JDBC Driver


I'm trying to set up APM agent for a Java application. The application is using an Undertow server with HTTP handlers (that means, without the Servlet part of Undertow), which is not supported out of the box. I use the public API to set up transactions around those HTTP handlers and it works.

But the the application is also using Hibernate and a Postgresql JDBC Driver. Injection management is made by Google Guice if it matters. That JDBC driver is recognized out of the box when I set up the agent for a Spring Boot applications... Is there a way I could get the same benefit here, I mean instrumenting JDBC calls without having to try set up spans myself around my Hibernate queries? Is there something to implement to "manually" start the JDBC instrumentation?


Welcome to the our forum!

I don't think the dependency injection should be an issue- as long as your driver methods are eventually invoked, they should be instrumented and captured.
What may be the issue is that there is no active transaction when the drivers get invoked. This can happen if you do not properly activate() your transactions, or if you do activate them, but the queries are executed asynchronously and your system uses non-supported async execution framework.

If this doesn't provide enough hint for the solution, please set your agent's log_level to debug and restart your application. The log would contain all instrumentations that were matched against loaded classes as well as other useful info, maybe this will assist.

1 Like


Thank you very much. The problem was the activate(). I think that the fact we were able to get our own transactions and spans without that call was hiding that miss.

Thank you.

Awesome, I am happy to hear you got this resolved! :tada:
Please make sure to properly close all returned Scopes, preferably using try-with-resource, as explained in the docs.

1 Like

Yep, I checked that too. Now we can see all auto-instrumentations and that's pretty cool. Thank you very much for your quick support, it helped a lot today.


This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.