2

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

1 Answer 1

4

The response time can easily be tracked using the chrome debugger. enter image description here

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;

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.