11package io .javaoperatorsdk .operator .springboot .starter ;
22
3+ import org .slf4j .Logger ;
4+ import org .slf4j .LoggerFactory ;
35import org .springframework .boot .actuate .health .AbstractHealthIndicator ;
46import org .springframework .boot .actuate .health .Health ;
57import org .springframework .stereotype .Component ;
@@ -12,6 +14,8 @@ public class OperatorHealthIndicator extends AbstractHealthIndicator {
1214
1315 private final Operator operator ;
1416
17+ private final static Logger log = LoggerFactory .getLogger (OperatorHealthIndicator .class );
18+
1519 public OperatorHealthIndicator (final Operator operator ) {
1620 super ("OperatorSDK health check failed" );
1721 Assert .notNull (operator , "OperatorSDK Operator not initialized" );
@@ -21,6 +25,7 @@ public OperatorHealthIndicator(final Operator operator) {
2125 @ Override
2226 protected void doHealthCheck (Health .Builder builder ) {
2327 final var runtimeInfo = operator .getRuntimeInfo ();
28+ log .debug ("Executing health check for {}" , runtimeInfo );
2429 if (runtimeInfo .isStarted ()) {
2530 final boolean [] healthy = {true };
2631 runtimeInfo .getRegisteredControllers ().forEach (rc -> {
@@ -33,12 +38,14 @@ protected void doHealthCheck(Health.Builder builder) {
3338 builder .withDetail (name , "unhealthy: " + String .join (", " , unhealthy .keySet ()));
3439 }
3540 });
41+ log .debug ("Healthy: {}" , healthy [0 ]);
3642 if (healthy [0 ]) {
3743 builder .up ();
3844 } else {
3945 builder .down ();
4046 }
4147 } else {
48+ log .debug ("Healthy: unknown" );
4249 builder .unknown ();
4350 }
4451 }
0 commit comments