-
-
Notifications
You must be signed in to change notification settings - Fork 13
implement startup readiness health checks #1284
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
GregJohnStewart
merged 6 commits into
Epic-Breakfast-Productions:development
from
axgiri:dev/1282-core-api-organize-readiness-healthchecks
Jun 8, 2026
Merged
Changes from 4 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
dee9d0a
implement startup readiness health checks
axgiri f4bff14
refactor(health): replace StatusProvider with typed health check inte…
axgiri 6096af9
Merge branch 'development' into dev/1282-core-api-organize-readiness-…
GregJohnStewart e91cdc6
refactor(health): update health check interfaces and improve readines…
axgiri 5e52bc9
function reference readability fix
axgiri b1375aa
add default constructors for health check classes
axgiri File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
...ware/core/oqm-core-api/src/main/java/tech/ebp/oqm/core/api/health/GenericHealthCheck.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| package tech.ebp.oqm.core.api.health; | ||
|
|
||
| import jakarta.enterprise.inject.Instance; | ||
| import org.eclipse.microprofile.health.HealthCheck; | ||
| import org.eclipse.microprofile.health.HealthCheckResponse; | ||
| import org.eclipse.microprofile.health.HealthCheckResponseBuilder; | ||
|
|
||
| import java.util.function.Function; | ||
|
|
||
| public class GenericHealthCheck<T> implements HealthCheck { | ||
| private final String healthCheckName; | ||
| private final Instance<T> providers; | ||
| private final Function<T, HealthStatus> statusGetter; | ||
|
|
||
| public GenericHealthCheck(String healthCheckName, Instance<T> providers, Function<T, HealthStatus> statusGetter) { | ||
| this.healthCheckName = healthCheckName; | ||
| this.providers = providers; | ||
| this.statusGetter = statusGetter; | ||
| } | ||
|
|
||
| @Override | ||
| public HealthCheckResponse call() { | ||
| HealthCheckResponseBuilder builder = HealthCheckResponse.named(this.healthCheckName); | ||
| boolean allUp = true; | ||
|
|
||
| for (T provider : this.providers) { | ||
| HealthStatus status = this.statusGetter.apply(provider); | ||
| boolean up = status.isUp(); | ||
| allUp &= up; | ||
| builder.withData(status.getName() + ".up", up); | ||
| builder.withData(status.getName() + ".status", status.getStatusMessage()); | ||
| } | ||
|
|
||
| return (allUp ? builder.up() : builder.down()).build(); | ||
| } | ||
| } | ||
24 changes: 24 additions & 0 deletions
24
software/core/oqm-core-api/src/main/java/tech/ebp/oqm/core/api/health/HealthStatus.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| package tech.ebp.oqm.core.api.health; | ||
|
|
||
| import lombok.Getter; | ||
|
|
||
| @Getter | ||
| public class HealthStatus { | ||
| private final String name; | ||
| private volatile boolean up = false; | ||
| private volatile String statusMessage = "Status not set"; | ||
|
|
||
| public HealthStatus(String name) { | ||
| this.name = name; | ||
| } | ||
|
|
||
| public void markUp(String message) { | ||
| up = true; | ||
| statusMessage = message; | ||
| } | ||
|
|
||
| public void markDown(String message) { | ||
| up = false; | ||
| statusMessage = message; | ||
| } | ||
| } |
|
axgiri marked this conversation as resolved.
Outdated
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
.../oqm-core-api/src/main/java/tech/ebp/oqm/core/api/health/service/LivenessHealthCheck.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| package tech.ebp.oqm.core.api.health.service; | ||
|
|
||
| import jakarta.enterprise.context.ApplicationScoped; | ||
| import jakarta.enterprise.inject.Instance; | ||
| import jakarta.inject.Inject; | ||
| import org.eclipse.microprofile.health.Liveness; | ||
| import tech.ebp.oqm.core.api.health.GenericHealthCheck; | ||
| import tech.ebp.oqm.core.api.health.utils.HasLivenessCheck; | ||
|
|
||
| @Liveness | ||
| @ApplicationScoped | ||
| public class LivenessHealthCheck extends GenericHealthCheck<HasLivenessCheck> { | ||
|
|
||
| @Inject | ||
| LivenessHealthCheck(Instance<HasLivenessCheck> providers) { | ||
| super("Service Health - Liveness", providers, HasLivenessCheck::getLivenessStatus); | ||
| } | ||
| } |
18 changes: 18 additions & 0 deletions
18
...oqm-core-api/src/main/java/tech/ebp/oqm/core/api/health/service/ReadinessHealthCheck.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| package tech.ebp.oqm.core.api.health.service; | ||
|
|
||
| import jakarta.enterprise.context.ApplicationScoped; | ||
| import jakarta.enterprise.inject.Instance; | ||
| import jakarta.inject.Inject; | ||
| import org.eclipse.microprofile.health.Readiness; | ||
| import tech.ebp.oqm.core.api.health.GenericHealthCheck; | ||
| import tech.ebp.oqm.core.api.health.utils.HasReadinessCheck; | ||
|
|
||
| @Readiness | ||
| @ApplicationScoped | ||
| public class ReadinessHealthCheck extends GenericHealthCheck<HasReadinessCheck> { | ||
|
|
||
| @Inject | ||
| ReadinessHealthCheck(Instance<HasReadinessCheck> providers) { | ||
| super("Service Health - Readiness", providers, HasReadinessCheck::getReadinessStatus); | ||
| } | ||
| } |
18 changes: 18 additions & 0 deletions
18
...e/oqm-core-api/src/main/java/tech/ebp/oqm/core/api/health/service/StartupHealthCheck.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| package tech.ebp.oqm.core.api.health.service; | ||
|
|
||
| import io.quarkus.runtime.Startup; | ||
| import jakarta.enterprise.context.ApplicationScoped; | ||
| import jakarta.enterprise.inject.Instance; | ||
| import jakarta.inject.Inject; | ||
| import tech.ebp.oqm.core.api.health.GenericHealthCheck; | ||
| import tech.ebp.oqm.core.api.health.utils.HasStartupCheck; | ||
|
|
||
| @Startup | ||
| @ApplicationScoped | ||
| public class StartupHealthCheck extends GenericHealthCheck<HasStartupCheck> { | ||
|
|
||
| @Inject | ||
| StartupHealthCheck(Instance<HasStartupCheck> providers) { | ||
| super("Service Health - Startup", providers, HasStartupCheck::getStartupStatus); | ||
| } | ||
| } |
7 changes: 7 additions & 0 deletions
7
.../core/oqm-core-api/src/main/java/tech/ebp/oqm/core/api/health/utils/HasLivenessCheck.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| package tech.ebp.oqm.core.api.health.utils; | ||
|
|
||
| import tech.ebp.oqm.core.api.health.HealthStatus; | ||
|
|
||
| public interface HasLivenessCheck { | ||
| HealthStatus getLivenessStatus(); | ||
| } |
7 changes: 7 additions & 0 deletions
7
...core/oqm-core-api/src/main/java/tech/ebp/oqm/core/api/health/utils/HasReadinessCheck.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| package tech.ebp.oqm.core.api.health.utils; | ||
|
|
||
| import tech.ebp.oqm.core.api.health.HealthStatus; | ||
|
|
||
| public interface HasReadinessCheck { | ||
| HealthStatus getReadinessStatus(); | ||
| } |
7 changes: 7 additions & 0 deletions
7
...e/core/oqm-core-api/src/main/java/tech/ebp/oqm/core/api/health/utils/HasStartupCheck.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| package tech.ebp.oqm.core.api.health.utils; | ||
|
|
||
| import tech.ebp.oqm.core.api.health.HealthStatus; | ||
|
|
||
| public interface HasStartupCheck { | ||
| HealthStatus getStartupStatus(); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.