-
-
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 all 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
28 changes: 0 additions & 28 deletions
28
...ore/oqm-core-api/src/main/java/tech/ebp/oqm/core/api/health/SchemaUpgradeHealthCheck.java
This file was deleted.
Oops, something went wrong.
28 changes: 28 additions & 0 deletions
28
.../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,28 @@ | ||
| 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.utils.GenericHealthCheck; | ||
| import tech.ebp.oqm.core.api.health.utils.HasLivenessCheck; | ||
| import tech.ebp.oqm.core.api.health.utils.HealthStatus; | ||
|
|
||
| @Liveness | ||
| @ApplicationScoped | ||
| public class LivenessHealthCheck extends GenericHealthCheck<HasLivenessCheck> { | ||
|
|
||
| @Inject | ||
| LivenessHealthCheck(Instance<HasLivenessCheck> providers) { | ||
| super("Service Health - Liveness", providers); | ||
| } | ||
|
|
||
| public LivenessHealthCheck() { | ||
| super("Service Health - Liveness", null); | ||
| } | ||
|
|
||
| @Override | ||
| protected HealthStatus getStatus(HasLivenessCheck provider) { | ||
| return provider.getLivenessStatus(); | ||
| } | ||
| } |
28 changes: 28 additions & 0 deletions
28
...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,28 @@ | ||
| 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.utils.GenericHealthCheck; | ||
| import tech.ebp.oqm.core.api.health.utils.HasReadinessCheck; | ||
| import tech.ebp.oqm.core.api.health.utils.HealthStatus; | ||
|
|
||
| @Readiness | ||
| @ApplicationScoped | ||
| public class ReadinessHealthCheck extends GenericHealthCheck<HasReadinessCheck> { | ||
|
|
||
| @Inject | ||
| ReadinessHealthCheck(Instance<HasReadinessCheck> providers) { | ||
| super("Service Health - Readiness", providers); | ||
| } | ||
|
|
||
| public ReadinessHealthCheck() { | ||
| super("Service Health - Readiness", null); | ||
| } | ||
|
|
||
| @Override | ||
| protected HealthStatus getStatus(HasReadinessCheck provider) { | ||
| return provider.getReadinessStatus(); | ||
| } | ||
| } |
28 changes: 28 additions & 0 deletions
28
...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,28 @@ | ||
| 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.utils.GenericHealthCheck; | ||
| import tech.ebp.oqm.core.api.health.utils.HasStartupCheck; | ||
| import tech.ebp.oqm.core.api.health.utils.HealthStatus; | ||
|
|
||
| @Startup | ||
| @ApplicationScoped | ||
| public class StartupHealthCheck extends GenericHealthCheck<HasStartupCheck> { | ||
|
|
||
| @Inject | ||
| StartupHealthCheck(Instance<HasStartupCheck> providers) { | ||
| super("Service Health - Startup", providers); | ||
| } | ||
|
|
||
| public StartupHealthCheck() { | ||
| super("Service Health - Startup", null); | ||
| } | ||
|
|
||
| @Override | ||
| protected HealthStatus getStatus(HasStartupCheck provider) { | ||
| return provider.getStartupStatus(); | ||
| } | ||
| } |
34 changes: 34 additions & 0 deletions
34
...ore/oqm-core-api/src/main/java/tech/ebp/oqm/core/api/health/utils/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,34 @@ | ||
| package tech.ebp.oqm.core.api.health.utils; | ||
|
|
||
| import jakarta.enterprise.inject.Instance; | ||
| import org.eclipse.microprofile.health.HealthCheck; | ||
| import org.eclipse.microprofile.health.HealthCheckResponse; | ||
| import org.eclipse.microprofile.health.HealthCheckResponseBuilder; | ||
|
|
||
| public abstract class GenericHealthCheck<T extends HasHealthCheck> implements HealthCheck { | ||
| private final String healthCheckName; | ||
| private final Instance<T> providers; | ||
|
|
||
| public GenericHealthCheck(String healthCheckName, Instance<T> providers) { | ||
| this.healthCheckName = healthCheckName; | ||
| this.providers = providers; | ||
| } | ||
|
|
||
| protected abstract HealthStatus getStatus(T provider); | ||
|
|
||
| @Override | ||
| public HealthCheckResponse call() { | ||
| HealthCheckResponseBuilder builder = HealthCheckResponse.named(this.healthCheckName); | ||
| boolean allUp = true; | ||
|
|
||
| for (T provider : this.providers) { | ||
| HealthStatus status = this.getStatus(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(); | ||
| } | ||
| } |
3 changes: 3 additions & 0 deletions
3
...re/core/oqm-core-api/src/main/java/tech/ebp/oqm/core/api/health/utils/HasHealthCheck.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,3 @@ | ||
| package tech.ebp.oqm.core.api.health.utils; | ||
|
|
||
| public interface HasHealthCheck {} |
5 changes: 5 additions & 0 deletions
5
.../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,5 @@ | ||
| package tech.ebp.oqm.core.api.health.utils; | ||
|
|
||
| public interface HasLivenessCheck extends HasHealthCheck { | ||
| HealthStatus getLivenessStatus(); | ||
| } |
5 changes: 5 additions & 0 deletions
5
...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,5 @@ | ||
| package tech.ebp.oqm.core.api.health.utils; | ||
|
|
||
| public interface HasReadinessCheck extends HasHealthCheck { | ||
| HealthStatus getReadinessStatus(); | ||
| } |
5 changes: 5 additions & 0 deletions
5
...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,5 @@ | ||
| package tech.ebp.oqm.core.api.health.utils; | ||
|
|
||
| public interface HasStartupCheck extends HasHealthCheck { | ||
| HealthStatus getStartupStatus(); | ||
| } |
24 changes: 24 additions & 0 deletions
24
...ware/core/oqm-core-api/src/main/java/tech/ebp/oqm/core/api/health/utils/HealthStatus.java
|
axgiri marked this conversation as resolved.
|
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.utils; | ||
|
|
||
| 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) { | ||
|
axgiri marked this conversation as resolved.
|
||
| up = true; | ||
| statusMessage = message; | ||
| } | ||
|
|
||
| public void markDown(String message) { | ||
| up = false; | ||
| statusMessage = message; | ||
| } | ||
| } | ||
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.