This repository has been archived by the owner on Aug 18, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from alb2k/develop
v1.0.7
- Loading branch information
Showing
6 changed files
with
121 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
@@ -1,2 +1,4 @@ | ||
target/* | ||
docker/* | ||
assets/* | ||
docs/* | ||
.github/* |
This file contains 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 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
19 changes: 19 additions & 0 deletions
19
src/main/java/hackathon/microstream/service/system/health/LivenessHealthCheck.java
This file contains 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,19 @@ | ||
package hackathon.microstream.service.system.health; | ||
|
||
import org.eclipse.microprofile.health.HealthCheck; | ||
import org.eclipse.microprofile.health.HealthCheckResponse; | ||
import org.eclipse.microprofile.health.Liveness; | ||
|
||
import javax.enterprise.context.ApplicationScoped; | ||
|
||
/** | ||
* Checks if the app is alive | ||
*/ | ||
@Liveness | ||
@ApplicationScoped | ||
public class LivenessHealthCheck implements HealthCheck { | ||
@Override | ||
public HealthCheckResponse call() { | ||
return HealthCheckResponse.up("liveness"); | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
src/main/java/hackathon/microstream/service/system/health/ReadinessHealthCheck.java
This file contains 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,42 @@ | ||
package hackathon.microstream.service.system.health; | ||
|
||
import hackathon.microstream.storage.DBManager; | ||
import org.eclipse.microprofile.health.HealthCheck; | ||
import org.eclipse.microprofile.health.HealthCheckResponse; | ||
import org.eclipse.microprofile.health.Readiness; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
import javax.enterprise.context.ApplicationScoped; | ||
|
||
/** | ||
* Checks if the app is ready (for traffic) | ||
*/ | ||
@Readiness | ||
@ApplicationScoped | ||
public class ReadinessHealthCheck implements HealthCheck { | ||
|
||
private static final Logger LOG = LoggerFactory.getLogger(ReadinessHealthCheck.class); | ||
|
||
@Override | ||
public HealthCheckResponse call() { | ||
|
||
boolean up = DBManager.getInstance().isReady(); | ||
|
||
var builder = HealthCheckResponse.builder() | ||
.name("storage") | ||
.withData("demoMode", DBManager.getInstance().isDemoMode()) | ||
.state(up); | ||
|
||
if(up) { | ||
var storageManagerDetails = DBManager.getInstance().getStorageManagerDetails(); | ||
builder.withData("storageManager.name", storageManagerDetails.getName()); | ||
builder.withData("storageManager.active", storageManagerDetails.isActive()); | ||
builder.withData("storageManager.initializationTime", storageManagerDetails.getInitializationTime()); | ||
builder.withData("storageManager.initializationDuration", storageManagerDetails.getInitializationDuration()); | ||
builder.withData("storageManager.operationModeTime", storageManagerDetails.getOperationModeTime()); | ||
} | ||
|
||
return builder.build(); | ||
} | ||
} |
This file contains 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