How to understand Java Agent source

I want to customer a ICE java agent plugin,but I don't understand the source of java agent. Example HelperClassManager,ElasticApmInstrumentation,can someone provider an document about how to use this.Thank you.

Hy @hyhong,
you can find cookbook here

or you can use Public api with which you can create own transactions and spans.

Hi @hyhong and @nugusbayevkk,

By default, agent is loaded in bootstrap classloader, which means for example that it can't access application classes like Servlet.

The HelperClassManager allows to load agent classes in a child classloader that does not have this limitation. While we don't have exhaustive documentation for its usage, you can definitely see how it's being used in other plugins, for example, the grpc-plugin could be a good example, https://github.com/elastic/apm-agent-java/tree/master/apm-agent-plugins/apm-grpc/apm-grpc-plugin/src/main/java/co/elastic/apm/agent/grpc/helper, thus doing something similar (including interface+implementation).

Also, we are currently working on a newer and simpler way to write plugins without the need to have such complex classloader delegation, thus hopefully it should be easier in a few weeks.

Ok,Thanks.

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