We are using APM to monitor our java application performance. We want to populate few additional attributes for a Transaction such that it appears in the CUSTOM tab? (we already populate tags)
Can you please let us know if the java api supports this?
We currently have some ongoing discussions whether we should deprecate custom context. That's why it's not added to the Java agent.
Could you explain why you feel the need of adding custom context? Why are tags not enough in your case? What does the data look like that you want to add to custom?
Thank you for the response. We are having multiple JVM running across multiple servers. A single transaction starts and ends from a , b and c servers. (Mostyly, each is one after the other. sometimes a transaction within the other but in different JVM).
We have created the transaction with the same name for all three. In APM dashboard, we see all the transaction in their respective dashboard. we want to see all the transaction from the three different servers into single timeline. As metioned in the below link we used the same transaction name:
I will be happy to try and assist, but I am not sure I understand your setup properly. Are a, b and c instances of the same service? Or are traces go through some of them for handling same requests (eg a is front tier that uses b and c for backend service)?
We have a UI service and a backend service running in two different servers. A Transaction is created in UI layer. also in the backend layer with the same transaction name and using the UI transaction's traceId and parentId as below:
The Transaction names in front and backend tier would typically be different as they need to reflect the specific event they are handling. A Trace will combine them together for the distributed tracing part. For more information, you can read about the data model we rely on.
I can't see your entire code, but it seems you are making a wrong use of the distributed tracing API- you normally shouldn't format the header string yourself, but rather get it through the communication layer. This code shows the usage of the startTransactionWithRemoteParent API on the receiver side, but on the sender side, you should use the injectTraceHeader API, which formats the right header to send through the communication protocol. Go through the documentation I linked above as it was updated with broader examples.
Just out of curiosity, what type of communication do you use between the front and back tiers?
We are using thrift call between services hence we do not have http request. i came across the above code sample. I noticed traceId is being used, hence i created the headerExtractor object using the traceId and parentId from the existing transaction which was already created in the different service.
private static final String HEADER_FORMAT = "00-%s-%s-01";
String parentId = existingTransaction.ensureParentId()
String traceId = existingTransaction.getTraceId()
String value = String.format(HEADER_FORMAT, traceId, parentId);
transaction = ElasticApm.startTransactionWithRemoteParent(new HeaderExtractor() { @Override
public String getFirstHeader(String headerName) {
return value;
}
});
i see in the apm transactions were created with the traceId and same parentId as expected.
Thanks fro haring the documentation. will take a look at it.
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.