I have an application which takes a very long time to startup(depending on the circumstances between 50 seconds and 5 minutes). Therefore, I have added code to instrument the startup(I have subclassed the Spring XmlWebApplicationContext and added @CaptureTransaction to the relevant methods like refresh). This worked - and is still working.
Now, I have upgraded the apm agent to the latest version and wanted to try the service name auto discovery to separate the applications within our Tomcat installation. I am aware that the Metrics are sent to the default service name(in my case tomcat-application) but I found that not only the metrics are being sent there - my startup transactions are stored there too. This is unfortunate for me because naturally, we would be looking in the application for the startup transaction.
My guess is that the apm agent does not know about the application as it is still starting - does anyone have an idea how to work around that?
Hmm, interesting issue... Initially, I was thinking that we could move the logic to determine the service name to the end of the transaction as opposed to the start. But that doesn't work as the service name is copied to each span of the transaction. As spans are sent right after the corresponding event occurs, we can't can't change the transaction's service name anymore.
As a workaround, could you add a custom label to the transaction?
The workaround with the labels would not a proper workaround. The startup transactions would still be in the tomcat-application service name, unfortunately. I currently can't think of any proper way. Even when using logstash or ingest pipelines, it probably wouldn't be doable as the spans are sent separately from their transactions.
I think what I was trying to ask is how severe that limitation is. It's definitely annoying and counter-intuitive that it's not listed in the same service but once you know where to look for these you get what you need, right?
Which service name auto-detection are you relying on? The <display-name> from web.xml or the spring.application.name from Spring's application.properties?
Yes, that is right and I will take this route if no other way can be found but I would still be glad to have another way.
Is there a possibility to set a label on a transaction which will be inherited by all spans so I could transfer them by logstash or ingest pipeline?
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.