When I do this, I see a log statement indicating that the apm server is up.
2020-02-05 00:24:42.648 [apm-server-healthcheck] INFO co.elastic.apm.agent.report.ApmServerHealthChecker - Elastic APM server is available: { "build_date": "2019-09-06T13:16:25Z", "build_sha": "ed1ac181088227b51686ac5affe8e4176a179ebf", "version": "7.3.2"}
2020-02-05 00:24:43.015 [main] INFO co.elastic.apm.agent.configuration.StartupInfo - Starting Elastic APM 1.12.0 as apm-demo-service on Java 1.8.0_45 (Oracle Corporation) Windows 8.1 6.3
But my spring boot application runs as a docker container and when I update entrypoint to use same java agent, it does not work. I initially thought that its not getting the jar file and hence causing the data not to be pushed to APM server. But that was not the case. I realized that the console logs do not show anything from co.elastic package.
I am using --net=host and hence the apm server access is not an issue.
Question is - is there any specific configuration I need to do make javaagent work with docker? Is there any port that I need to expose? Are there any volumes that I need by default?
Did I get you right that it works as expected when run from your Windows host but you have problems when trying to use the agent with Docker?
Seems like the agent is not applied at all then. Could you share your Docker setup, especially your entrypoint.
No special configuration is necessary, apart from attaching adding the -javaagent flag and the agent configuration. It's recommended to use environment variables to configure the agent (for example in docker-compose.yaml).
This is a working example of using the Java agent with Docker.
Thanks for your reply. Yes, its not working with docker. I tried changing the path of the jar file and I was hoping I will get Error occurred during initialization of VM agent library failed to init: instrument error. But the container was started without any issues.
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.