Original install method (e.g. download page, yum, deb, from source, etc.) and version:
It`s a test environment on my laptop.
APM-Server, EL and Kibana running via docker-compose
Java-Agent installed by "apm-agent-attach-1.7.0.jar"
Fresh install or upgraded from other version?: Fresh
Is there anything special in your setup? For example, are you using the Logstash or Kafka outputs? Are you using a load balancer in front of the APM Servers? Have you changed index pattern, generated custom templates, changed agent configuration etc.
No
Description of the problem including expected versus actual behavior. Please include screenshots (if relevant):
The application is a spring-boot sample with one Controller and two post methods.
I attach the agent using "apm-agent-attach-1.7.0.jar'" with the pid.
Everything ok with the attach process.
My Question is: Is it possible to detach the agent from target application without restart it?
That is currently not possible but we have ideas how to add that in the future. However, you can dynamically set active to false to disable the agent at runtime. Does that work for you?
No, that wouldn't be the way.
Actually, I am not aware of a convenient way to do that...
The way to dynamically change configurations, like active, is through the elaticapm.properties configuration file, which should be located alongside the agent jar on the same directory. When using the remote attach option, like you do, the attach process puts a temporary agent jar file in a temp folder. If you can locate the temp folder it is placed at (eg echo $TMPDIR in macOS), you can put the configuration file there and do it through there, but of course this will be subject to the temp dir maintenance policy of the OS.
Another hackish option is to add endpoints to your application, like /deactivate and /activate in which you can set the related system property, for example:
For the scenarios where we have full control of the application, we can use -javaagent.
But we have some exceptions scenarios (legacy apps of our customers) that we can use only the remote attach option.
Your idea about add endpoints like /deactivate and /activate could be a viable solution, if we can customize the agent injecting a servlet to expose the resources.
What about adding a config option that tells the agent where the properties file is located, then use a constant location for the file? Would that help? This means you still need to access the server and modify the file. How useful is that?
And just out of curiosity- how high would you rank the importance of such switch-off option? Or, in other words- how problematic is restarting the application when you want to stop tracing?
BTW, we are working now on adding a mechanism that will allow configuring the agents through the APM UI. In the first version (of which release is not yet determined) this will only include the transaction_sample_rate, which not exactly what you want, but mostly. I definitely see the ability to turn active to false one that should follow.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.