You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/content/en/docs/documentation/operations/health-probes.md
+25-31Lines changed: 25 additions & 31 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,72 +17,69 @@ API.
17
17
|`isStarted()`|`true` once the operator and all its controllers have fully started |
18
18
|`allEventSourcesAreHealthy()`|`true` when every registered event source (informers, polling sources, etc.) reports a healthy status |
19
19
|`unhealthyEventSources()`| returns a map of controller name → unhealthy event sources, useful for diagnostics |
20
+
|`unhealthyInformerWrappingEventSourceHealthIndicator()`| returns a map of controller name → unhealthy informer-wrapping event sources, each exposing per-informer details via `InformerHealthIndicator` (`hasSynced()`, `isWatching()`, `isRunning()`, `getTargetNamespace()`) |
20
21
21
-
These map naturally to Kubernetes probes:
22
+
In most cases a single readiness probe backed by `allEventSourcesAreHealthy()` is sufficient: before the
23
+
operator has fully started the informers will not have synced yet, so the check naturally covers the startup
24
+
case as well. Once running, it detects runtime degradation such as a lost watch connection.
22
25
23
-
-**Startup probe** → `isStarted()` — fails until all informers have synced and the operator is ready to
24
-
reconcile.
25
-
-**Readiness probe** → `allEventSourcesAreHealthy()` — fails if an informer loses its watch connection
26
-
or any event source reports an unhealthy status.
26
+
### Fine-Grained Informer Diagnostics
27
27
28
-
## Setting Up Probe Endpoints
28
+
For advanced use cases — such as exposing per-informer health in a diagnostic endpoint or logging which
29
+
specific namespace lost its watch — `unhealthyInformerWrappingEventSourceHealthIndicator()` gives access to
30
+
individual `InformerHealthIndicator` instances. Each indicator exposes `hasSynced()`, `isWatching()`,
31
+
`isRunning()`, and `getTargetNamespace()`. This is typically not needed for a standard health probe but can
32
+
be valuable for operational dashboards or troubleshooting.
29
33
30
-
The example below uses [Jetty](https://eclipse.dev/jetty/) to expose health probe endpoints. Any HTTP
34
+
## Setting Up a Probe Endpoint
35
+
36
+
The example below uses [Jetty](https://eclipse.dev/jetty/) to expose a `/healthz` endpoint. Any HTTP
31
37
server library works — the key is calling the `RuntimeInfo` methods to determine the response code.
Copy file name to clipboardExpand all lines: sample-operators/operations/src/main/java/io/javaoperatorsdk/operator/sample/metrics/MetricsHandlingSampleOperator.java
Copy file name to clipboardExpand all lines: sample-operators/operations/src/main/java/io/javaoperatorsdk/operator/sample/metrics/ReadinessHandler.java
0 commit comments