Creating an InstrumentationModule that requires external library #9126
Replies: 1 comment 4 replies
-
|
I think you should be using |
Beta Was this translation helpful? Give feedback.
-
|
I think you should be using |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello everyone,
I'm currently working on an
InstrumentationModulethat needs to be loaded as anExtension. One of myAdviceMethods is responsible for creating a JSON text, and I'd like to utilize thecom.google.gson.GsonJava library (or any other suitable library) for this purpose.The
build.gradlefile contains the following line:implementation("com.google.code.gson:gson:2.10.1"), ensuring that thecom.google.gsonlibrary exists within theextension.jar.However, I've encountered an issue. I'm struggling to make Opentelemetry inject the
Gsonlibrary into the application code. After reading the documentation, I tried using thegetAdditionalHelperClassNamesfunction. Unfortunately, sincecom.google.gsoncomprises multiple classes, usinggetAdditionalHelperClassNameswould require listing all Gson classes in the correct order, which I believe is not the optimal solution.Is there a way to inject the entire
com.google.gsonlibrary into the application code so that I can use it without explicit instrumentation?I did manage to make it work by adding the
com.google.comlibrary to theopentelemetry-javaagent. However, this solution isn't ideal for me as I prefer to use the originalopentelemetry-javaagentand add my code only as an extension.Any help would be greatly appreciated. Thank you!
Beta Was this translation helpful? Give feedback.
All reactions