Reputation: 57
I have implemented an API in Spring Boot which does all the RESTful calls successfully.
As an extra credit part of the assignment, I am required to track response time of all the calls to the RESTful service and be able to visualise the data on a line graph.
They suggested using grafana which I have downloaded.
I'm just not sure on how I would be able to track the response time of each call
Upvotes: 2
Views: 6172
Reputation: 375
The response time can easily be tracked using the chrome debugger.
If you want to compute the response time programmatically then it may be achieved by using the
System.currentTimeMillis()
method.
The following pseudo snippet may be helpful.
long beginTime = System.currentTimeMillis();
//your code to call the rest api
long responseTime = System.currentTimeMillis() - beginTime;
Upvotes: 4