tristobal
tristobal

Reputation: 506

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.

Upvotes: 4

Views: 3495

Answers (1)

Jonathan JOhx
Jonathan JOhx

Reputation: 5978

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

Upvotes: 8

Related Questions