-
Notifications
You must be signed in to change notification settings - Fork 882
java jni invoke tracing #7116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hey @open-telemetry/java-maintainers, can you take a look here please? Is this something that the Java implementation of OpenTelemetry is already addressing and you can provide @fidoooooowang with some guidance around it? Or is this something you think is more generic (if we swap out Java + C++ here for any other language), and it needs to be treated at the spec level? |
hi @fidoooooowang! you might find https://www.elastic.co/observability-labs/blog/continuous-profiling-distributed-tracing-correlation interesting, particularly this part:
(cc @JonasKunz) |
You can find the relevant code for the blogpsot linked by @trask here and here. However, if you control the JNI layer or have access to a
I think those approaches are much simpler, but weren't applicable in our eBPF-usecase. |
I'm not familiar with c++ and it's my first time trying to use jni. After briefly reading the solution provided above, can I understand, assuming that my Java service call calls c++ sdk through jni, if the Java service uses elastic-otel-java's javaagnet. The c++ sdk uses opentelemetry-sdk. I can set some variables through the JvmtiAccess class in the Java service. Can I access these data in the c++ sdk and then use it to create a trace event? Is there any relevant c++ demo? Is my understanding correct? @JonasKunz |
No, I don't think you should be using the elastic Otel distro just because of you C++ use-case. I was just pointing to the code for you to get some inspiration on how to solve your problem. I think the best thing for you to do would be too lookup how to invoke Java from JNI (via |
What are you trying to achieve?
I have a doubt now. Suppose I use jni in a Java program to call a c++ sdk written by myself. At the same time, the relevant opentelemetry SDK is connected to the Java application and C++ SDK to report trace data. How can I combine the span generated in the Java program with the span generated in the C++ program? I don't really want to use the method of passing parameters to transparently pass the traceId and spanId generated in the Java program to the c++ sdk. Is there any other way?
Additional context.
Add any other context about the problem here. If you followed an existing documentation, please share the link to it.
The text was updated successfully, but these errors were encountered: