@@ -84,7 +84,7 @@ public List<ServiceStatusInfos> getOptionalServices() {
84
84
// parallel health status check for all services marked as "optional: true" in application.yaml
85
85
List <CompletableFuture <ServiceStatusInfos >> results = remoteServicesProperties .getServices ().stream ()
86
86
.filter (RemoteServicesProperties .Service ::isOptional )
87
- .map (service -> asyncSelf .isServerUp (service ).thenApply (isUp -> ServiceStatusInfos .builder ()
87
+ .map (service -> asyncSelf .isOptionalServiceUp (service ).thenApply (isUp -> ServiceStatusInfos .builder ()
88
88
.name (service .getName ())
89
89
.status (Boolean .TRUE .equals (isUp ) ? ServiceStatus .UP : ServiceStatus .DOWN )
90
90
.build ()))
@@ -93,20 +93,28 @@ public List<ServiceStatusInfos> getOptionalServices() {
93
93
return results .stream ().map (CompletableFuture ::join ).toList ();
94
94
}
95
95
96
+ /**
97
+ * Check if an optional service is up and running.
98
+ * This method is specifically designed for optional services and uses debug-level logging
99
+ * to avoid polluting stdout with expected failures.
100
+ *
101
+ * @param service the optional service to check
102
+ * @return CompletableFuture<Boolean> true if service is UP, false otherwise
103
+ */
96
104
@ Async
97
- public CompletableFuture <Boolean > isServerUp (RemoteServicesProperties .Service service ) {
105
+ public CompletableFuture <Boolean > isOptionalServiceUp (RemoteServicesProperties .Service service ) {
98
106
try {
99
107
final String result = restTemplate .getForObject (service .getBaseUri () + "/actuator/health" , String .class );
100
108
final JsonNode node = objectMapper .readTree (result ).path (ACTUATOR_HEALTH_STATUS_JSON_FIELD );
101
109
if (node .isMissingNode ()) {
102
- LOGGER .error ("Cannot find {} json node while testing '{}'" , ACTUATOR_HEALTH_STATUS_JSON_FIELD , service .getName ());
110
+ LOGGER .debug ("Cannot find {} json node while testing '{}'" , ACTUATOR_HEALTH_STATUS_JSON_FIELD , service .getName ());
103
111
} else {
104
112
return CompletableFuture .completedFuture ("UP" .equalsIgnoreCase (node .asText ()));
105
113
}
106
114
} catch (RestClientException e ) {
107
- LOGGER .error ("Network error while testing " + service .getName (), e );
115
+ LOGGER .debug ("Network error while testing {}" , service .getName (), e );
108
116
} catch (JsonProcessingException e ) {
109
- LOGGER .error ("Json parsing error while testing " + service .getName (), e );
117
+ LOGGER .debug ("Json parsing error while testing {}" , service .getName (), e );
110
118
}
111
119
return CompletableFuture .completedFuture (false );
112
120
}
0 commit comments