Commit 674d3dd2 authored by Andy Wilkinson's avatar Andy Wilkinson

Polish health endpoint documentation for groups and nesting

Closes gh-14022
parent cd8fab84
......@@ -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[]
......@@ -42,20 +43,20 @@ 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[]
......@@ -63,6 +64,11 @@ 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]]
......
......@@ -78,12 +78,11 @@ class HealthEndpointDocumentationTests extends MockMvcEndpointDocumentationTests
.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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment