-
Notifications
You must be signed in to change notification settings - Fork 12
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 #38 from ruhan1/master-health
Add health checks
- Loading branch information
Showing
5 changed files
with
102 additions
and
4 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
24 changes: 24 additions & 0 deletions
24
src/main/java/org/commonjava/util/gateway/metrics/health/HeapHealthCheck.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,24 @@ | ||
package org.commonjava.util.gateway.metrics.health; | ||
|
||
import org.commonjava.util.gateway.metrics.honeycomb.JvmRootSpanFields; | ||
import org.eclipse.microprofile.health.HealthCheck; | ||
import org.eclipse.microprofile.health.HealthCheckResponse; | ||
import org.eclipse.microprofile.health.Liveness; | ||
|
||
import javax.enterprise.context.ApplicationScoped; | ||
import java.util.Map; | ||
import java.util.Optional; | ||
|
||
import static org.eclipse.microprofile.health.HealthCheckResponse.State.UP; | ||
|
||
@Liveness | ||
@ApplicationScoped | ||
public class HeapHealthCheck | ||
implements HealthCheck | ||
{ | ||
@Override | ||
public HealthCheckResponse call() | ||
{ | ||
return new HealthCheckResponse( "heap", UP, Optional.of( JvmRootSpanFields.getInstance().getHeapInfo() ) ); | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
src/main/java/org/commonjava/util/gateway/metrics/health/ThreadsHealthCheck.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,24 @@ | ||
package org.commonjava.util.gateway.metrics.health; | ||
|
||
import org.commonjava.util.gateway.metrics.honeycomb.JvmRootSpanFields; | ||
import org.eclipse.microprofile.health.HealthCheck; | ||
import org.eclipse.microprofile.health.HealthCheckResponse; | ||
import org.eclipse.microprofile.health.Liveness; | ||
|
||
import javax.enterprise.context.ApplicationScoped; | ||
import java.util.Optional; | ||
|
||
import static org.eclipse.microprofile.health.HealthCheckResponse.State.UP; | ||
|
||
@Liveness | ||
@ApplicationScoped | ||
public class ThreadsHealthCheck | ||
implements HealthCheck | ||
{ | ||
@Override | ||
public HealthCheckResponse call() | ||
{ | ||
return new HealthCheckResponse( "threads", UP, | ||
Optional.of( JvmRootSpanFields.getInstance().getThreadsInfo() ) ); | ||
} | ||
} |
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