Skip to content

Commit

Permalink
Polish health endpoint documentation for groups and nesting
Browse files Browse the repository at this point in the history
Closes gh-14022
  • Loading branch information
wilkinsona committed Sep 9, 2019
1 parent cd8fab8 commit 674d3dd
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@ include::{snippets}health/response-fields.adoc[]

[[health-retrieving-component]]
== Retrieving the Health of a component
To retrieve the health of a particular component of the application, make a `GET` request
to `/actuator/health/\{component}`, as shown in the following curl-based example:
To retrieve the health of a particular component of the application's health, make a
`GET` request to `/actuator/health/\{component}`, as shown in the following curl-based
example:

include::{snippets}health/component/curl-request.adoc[]

Expand All @@ -42,27 +43,32 @@ include::{snippets}health/component/http-response.adoc[]

[[health-retrieving-component-response-structure]]
=== Response Structure
The response contains details of the health of a particular component of the application.
The following table describes the structure of the response:
The response contains details of the health of a particular component of the
application's health. The following table describes the structure of the response:

[cols="2,1,3"]
include::{snippets}health/component/response-fields.adoc[]



[[health-retrieving-component-instance]]
== Retrieving the Health of a component instance
If a particular component consists of multiple instances (as the `broker` indicator in
the example above), the health of a particular instance of that component can be retrieved
by issuing a `GET` request to `/actuator/health/\{component}/\{instance}`, as shown in the
following curl-based example:
[[health-retrieving-component-nested]]
== Retrieving the Health of a nested component
If a particular component contains other nested components (as the `broker` indicator in
the example above), the health of such a nested component can be retrieved by issuing a
`GET` request to `/actuator/health/\{component}/\{subcomponent}`, as shown in the following
curl-based example:

include::{snippets}health/instance/curl-request.adoc[]

The resulting response is similar to the following:

include::{snippets}health/instance/http-response.adoc[]

Components of an application's health may be nested arbitrarily deep depending on the
application's health indicators and how they have been grouped. The health endpoint
supports any number of `/\{component}` identifiers in the URL to allow the health of a
component at any depth to be retrieved.



[[health-retrieving-component-instance-response-structure]]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,11 @@ void health() throws Exception {
.description("Status of a specific part of the application.");
FieldDescriptor componentDetails = subsectionWithPath("details.*.details")
.description("Details of the health of a specific part of the application. "
+ "Presence is controlled by `management.endpoint.health.show-details`.")
+ "Presence is controlled by `management.endpoint.health.show-details`. May contain nested "
+ "components that make up the health.")
.optional();
FieldDescriptor nestedComponents = subsectionWithPath("details.*.details")
.description("Nested components that make up the health.").optional();
this.mockMvc.perform(get("/actuator/health")).andExpect(status().isOk()).andDo(document("health",
responseFields(status, components, componentStatus, componentDetails, nestedComponents)));
this.mockMvc.perform(get("/actuator/health")).andExpect(status().isOk())
.andDo(document("health", responseFields(status, components, componentStatus, componentDetails)));
}

@Test
Expand Down

0 comments on commit 674d3dd

Please sign in to comment.