Agent class loader is not loading custom instrumentation classes #7769
-
I want to make a minor change to grpc server and client auto instrumentation rules. I want to prefix I have overriden I built the agent, extracted the contents of agent and verified that the new classes are shaded and placed in correct location besides But agent class loader is not able to load
However, if I override Grpc instrumentation code: https://github.com/open-telemetry/opentelemetry-java-instrumentation/tree/main/instrumentation/grpc-1.6/library/src/main/java/io/opentelemetry/instrumentation/grpc/v1_6 Am I missing anything here? Could you help understand why this is not working? Please suggest. Thank you. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
At runtime these classes are injected into application class loader so it is not agent class loader but application class loader that fails loading your class. We use a custom gradle plugin named |
Beta Was this translation helpful? Give feedback.
At runtime these classes are injected into application class loader so it is not agent class loader but application class loader that fails loading your class. We use a custom gradle plugin named
muzzle
that among other things adds https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/muzzle/src/main/java/io/opentelemetry/javaagent/tooling/muzzle/InstrumentationModuleMuzzle.java toInstrumentationModule
classes and also implement the methods from that interface. One of these methods returns a list of classes that need to be defined in application class loader for this instrumentation. If you add a new class to the instrumentation that is not in this list it can't …