Expose OS information as an InfoContributor

See gh-28907
This commit is contained in:
Jonatan Ivanov
2021-12-04 17:21:10 -08:00
committed by Stephane Nicoll
parent b9a7c2f179
commit c700f686c6
8 changed files with 210 additions and 2 deletions

View File

@@ -1169,13 +1169,18 @@ When appropriate, Spring auto-configures the following `InfoContributor` beans:
| Exposes Java runtime information.
| None.
| `os`
| {spring-boot-actuator-module-code}/info/OsInfoContributor.java[`OsInfoContributor`]
| Exposes Operating System information.
| None.
|===
Whether or not an individual contributor is enabled is controlled by its `management.info.<id>.enabled` property.
Different contributors have different defaults for this property, depending on their prerequisites and the nature of the information that they expose.
With no prerequisites to indicate that they should be enabled, the `env` and `java` contributors are disabled by default.
You can enable them by setting the configprop:management.info.env.enabled[] or configprop:management.info.java.enabled[] properties to `true`.
With no prerequisites to indicate that they should be enabled, the `env`, `java` and `os` contributors are disabled by default.
You can enable them by setting the configprop:management.info.env.enabled[], configprop:management.info.java.enabled[] or configprop:management.info.os.enabled[] properties to `true`.
The `build` and `git` info contributors are enabled by default.
Each can be disabled by setting its `management.info.<id>.enabled` property to `false`.
@@ -1266,6 +1271,12 @@ The `info` endpoint publishes information about your Java runtime environment, s
[[actuator.endpoints.info.os-information]]
==== OS Information
The `info` endpoint publishes information about your Operating System, see {spring-boot-module-api}/info/OsInfo.html[`OsInfo`] for more details.
[[actuator.endpoints.info.writing-custom-info-contributors]]
==== Writing Custom InfoContributors
To provide custom application information, you can register Spring beans that implement the {spring-boot-actuator-module-code}/info/InfoContributor.java[`InfoContributor`] interface.