Btrace: Filter class with same name by Application

81 Views Asked by At

I'm trying to instrument my app to monitor a connection pool. We use apache commons pool 1.6 for connection pooling, with all the applications deployed on the same AS (we use Jboss EAP 6). Trace script works, but it triggers when pool methods are called in ALL applications on the same AS.

There's a method to make my script hooks pool methods call ONLY in a selected application?

1

There are 1 best solutions below

0
On

BTrace works at JVM level. Therefore it is not, by default, aware of multiple applications running on the same JVM.

In general, it is not very easy to probe just one application hosted in an app server. If you are able to identify a method which acts as an entry point to each application and the subsequent requests are carried on the same thread (or threads recursively started from the originating thread) you could use ThreadLocal or InheritableThreadLocal to store the app identification there.

BTrace supports directly only the former one via @TLS annotation - for InheritableThreadLocal you will have to use unsafe/trusted mode where BTrace safety guarantee checks will be turned off.