Problem description
This is an improvement on #903 (external process execution instrumentation).
Starting from Java 9, there is a new API available for process execution ProcessHandle, which is not covered by #903.
As a result, any usage of this API will not result in spans be created.
Proposed solution
Instrument Process.toHandle() to wrap returned ProcessHandle instance.
Wrapped ProcessHandle should end current process span on those methods
ProcessHandle.destroy()
ProcessHandle.destroyForcibly()
ProcessHandle.onExit() > returns a CompletableFuture which should be wrapped and terminate span
This would also allow to use ProcessHandle.Info and capture program arguments, PID or other attributes.
Alternatively, we could also use CompletableFuture.thenApply(...) to chain a task that will terminate the process span.
Problem description
This is an improvement on #903 (external process execution instrumentation).
Starting from Java 9, there is a new API available for process execution
ProcessHandle, which is not covered by #903.As a result, any usage of this API will not result in spans be created.
Proposed solution
Instrument
Process.toHandle()to wrap returnedProcessHandleinstance.Wrapped
ProcessHandleshould end current process span on those methodsProcessHandle.destroy()ProcessHandle.destroyForcibly()ProcessHandle.onExit()> returns aCompletableFuturewhich should be wrapped and terminate spanThis would also allow to use
ProcessHandle.Infoand capture program arguments, PID or other attributes.Alternatively, we could also use
CompletableFuture.thenApply(...)to chain a task that will terminate the process span.