Want to get interface classes for the current transaction

I need to get the name of the interface classes for every transaction in the stack trace.
In the current way, I am using Thread.getAllStackTraces() , but not able to getInterfaces() as it always gives the return as java.io.serializable.

Sorry, I don't understand what you try to achieve and what we can do to assist.
Please describe better what you want to do, including examples and then describe what part of our agent doesn't allow you to do that.

Hi,

I need to capture interface classes for any transaction/spans captured through apm-java-agent.

Currently I have implemented a method in beforeEnd() to capture classes from the current thread stackTrace, but I am not able to implement Class.getInterfaces() method as we do not get the actual class from the stackTrace.

I can only guess what you are trying to do, so relying on that :slight_smile:

IIUC, you forked the agent and added some logic to AbstractSpan#beforeEnd(), trying to retrieve interfaces of the instrumented class based on finding its stack-trace-element in the stack.
Since this code you changed runs from the agent class loader, you cannot access the actual instrumented class from it in most cases.

What you can do is modify our advices, where we have methods annotated with @Advice.OnMethodEnter or @Advice.OnMethodExit- add @Advice.This as argument to such annotated advice methods and extract the interfaces from it.

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