I watched a video where explained the actuators in spring boot like that "Instructor: In…
- User
I watched a video where explained the actuators in spring boot like that "Instructor: In this video,
we'll cover the Spring Boot Actuator.
So, here's the problem.
You may have the question,
how can I monitor and manage my application?
Also, how can I check the application status?
And finally, how can I access some application metrics?
Well, one solution here is by making use
of the Spring Boot Actuator.
So, the Spring Boot Actuator actually exposes endpoints
for you to monitor and manage your application.
So, you easily get the DevOps functionality out-of-the-box.
You simply add the dependency to your Maven POM file,
and then these REST endpoints are automatically added
to your application.
So, the nice thing about it is that there's no need
to write additional code, you get these new REST endpoints
for free, and I like free stuff.
So this is pretty cool.
Now, adding a dependency to the Maven POM file,
we simply give a reference here,
and we say spring-boot-starter-actuator.
And that'll basically give us support for these metrics
and monitoring of our given application.
Now remember, Spring Boot Actuator automatically exposes
endpoints for metrics out-of-the-box.
All of the endpoints are prefixed with /actuator.
Now, here are some of the endpoints that we can make use of.
So, we have /health.
This gives you health information about your application,
and there's some other endpoints that I'll talk about
in a bit.
And just remember, you get these new REST endpoints
for free, so again, there's no additional coding
you have to do, you simply add that item
to the actual Maven dependency for Spring Boot Actuator,
and you're ready to go.
So, now let's go ahead and start by taking a look
at the health endpoint.
So, the health endpoint, or /health,
checks the status of your application.
This is normally used by monitoring apps
to see if your application is up or down.
So, here's a little screenshot of our given application,
/actuator/health.
Right now the status is up.
Now, this health status is customizable,
so you can actually customize this
based on your own custom business logic.
Now, by default, only /health is exposed.
- Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.