Example usage for org.springframework.boot.actuate.health Health status

List of usage examples for org.springframework.boot.actuate.health Health status

Introduction

In this page you can find the example usage for org.springframework.boot.actuate.health Health status.

Prototype

Status status

To view the source code for org.springframework.boot.actuate.health Health status.

Click Source Link

Usage

From source file:com.ge.predix.acs.monitoring.UaaHealthIndicator.java

@Override
public Health health() {
    int errorCode = check(); // perform some specific health check
    if (errorCode != 0) {
        return Health.status(UAA_OUT_OF_SERVICE).withDetail("Error Code for UAA", errorCode).build();
    }//from w w  w .  j  ava2  s . c o  m
    return Health.up().build();
}

From source file:io.github.resilience4j.ratelimiter.monitoring.health.RateLimiterHealthIndicator.java

private Health rateLimiterHealth(Status status, int availablePermissions, int numberOfWaitingThreads) {
    return Health.status(status).withDetail("availablePermissions", availablePermissions)
            .withDetail("numberOfWaitingThreads", numberOfWaitingThreads).build();
}

From source file:com.ge.predix.acs.monitoring.AcsDBHealthIndicator.java

@Override
public Health health() {
    int errorCode = check(); // perform some specific health check
    if (errorCode != 0) {
        return Health.status(ACS_DB_OUT_OF_SERVICE).withDetail("Error Code for ACS DB", errorCode).build();
    }//from   ww  w  . j a  v  a2 s.  c  o m

    if (null != this.migrationManager && !this.migrationManager.isMigrationComplete()) {
        return Health.status(ACS_DB_MIGRATION_INCOMPLETE).withDetail("Migration not complete.", FAILED_CHECK)
                .build();
    }

    return Health.up().build();
}

From source file:io.jmnarloch.spring.cloud.zuul.ZuulRouteHealthIndicator.java

/**
 * Builds the Zuul routes health and maps it into aggregated health status.
 *
 * @param health the routes//from w w w  . ja v a  2 s .  c  om
 * @return the health information
 */
private Health build(ZuulRouteHealth health) {

    final Health.Builder builder = Health.status(health.getStatus());
    if (!health.getAvailable().isEmpty()) {
        builder.withDetail(AVAILABLE, health.getAvailable());
    }
    if (!health.getUnavailable().isEmpty()) {
        builder.withDetail(UNAVAILABLE, health.getUnavailable());
    }
    return builder.build();
}