menu
techminis

A naukri.com initiative

google-web-stories
Home

>

Programming News

>

Adding Hea...
source image

Medium

3w

read

191

img
dot

Image Credit: Medium

Adding Health Checks to Spring Boot with Custom Indicators

  • Spring Boot applications use the health indicator system to monitor the app's health without depending on manual checks.
  • Health indicators feed data into the /actuator/health endpoint, checking database, message broker, and file system status.
  • Spring Boot auto-configures health contributors based on the application context and classpath, like DataSourceHealthIndicator.
  • Contributors like DiskSpaceHealthIndicator, MongoHealthIndicator, etc., register based on their prerequisite beans' presence.
  • When a request hits /actuator/health, Spring combines all contributors' statuses into a JSON response.
  • Custom health indicators implementing HealthIndicator interface can be easily integrated into Spring Boot for tailored monitoring, such as checking external systems.
  • Profile-based activation and property control help in managing when custom indicators are active.
  • Spring Boot supports liveness and readiness checks through /actuator/health/liveness and /actuator/health/readiness endpoints.
  • Health checks communicating with remote services should use non-blocking calls like Spring's WebClient to avoid delays.
  • Spring Boot's health indicator structure integrates seamlessly with Actuator, automating health monitoring and reporting for better system monitoring.

Read Full Article

like

11 Likes

For uninterrupted reading, download the app