Kibana version: 8.2.3
Elasticsearch version: 8.2.3
APM Server version: 8.2.3
APM Agent language and version: Java
Original install method : download page
Fresh install or upgraded from other version? : Fresh Install
Is there anything special in your setup? Changed the ports, also using secured network layer https.
I wanted to enable and disable the tracing of my application under test on demand. The agent is tracing the application through out the process till the application is up and running. I do not always need the traces but under some specific conditions only ill be needing the traces.
This is causing unnecessary traces when i do not want to trace the application. So the need is can i enable and disable the tracing whenever required without restarting the deployted application under test?
Please provide your inputs.
Thanks and regards,
Please check out the
instrument configuration options and see which better fits your needs. Both are documented as "dynamic", meaning that they can be changed at runtime.
The configuration methods that are marked as "dynamic" can be used for this purpose.
Of these, central configuration is probably the easiest to apply, but it only supports
instrument. In addition, you would need to start with
recording on in order for the service to show up in Kibana before you can create the agent policy for the first time.
If you want your custom API for this purpose, you can implement it by adding the API endpoint to your application and modify the corresponding System properties on demand.
Otherwise, you can use a configuration file and manually change it when needed.
I hope this helps.
Hi @Eyal_Koren ,
Thankyou for your inputs. I tried changing the configuration in run time and yes it is working. I used "recording" and "instrument" property in elasticApm.properties file.
I am having a scenario,
"I had deployed the apm-agent in another system lets say it is client system and elasticsearch and apm-server is installed on my server.
I have configured the client and server system properly as i can see the traces.
Now, when i have to enable/disable the traces, every time ill have to login to my client system and change the configuration file."
So, instead of configuration file changes, is there any api already present to call it from my server system or through postman i can hit and the api will do the configuration changes.
I am thinking if it is not already present, ill create a endpoint in apm-agent' source code and generate the jar. Once this jar is created, ill configure it as java agent in client system.
Also, is it as appropriate way to do the changes or do you have some suggestion on this?
The agent doesn't expose any APIs.
As I wrote above, using remote configuration is the most straightforward way to go.
If, for some reason, you cannot use that, you can rely on system properties and add an API to set/change them, however - why would you want to add it to the agent code? Since this is a system property, you can add it to your own code, which would probably be much simpler for you. The agent would just pick these changes from there.
The reason i want to add it in agent's code because agent is the only component that ill bw able to communicate with client's system because i don't have much exposure to client system.
This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.