WSO2 APIM Correlating analytics event with correlationID

Sometimes it is required to correlate request, response in the gateway messages. This is required if you try to debug, monitor and analyse the messages. But this feature is not support APIM out of the box. But still you can use the APIM extension point to extract required information to implement custom monitoring mechanism. Also note that this CorrelationID is introduce to the event since APIM 2.2.0.

We can list down following use cases,

Analyse request/response messages

Analyse the request and fault, throttled requests

Troubleshoot apim analytics

Analyse the request path

correlationID is a UUID which is APIM introduced to the synapse context and it is a unique to the complete API request path. Which mean a request come to gateway can identify with UUID and it not get changed and will be consistent whether it is a faulty or throttled out. So it is easy to identify a request with it’s response path.

More importantly which can be used to identify the message attributes like headers and payload. But this is not possible to analyse with Analytics since those are not publisher to analyser. In such a cases it is better to analyse with gateway itself using tools available in the synapse like message ID, transaction ID or wire logs.

In order to analyse further with analyser correlationID is publish to the analyser. it is included into the all gateway to analyser events. Unfortunately this feature is not used any out of the box dashboards. But this is very useful if you have an idea to implement custom dashboards with a cumulative analytics event.

Here the sample request analytics event gateway publish to analyser. correlationID is include in the meta_clientType attribute as a json. And all other event used the same format to include correlationID.