Eclipse MicroProfile Health Check API
The Payara Platform 6.2024.9 provides MicroProfile HealthCheck 4.0
Background
The Health Check API was created to allow easier probing of the state of computing nodes that live in a cloud infrastructure environment.
The complete specification can be found on the Eclipse MicroProfile website.
Breaking changes introduced in MicroProfile Health 4.0 are listed in the official specification under Incompatible Changes
REST Endpoints
The MicroProfile HealthCheck API defines the following list of REST endpoints that are available from the root context at /health/${type}
by default:
Context | Type | Description |
---|---|---|
|
Liveness |
On invocation, all registered health checks annotated with |
|
Readiness |
On invocation, all registered health checks annotated with |
|
Startup |
On invocation, all registered health checks annotated with '@Startup' are performed and the results aggregated. |
|
Readiness + Liveness + Startup |
On invocation, all registered health checks annotated with |
On Payara Server, this root endpoint can be altered using the set-microprofile-healthcheck-configuration asadmin command to prevent collisions with other HTTP endpoints that might need to use the health context root.
|
This endpoint will not be available until at least one application has been deployed. |
Health Check Configuration
On Payara Server, the MicroProfile HealthCheck settings can be configured by using Admin Console or Asadmin commands.
Using the Admin Console
To configure the Health Check in the Admin Console, go to Configuration → [instance-configuration (like server-config
)] → MicroProfile → Health Check:
Using Asadmin Commands
The following administration commands can be used to configure the MicroProfile Healthcheck service:
Changes made with this command will only be applied when the server or instance is restarted. |
Security Configuration
By default, HealthCheck endpoints bind to the root context application which is the default-web-module
(also known as docroot) system application and the default-web-module
application, which is secured under the default realm (file
) of the server.
If a user application is deployed in the empty context-root, then the security configuration of this application will be shared by the HealthCheck endpoints, so exert extreme caution when making these changes.
Upgrading from Eclipse MicroProfile 3.x to 4.x
MicroProfile 4.0 brings with it a number of changes to MicroProfile Health. The main incompatible change brought in by this upgrade is the removal of the deprecated @Health
annotation.
There isn’t a workaround for this, the annotation is simply gone: all health checks must be registered as a @Readiness
, @Liveness
, or @Startup
check.