Instrumentation Module not loaded when the extension is built as fat jar with Maven shade plugin #18780
-
|
It seems that I am observing a very strange issue when splitting my extension into multiple modules and building it as a fat JAR using the Maven Shade Plugin. In this setup, everything works fine. The agent log contains: For better modularity, I then split the single instrumentation project into separate projects, each containing instrumentation for only one library. So instead of a single Java project otel-test-ext, I now have two projects: The extension otel-test-ext_v2 is then built as a fat JAR using the Maven Shade Plugin, so that it contains all classes from both projects A and B. There is no “Loading instrumentation my-blib” log message. The com.my.otel.blib.BLibInstrumentationModule seems not being loaded. There are no apparent differences between otel-test-ext_v1.jar and otel-test-ext_v2.jar. The both files are of almost the same size, and have apparently the same .class. otel_agent_test_v1.log |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
|
|
Beta Was this translation helpful? Give feedback.
-
|
Thanks, |
Beta Was this translation helpful? Give feedback.
META-INF/services/io.opentelemetry.javaagent.extension.instrumentation.InstrumentationModuleis different between the two jars. If you are using gradle shadow plugin you can usemergeServiceFilesto merge the service files.