Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spring Boot Actuator Change the format of /health

Recently I update spring-boot-starter-actuator to 2.2.2 and when I consume the /health endpoint i got:

{
    "groups": [],
    "status": {
        "code": "UP",
        "description": ""
    }
}

instead of:

{
    "status": "UP"
}

And i don't have any clue the reason of this. Any idea? Or how I can refomat the output json to the original format? Not overwrite the HealthIndicator, only reformat.

Thanks in advance.

like image 820
tristobal Avatar asked Oct 15 '25 15:10

tristobal


1 Answers

Spring Actuator 2.2 Health Endpoint JSON documentation says:

The /actuator/health endpoint has changed the resulting JSON format by renaming details to components for the first-level elements. This helps to differentiate the actual details returned by a HealthIndicator from the component indicators that make up composite health.

As a result of the change, the actuator media type has been bumped from application/vnd.spring-boot.actuator.v2+json to application/vnd.spring-boot.actuator.v3+json. If you have tools that need to consume the older format, you can use an HTTP Accept: header with the V2 media type, application/vnd.spring-boot.actuator.v2+json.

In addition if you want to see all documentation related to health and what is groups ? how to custom the health indicator take a look the Current Health Information

like image 72
Jonathan JOhx Avatar answered Oct 18 '25 08:10

Jonathan JOhx



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!