From 752135d06841d781a0b6bded9d3dbe293412d63a Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Tue, 20 May 2025 13:40:07 -0700 Subject: [PATCH] Document the process info contribution Closes gh-45567 --- .../modules/api/pages/rest/actuator/info.adoc | 10 ++++++++++ .../info/InfoEndpointDocumentationTests.java | 17 ++++++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/docs/antora/modules/api/pages/rest/actuator/info.adoc b/spring-boot-project/spring-boot-actuator-autoconfigure/src/docs/antora/modules/api/pages/rest/actuator/info.adoc index b55397d9a8b..4030bb1bdfb 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/docs/antora/modules/api/pages/rest/actuator/info.adoc +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/docs/antora/modules/api/pages/rest/actuator/info.adoc @@ -56,3 +56,13 @@ The following table describes the structure of the `os` section of the response: [cols="2,1,3"] include::partial$rest/actuator/info/response-fields-beneath-os.adoc[] + + + +[[info.retrieving.response-structure.process]] +==== Process Response Structure + +The following table describes the structure of the `process` section of the response: + +[cols="2,1,3"] +include::partial$rest/actuator/info/response-fields-beneath-process.adoc[] diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/info/InfoEndpointDocumentationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/info/InfoEndpointDocumentationTests.java index 3f744925adb..c1b5897f1eb 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/info/InfoEndpointDocumentationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/info/InfoEndpointDocumentationTests.java @@ -28,6 +28,7 @@ import org.springframework.boot.actuate.info.GitInfoContributor; import org.springframework.boot.actuate.info.InfoContributor; import org.springframework.boot.actuate.info.InfoEndpoint; import org.springframework.boot.actuate.info.OsInfoContributor; +import org.springframework.boot.actuate.info.ProcessInfoContributor; import org.springframework.boot.info.BuildProperties; import org.springframework.boot.info.GitProperties; import org.springframework.context.annotation.Bean; @@ -54,7 +55,7 @@ class InfoEndpointDocumentationTests extends MockMvcEndpointDocumentationTests { void info() throws Exception { this.mockMvc.perform(get("/actuator/info")) .andExpect(status().isOk()) - .andDo(MockMvcRestDocumentation.document("info", gitInfo(), buildInfo(), osInfo())); + .andDo(MockMvcRestDocumentation.document("info", gitInfo(), buildInfo(), osInfo(), processInfo())); } private ResponseFieldsSnippet gitInfo() { @@ -90,6 +91,15 @@ class InfoEndpointDocumentationTests extends MockMvcEndpointDocumentationTests { .optional(); } + private ResponseFieldsSnippet processInfo() { + return responseFields(beneathPath("process"), + fieldWithPath("pid").description("Process ID.").type(JsonFieldType.NUMBER), + fieldWithPath("parentPid").description("Parent Process ID (or -1).").type(JsonFieldType.NUMBER), + fieldWithPath("owner").description("Process owner.").type(JsonFieldType.STRING), + fieldWithPath("cpus").description("Number of CPUs available to the process.") + .type(JsonFieldType.NUMBER)); + } + @Configuration(proxyBeanMethods = false) static class TestConfiguration { @@ -124,6 +134,11 @@ class InfoEndpointDocumentationTests extends MockMvcEndpointDocumentationTests { return new OsInfoContributor(); } + @Bean + ProcessInfoContributor processInfoContributor() { + return new ProcessInfoContributor(); + } + } }