elastic / apm-server

https://www.elastic.co/guide/en/apm/guide/current/index.html
Other
1.22k stars 523 forks source link

Java attacher support for macOS #8718

Open eyalkoren opened 2 years ago

eyalkoren commented 2 years ago

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

marclop commented 2 years ago

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 commented 2 years ago

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

eyalkoren commented 2 years ago

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.

simitt commented 2 years ago

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

simitt commented 2 years ago

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

eyalkoren commented 1 year ago

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.