apm-server icon indicating copy to clipboard operation
apm-server copied to clipboard

Java attacher support for macOS

Open eyalkoren opened this issue 3 years ago • 3 comments

The Java attacher discovery relies on go-sysinfo, which requires cgo for macOS, which is not built into APM Server. Optional alternatives:

  • enhance go-sysinfo to use sysctl for listing processes, similar to https://github.com/mitchellh/go-ps
  • implement discovery for darwin based on ps execution (we had this working already)
  • repackage cgo

eyalkoren avatar Jul 26 '22 12:07 eyalkoren

I've started looking into changing go-sysinfo to use a non cgo implementation to gather the required information for Darwin. It looks like the latest published tags for golang.org/x/sys expose a more complete API to perform sysctl and syscall without relying on cgo or syscall.syscall6 calls.

marclop avatar Aug 15 '22 01:08 marclop

I'm going to move this back to the Ready column as I haven't yet started implementing the necessary changes in go-sysinfo.

marclop avatar Aug 23 '22 06:08 marclop

Once the discovery part is handled, we will still need to adjust the per-user tmp dir copy. In macOS, the Go utility to create temp dir (or find tmp dir root) would return a path to a directory which is specific to the current user (i.e. the APM Server user). AFAIK, the functionality to run as a different user we already have in place is applicable to macOS, which means that we can run echo $TMPDIR as the target user and read the command output to reveal the user-specific temp folder.

eyalkoren avatar Aug 25 '22 15:08 eyalkoren

Tracking the removal of the technical blockers in https://github.com/elastic/apm-server/issues/9185

simitt avatar Sep 23 '22 13:09 simitt

Reopening until https://github.com/elastic/apm-server/issues/8718#issuecomment-1227416692 is addressed.

simitt avatar Oct 24 '22 12:10 simitt

MacOS is mostly supported now without relying on cgo. However, the process start time is not supported yet, so we'll need to find an alternative to identify a process instance, which currently relies on PID+start-time.

eyalkoren avatar Jan 22 '23 07:01 eyalkoren