OpenTelemetry Java Auto-Instrumentation for Custom Library Not Working #12996
-
|
I am trying to create auto-instrumentation for a custom library (MyLibrary) using OpenTelemetry Java Instrumentation. My goal is to generate traces for the method1() method in MyLibrary, which takes no parameters and writes to a file. I have created a Java agent and the following classes for instrumentation: MyLibraryInstrumentationModule MyLibrarySingletons MyLibraryInstrumentation Issue:
Debugging Steps I Tried:
Questions:
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 4 replies
-
|
You can check out related introduction about how to writing an instrumentation. If you can't any problem, please provide your repository that contains your code for us. |
Beta Was this translation helpful? Give feedback.
-
|
Instead of instrumenter().start(parentContext, "this is request from start");you should probably have context = instrumenter().start(parentContext, "this is request from start");
scope = context.makeCurrent();with your current code both |
Beta Was this translation helpful? Give feedback.
-
|
I found the issue. I gave Instrumentation name in the constructor. Thank you @laurit @steverao |
Beta Was this translation helpful? Give feedback.
I found the issue. I gave Instrumentation name in the constructor. Thank you @laurit @steverao