Skip to content

Commit 674d3dd

Browse files
committed
Polish health endpoint documentation for groups and nesting
Closes gh-14022
1 parent cd8fab8 commit 674d3dd

File tree

2 files changed

+20
-15
lines changed

2 files changed

+20
-15
lines changed

spring-boot-project/spring-boot-actuator-autoconfigure/src/main/asciidoc/endpoints/health.adoc

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,9 @@ include::{snippets}health/response-fields.adoc[]
2929

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

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

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

4344
[[health-retrieving-component-response-structure]]
4445
=== Response Structure
45-
The response contains details of the health of a particular component of the application.
46-
The following table describes the structure of the response:
46+
The response contains details of the health of a particular component of the
47+
application's health. The following table describes the structure of the response:
4748

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

5152

5253

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

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

6263
The resulting response is similar to the following:
6364

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

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

6773

6874
[[health-retrieving-component-instance-response-structure]]

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/documentation/HealthEndpointDocumentationTests.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,11 @@ void health() throws Exception {
7878
.description("Status of a specific part of the application.");
7979
FieldDescriptor componentDetails = subsectionWithPath("details.*.details")
8080
.description("Details of the health of a specific part of the application. "
81-
+ "Presence is controlled by `management.endpoint.health.show-details`.")
81+
+ "Presence is controlled by `management.endpoint.health.show-details`. May contain nested "
82+
+ "components that make up the health.")
8283
.optional();
83-
FieldDescriptor nestedComponents = subsectionWithPath("details.*.details")
84-
.description("Nested components that make up the health.").optional();
85-
this.mockMvc.perform(get("/actuator/health")).andExpect(status().isOk()).andDo(document("health",
86-
responseFields(status, components, componentStatus, componentDetails, nestedComponents)));
84+
this.mockMvc.perform(get("/actuator/health")).andExpect(status().isOk())
85+
.andDo(document("health", responseFields(status, components, componentStatus, componentDetails)));
8786
}
8887

8988
@Test

0 commit comments

Comments
 (0)