Calculating the response time of API call requests

Prerequisites:

For calculating the response of the API call requests, it is essential that the performance timer is enabled for the Canvas Studio application. To enable the performance timer for the Studio application, specify the performance timer threshold and performance timer threshold limit in the performanceLogger.properties file on the CTResource.JAR within the Studio Application WAR folder, (e.g. D:\Canvas\apache-tomcat-8.5.9\webapps\expertctstudio\WEB-INF\lib\CTResources.jar), as shown in the following sample code snippet:

#This is used to enable the threshold limit.
PERFORMANCE_TIMER_THRESHOLD=true
#This specifies the threshold limit of the performance timer
PERFORMANCE_TIMER_THRESHOLD_LIMIT=3000

To calculate the response time of API call requests, you can specify the performance timer attributes in an implementation java class file. You can provide your customized methods and logic validations in the java class file. The response time can be found in the ctperformance logs within the end application workfolder(e.g. Modelhouse) in your project (e.g. D:\Canvas\Modelhouse\logs). The following sample code snippet is provided as follows:

PerformanceTimer performanceTimer = new PerformanceTimer();
performanceTimer.startTimer("MyClassName.myMethodName");
// write your logic here
performanceTimer.endTimer();