I am developing the Spring Boot API's.
Now comes the monitoring part. I want to add monitoring to it. So I used actuator, fetch data(like gc, memory etc) from it & plot it on Grafana.
Now comes the response time of API's. Actuator guage just return the last API Hit. So basically how do I calculate the response time of every API for evry hit. I mean where I should place
long startTime = System.currentTimeMillis(); and
long endTime = System.currentTimeMillis(); long diff = endTime - startTime; I have tried placing it on controller, 1st line of controller & last line of controller but the result is different when I am comparing it with Guage.
How should I correctly measure it?