Spring boot actuator provides some endpoints like health, metrics, info. It also allows us to write our own custom endpoints.
I have a requirement where I need to expose some Dropwizard metrics stats as an endpoint. Latest Spring-boot does support dropwizard metrics but it does not fit into my requirement, so I am planning to have my own web endpoint /stats
But now I am not able to decide whether it should be a normal Controller
or a custom actuator Endpoint
. What's the difference between these two terms?
PS: question does seem opinion base, but the answer should be simple enough.
Endpoints are a more specific or peculiar version of a Controller.
Rather than rely on a view (such as JSP) to render model data in HTML, an endpoint simply returns the data to be written directly to the body of the response(Similar to doing @ResponseBody in Controller).
Actuator Endpoint is a better option because of the following reasons :