Description of the problem including expected versus actual behavior. Please include screenshots (if relevant):
I have tomcat with serveral java web services (serveral war files) on it.
After setting up apm-agent in tomcat and apm-server, I can successfully send the data to kibana.
It all works well so far.
But when I need to get one of my war updated.
Here are my steps:
remove one war file from webapps, the other wars remains the same
send a new war (with the same name as the one I deleted) to webapps
I was unable to reproduce the behavior that you observed locally with the following configurations:
agent 1.17.0 + tomcat 8.5.54 + OpenJDK 8u242
agent 1.16.0 + tomcat 9.0.37 + OpenJDK 8u242
In agent debug logs:
there is no error while sending data to apm-server
sample rate is at default value, thus all transactions should be captured
I can't really pinpoint the time where the re-deploy happens
the transaction seems to be still created after re-deploy (and we can see some SQL queries spans), but there is only a few of them.
Thus I have few other questions:
is this issue limited to transactions ? for example, are other metrics (like JVM metrics) still sent to Kibana after re-deploy ?
did you tried with multiple requests after the re-deploy ? (sounds really obvious but I'd better be safe). For example, if there was previously 100 transactions/s, do you see none of them after re-deploy even waiting for a few minutes ?
does restarting the whole JVM makes it work again ?
Is JVM metrics stored in apm-7.6.1-metric-* index? In apm-7.6.1-metric-* index, I can only find data with service.name equals to "tomcat-application". And even after re-deployed, the data is consistently being sent to the index.
Yes. I did try multiple requests. But the log in the previous post, I only did a successful and a fail request to avoid too much log.
Yes. Restarting the JVM (Restarting tomcat) fixs the problem.
Following link is a animated gif that demonstrates how I reproduce the problem.
The configuration is agent 1.16.0 + tomcat 9.0.37 + OpenJDK 8u242.
The end of the log you uploaded clearly shows the agent still traces SpcAlphaParamController#getSpcAlpha after redeployment and it even seems as it sends these data.
So, my suspicion is that there is a problem related to the service name of the redeployed app.
Please try the followings and provide feedback:
Try setting agent's log_level to TRACE. This will print a lot of info, part of which is the full trace documents sent to the APM server. The communication with APM server relies on NDJSON, so please look for metadata JSONs sent before and after redeployment and upload them.
It seems that the agent is using the auto-discovered service name. Please try setting the service_name config and see if the problem is resolved.
I noticed a difference between the tranction logs being sent before and after redeploy.
Before redeploy, the json being sent to kibana consists service.name, "SPC-Service-1-0", which is an auto-dicovered service name. After data being sent to kibana, I can see the data in "SPC-Service-1-0" service.
After redeploy, service.name in the json was missing. (Probably it is a bug?!) After data being sent to kibana, I can see the data in "tomcat-application" service.
So No matter redeploy or not, the data is always being sent and can be received in kibana, but categorized in different service name.
Setting the service_name config solves the problem and makes the data always stay in the right service name.
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.