Skip to content

Rework health response structure so that indicator or detail named status cannot clash #10249

Closed
@wilkinsona

Description

@wilkinsona

if you have a bean named statusHealthIndicator (a bit contrived) or you add a detail named status (much more likely) then bad things happen:

{
 "status" : "UP",
 "diskSpace" : {
   "status" : "UP",
   "total" : 499046809600,
   "free" : 126894542848,
   "threshold" : 10485760
 },
 "dataSource" : {
   "status" : "UP",
   "database" : "HSQL Database Engine",
   "hello" : 1
 },
 "status" : {
   "status" : "UP",
   "status" : "Oops"
 }
}

Note the duplicate status keys at both levels.

The possibility of clashes could be removed by separating the details (aggregated indicators or individual health details):

{
  "status" : "UP",
  "details" : {
    "diskSpace" : {
      "status" : "UP",
      "details" : {
        "total" : 499046809600,
        "free" : 126893486080,
        "threshold" : 10485760
      }
    },
    "dataSource" : {
      "status" : "UP",
      "details" : {
        "database" : "HSQL Database Engine",
        "hello" : 1
      }
    },
    "status" : {
      "status" : "UP",
      "details" : {
        "status" : "Oops"
      }
    }
  }
}

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions