0

Right now, I have a REST API built in SpringBoot. I also have a SpringBoot actuator to monitor the health of the app. I have some healthcheck services that either return an empty response with status code 200 or an error if one occurs. Now I would like to also be able to get the response time of the service together (or at least separately somehow) with the status. I can already see it in "/actuator/httptrace/" in the following form:

response: {
   status: 200,
   ...
}
timeTaken: 107

So ideally, I would like to be able to get exactly the same thing when I make a request to the api endpoint (just the code and timeTaken). Any help would be appreciated.

1 Answers1

2

Spring Boot provides metrics for you that will give you this information. There's no need to do it manually.

See the documentation here:

https://docs.spring.io/spring-boot/docs/current/reference/html/production-ready-features.html#production-ready-metrics-spring-mvc

PaulNUK
  • 4,774
  • 2
  • 30
  • 58