Granulate / gprofiler

gProfiler is a system-wide profiler, combining multiple sampling profilers to produce unified visualization of what your CPU is spending time on.
https://profiler.granulate.io
Apache License 2.0
755 stars 55 forks source link

java: Support retrieving "java -version" for profiled processes which are not "java" basename #675

Closed Jongy closed 1 year ago

Jongy commented 1 year ago

As part of metadata collection, gProfiler collects the output of java -version for profiled Java application. This is doable when the target process is basenamed java - in that case we know that we can execute the same path with -version argument, and get the version.

However, since our process selection for Java processes is based on processes which have libjvm.so loaded (see JavaProfiler._select_processes_to_profile()), we stumble upon Java processes which are other executables loading libjvm.so. One of them is https://commons.apache.org/proper/commons-daemon/jsvc.html for example. These do not necessarily support -version, so we don't do the version check.

Proposed solutions:

Sites to fix