Skip to content

Commit 18b5cc1

Browse files
Migrate to process info contributor
1 parent 437c52b commit 18b5cc1

File tree

2 files changed

+1
-14
lines changed

2 files changed

+1
-14
lines changed

src/main/java/resourceater/actuator/info/RuntimeInfoContributor.java

-14
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ public void contribute(Info.Builder builder) {
2929
);
3030

3131
builder.withDetail("runtime", Map.of(
32-
"memory", memoryInfo(),
33-
"cpu", cpuInfo(),
3432
"gcs", gcInfo(),
3533
"user", userInfo(),
3634
"network", networkInfo(),
@@ -40,18 +38,6 @@ public void contribute(Info.Builder builder) {
4038
);
4139
}
4240

43-
private Map<String, Object> memoryInfo() {
44-
return Map.of(
45-
"total", Runtime.getRuntime().totalMemory(),
46-
"max", Runtime.getRuntime().maxMemory(),
47-
"free", Runtime.getRuntime().freeMemory()
48-
);
49-
}
50-
51-
private Map<String, Object> cpuInfo() {
52-
return Map.of("availableProcessors", Runtime.getRuntime().availableProcessors());
53-
}
54-
5541
private List<Map<String, Object>> gcInfo() {
5642
return ManagementFactory.getGarbageCollectorMXBeans().stream()
5743
.map(this::toInfoObject)

src/main/resources/application.properties

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ management.endpoint.health.show-details=always
1111
management.info.env.enabled=true
1212
management.info.java.enabled=true
1313
management.info.os.enabled=true
14+
management.info.process.enabled=true
1415
management.observations.key-values.application=${spring.application.name}
1516
management.metrics.tags.application=${spring.application.name}
1617
management.metrics.distribution.percentiles-histogram.http.server.requests=true

0 commit comments

Comments
 (0)