APM Transaction - CUSTOM Tab

Hello,

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?

apm_tag_tab

Thanks,
Zenith

Hi and thanks for your question.

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?

Thanks,
Felix

Hi Felix,

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:

`https://www.elastic.co/guide/en/kibana/current/traces.html`

we are using elastic-apm-agent-1.4.0.jar

Thank you for your help.

Thanks,
Zenith

Hi,

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)?

Thanks,
Eyal.

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:

Blockquote
if (parentId != null && traceId != null) {
String value = String.format(HEADER_FORMAT, traceId, parentId);
transaction = ElasticApm.startTransactionWithRemoteParent(new HeaderExtractor() {
@Override
public String getFirstHeader(String headerName) {
return value;
}
});
} else {
transaction = ElasticApm.startTransaction();
}

Blockquote

we want to see the distributed tracing for these two transaction created in two different services.

Thanks,
Zenith

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?

Thank you Eyal.

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.

{
"_index": "apm-6.6.1-2019.03.24",
"_type": "doc",
"_id": "OmS6rWkBOuTYrgln7xUd",
"_version": 1,
"_score": null,
"_source": {
"parent": {
"id": "b7ad6b7169203331"
},
"trace": {
"id": "0af7651916cd43dd8448eb211c80319c"
},
"@timestamp": "2019-03-24T03:24:58.666Z",
"host": {
"name": "XXXXXXXXX"
},
"beat": {
"hostname": "XXXXXXXXXX",
"name": "XXXXXXXXXX",
"version": "6.6.1"
},
"context

.....
....
...
"highlight": {
"trace.id": [
"@kibana-highlighted-field@0af7651916cd43dd8448eb211c80319c@/kibana-highlighted-field@"
]
},
"sort": [
1553397898666
]
}

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.