|
| 1 | +ifdef::env-github[] |
| 2 | +NOTE: For the best reading experience, |
| 3 | +please view this documentation at https://www.elastic.co/guide/en/apm/agent/java[elastic.co] |
| 4 | +endif::[] |
| 5 | + |
| 6 | +[[trouble-shooting]] |
| 7 | +== Troubleshooting |
| 8 | +Something isn't quite working as expected? |
| 9 | +Here are some guidelines how to find out what's going wrong. |
| 10 | + |
| 11 | +Don't worry if you can't figure out what the problem is. |
| 12 | +Open a topic in the https://discuss.elastic.co/c/apm:[APM discuss forum] |
| 13 | +and we will help you out. |
| 14 | +If you do so, please attach your debug logs so that we can analyze the problem. |
| 15 | + |
| 16 | +[float] |
| 17 | +[[trouble-shooting-logging]] |
| 18 | +=== Logging |
| 19 | +There are several <<config-logging, logging related configuration options>>. |
| 20 | +The most important one is <<config-logging-log-level>>. |
| 21 | +Set the log level to `DEBUG` or even `TRACE` to get more information about the behavior of the agent. |
| 22 | + |
| 23 | + |
| 24 | +[float] |
| 25 | +[[trouble-shooting-debugging]] |
| 26 | +=== Debugging |
| 27 | +Sometimes reading the logs is just not enough to debug a problem. |
| 28 | +As the agent is OpenSource and released on Maven Central, |
| 29 | +debugging the agent code is really easy. |
| 30 | + |
| 31 | +In order for your IDE to download the sources, |
| 32 | +first declare a dependency to the agent. |
| 33 | + |
| 34 | +NOTE: The agent is added via the `-javaagent` flag. |
| 35 | +So you have to make sure that you declare the dependency in a way that the agent is not on the classpath twice. |
| 36 | +For example, |
| 37 | +when you are developing a web application, |
| 38 | +make sure that the agent is not packaged in your war in `WEB-INF/lib`. |
| 39 | +In the debug window of your IDE, |
| 40 | +make sure that `elastic-apm-agent` does not appear in the `-classpath`. |
| 41 | + |
| 42 | +[source,xml] |
| 43 | +.pom.xml |
| 44 | +---- |
| 45 | +<dependency> |
| 46 | + <groupId>co.elastic.apm</groupId> |
| 47 | + <artifactId>elastic-apm-agent</artifactId> |
| 48 | + <version>${elastic-apm.version}</version> |
| 49 | + <scope>provided</scope> |
| 50 | +</dependency> |
| 51 | +---- |
| 52 | + |
| 53 | +NOTE: Even when setting the `scope` to `provided`, |
| 54 | +IntelliJ sometimes adds the agent on the classpath anyway. |
| 55 | +One workaround is to set the `scope` to `test`. |
| 56 | + |
| 57 | +[source,groovy] |
| 58 | +.build.gradle |
| 59 | +---- |
| 60 | +compileOnly "co.elastic.apm:elastic-apm-agent:$elasticApmVersion" |
| 61 | +---- |
| 62 | + |
| 63 | + |
| 64 | +[float] |
| 65 | +[[trouble-shooting-common-issues]] |
| 66 | +=== Common problems |
| 67 | + |
| 68 | +[float] |
| 69 | +[[trouble-shooting-no-data]] |
| 70 | +==== There is no data in the Kibana APM UI |
| 71 | + |
| 72 | +The most common source of this problem are connection issues between the agent and the APM server. |
| 73 | + |
| 74 | +If the APM server does not receive data from the agent, |
| 75 | +check if the agent is able to establish a connection to the server. |
| 76 | +In the agent logs, |
| 77 | +look out for logs containing `Elastic APM server is available` |
| 78 | +and `Elastic APM server is not available`. |
| 79 | + |
| 80 | +If you see the message `Elastic APM server is not available`, |
| 81 | +the agent has problems connecting to the APM server. |
| 82 | +Check the setting of <<config-server-url>> and make sure the agent is able to connect to the server. |
| 83 | +Try to execute `curl -v <apm-server-url>/healthcheck` from the machine the agent is running on. |
| 84 | +The server should respond with a 200 status code. |
| 85 | + |
| 86 | +If the APM server does not respond successfully, |
| 87 | +have a look at the APM server logs to verify that the server is actually running. |
| 88 | +Also make sure to configure your firewalls so that the host the agent runs on can open HTTP connections to the APM server. |
0 commit comments