How are the Call Time and Duration calculated for the CA API Gateway traces?

Document ID : KB000076422
Last Modified Date : 04/04/2018
Show Technical Document Details

This is a CA APM - CA Precision API Monitoring (APIM) Integration, which provides the ability to monitor performance of the CA API Gateway. One of the performance monitoring capabilities is to produce traces of the service (API) execution that can be displayed in CA APM as transaction traces.
What is the relationship between the Call time (ms) for and Duration in a service execution trace?

For example, this is what we see in the trace of one service, and the Call time (ms) is often larger than the Duration:

User-added image

Shouldn't the Duration attribute be the total execution time of the entire service?
CA Application Performance Management - CA Precision API Monitoring (APIM) Integration to monitor CA API Gateways
Below are the descriptions for each attributes:

Calls = Number of calls in each assertion Path (It could be asynchronous)
Call Time (ms) = Total time taken by the Number of Calls in each Path.
Duration = Sum of (Call Time (ms) / Calls) for all the Path within that trace.**

**Because the assertion calls within the same path can be asynchronous (happen at the same time), hence the duration only takes into account the Call Time taken for one single assertion call (averaged). See case comment for actual calculation examples.

Let's take the following service trace as example:

User-added image

1. Firstly, sort the Call Time in descending order so that only those with non-zero Call Time are included in the calculation. In this case, there are 13 in total.
2. Next, following the formula stated above, divide Call Time over Calls for each Path, and sum the output together:

(2176/1) + (122/1) + (32/64) + (32/64) + (15/1) + (8/16) + (8/16) +  (3/1) + 1 + 1 + 1 + 1 + 1
= 2176 + 122 + 0.5 + 0.5 + 15 + 0.5 + 0.5 + 3 + 5
= 2323 (2323ms Duration)

Additional Information:
CA Precision API Monitoring
CA APM: Benefits of Integrating with CA APIM