apm-agent-java
apm-agent-java copied to clipboard
Shortcut agent attach CLI discovery and run-as-user
Following up on https://github.com/elastic/apm-server/pull/8590:
- If the attacher CLI is invoked with only
--include-piddiscovery rules, there's no need for discovery and for applying discovery rules, only try to attach to the requests PIDs. If the attacher is not invoked in a--continuousmode, no need to even look whether this PID was encountered before. This avoids a lot of noise related to discovery, especially such that requires actual attachment for extracting data. - Add a
--switch-useroption to the attacher CLI, which defaults totrue, that makes it possible to shortcut the user registry andsuroute. Even though it is currently protected throughisCurrentUser(), this check may not work if we avoid the full JVM discovery (e.g. due to 1, where discovery is not required).
Checklist:
- [ ] if discovery rules only include
--include-pidrules, don't do any discovery, invoke BB attachment for the PID directly - [ ] add a
--switch-userconfig option that will default totrueand will be set by the APM Server integration tofalse, in which case the attacher will not do any user registry things and will not invoke a sub attacher process - [ ] verify that #2726 is resolved with this