Skip to content

Commit 752135d

Browse files
committed
Document the process info contribution
Closes gh-45567
1 parent c99521f commit 752135d

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

spring-boot-project/spring-boot-actuator-autoconfigure/src/docs/antora/modules/api/pages/rest/actuator/info.adoc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,13 @@ The following table describes the structure of the `os` section of the response:
5656

5757
[cols="2,1,3"]
5858
include::partial$rest/actuator/info/response-fields-beneath-os.adoc[]
59+
60+
61+
62+
[[info.retrieving.response-structure.process]]
63+
==== Process Response Structure
64+
65+
The following table describes the structure of the `process` section of the response:
66+
67+
[cols="2,1,3"]
68+
include::partial$rest/actuator/info/response-fields-beneath-process.adoc[]

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/info/InfoEndpointDocumentationTests.java

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import org.springframework.boot.actuate.info.InfoContributor;
2929
import org.springframework.boot.actuate.info.InfoEndpoint;
3030
import org.springframework.boot.actuate.info.OsInfoContributor;
31+
import org.springframework.boot.actuate.info.ProcessInfoContributor;
3132
import org.springframework.boot.info.BuildProperties;
3233
import org.springframework.boot.info.GitProperties;
3334
import org.springframework.context.annotation.Bean;
@@ -54,7 +55,7 @@ class InfoEndpointDocumentationTests extends MockMvcEndpointDocumentationTests {
5455
void info() throws Exception {
5556
this.mockMvc.perform(get("/actuator/info"))
5657
.andExpect(status().isOk())
57-
.andDo(MockMvcRestDocumentation.document("info", gitInfo(), buildInfo(), osInfo()));
58+
.andDo(MockMvcRestDocumentation.document("info", gitInfo(), buildInfo(), osInfo(), processInfo()));
5859
}
5960

6061
private ResponseFieldsSnippet gitInfo() {
@@ -90,6 +91,15 @@ private FieldDescriptor osInfoField(String field, String desc) {
9091
.optional();
9192
}
9293

94+
private ResponseFieldsSnippet processInfo() {
95+
return responseFields(beneathPath("process"),
96+
fieldWithPath("pid").description("Process ID.").type(JsonFieldType.NUMBER),
97+
fieldWithPath("parentPid").description("Parent Process ID (or -1).").type(JsonFieldType.NUMBER),
98+
fieldWithPath("owner").description("Process owner.").type(JsonFieldType.STRING),
99+
fieldWithPath("cpus").description("Number of CPUs available to the process.")
100+
.type(JsonFieldType.NUMBER));
101+
}
102+
93103
@Configuration(proxyBeanMethods = false)
94104
static class TestConfiguration {
95105

@@ -124,6 +134,11 @@ OsInfoContributor osInfoContributor() {
124134
return new OsInfoContributor();
125135
}
126136

137+
@Bean
138+
ProcessInfoContributor processInfoContributor() {
139+
return new ProcessInfoContributor();
140+
}
141+
127142
}
128143

129144
}

0 commit comments

Comments
 (0)