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

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

Introduction

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

Prototype

public static Builder up() 

Source Link

Document

Create a new Builder instance with an Status#UP status.

Usage

From source file:io.ignitr.dispatchr.manager.health.HealthCheck.java

@Override
public Health doHealthCheck() {
    return Health.up().build();
}

From source file:com.javiermoreno.springboot.rest.CustomHealthIndicator.java

@Override
public Health health() {
    return Health.up().withDetail("ahoramismo", "est todo controlado.").build();
}

From source file:sample.actuator.SampleActuatorApplication.java

@Override
public Health health() {
    return Health.up().withDetail("hello", "world").build();
}

From source file:pl.java.scalatech.config.HealthConfig.java

@Bean
HealthIndicator myHealthIndicator() {/*from www  . j av a  2s.com*/
    return () -> {
        if (new Random().nextBoolean()) {
            return Health.up().status("ok").build();
        }
        return Health.down().status("problem").withDetail("my", "przodownik").build();
    };

}

From source file:com.netflix.spinnaker.kork.jedis.JedisHealthIndicatorFactory.java

public static HealthIndicator build(Pool<Jedis> jedisPool) {
    try {/*from  w  ww  .j  av a  2 s.  c  o  m*/
        final Pool<Jedis> src = jedisPool;
        final Field poolAccess = Pool.class.getDeclaredField("internalPool");
        poolAccess.setAccessible(true);
        GenericObjectPool<Jedis> internal = (GenericObjectPool<Jedis>) poolAccess.get(jedisPool);
        return () -> {
            Jedis jedis = null;
            Health.Builder health;
            try {
                jedis = src.getResource();
                if ("PONG".equals(jedis.ping())) {
                    health = Health.up();
                } else {
                    health = Health.down();
                }
            } catch (Exception ex) {
                health = Health.down(ex);
            } finally {
                if (jedis != null)
                    jedis.close();
            }
            health.withDetail("maxIdle", internal.getMaxIdle());
            health.withDetail("minIdle", internal.getMinIdle());
            health.withDetail("numActive", internal.getNumActive());
            health.withDetail("numIdle", internal.getNumIdle());
            health.withDetail("numWaiters", internal.getNumWaiters());

            return health.build();
        };
    } catch (IllegalAccessException | NoSuchFieldException e) {
        throw new BeanCreationException("Error creating Redis health indicator", e);
    }
}

From source file:de.msg.service.RouteServiceHealthIndicator.java

@Override
public Health health() {
    boolean serviceStatus = service.getServiceStatus();
    if (serviceStatus) {
        LOGGER.info("RouteService status: down");
        return Health.up().build();
    } else {//from www. j  a v a  2 s. co m
        LOGGER.warn("RouteService status: up");
        return Health.down().build();
    }
}

From source file:org.moneta.config.springboot.ActuatorHealthIndicator.java

public Health health() {

    Map<String, HealthCheck.Result> resultMap = healthCheckRegistry.runHealthChecks();
    HealthCheck.Result result;//from   ww w  . ja v a 2s.c om
    for (String checkName : resultMap.keySet()) {
        result = resultMap.get(checkName);
        if (!result.isHealthy()) {
            return Health.down().withDetail(checkName, result.toString()).build();
        }
    }

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

From source file:io.github.resilience4j.circuitbreaker.monitoring.health.CircuitBreakerHealthIndicator.java

@Override
public Health health() {
    return Optional.of(circuitBreaker).map(this::mapBackendMonitorState).orElse(Health.up().build());
}

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 ww  w. j  a  v  a 2 s. com*/
    return Health.up().build();
}

From source file:io.github.resilience4j.circuitbreaker.monitoring.health.CircuitBreakerHealthIndicator.java

private Health mapBackendMonitorState(CircuitBreaker circuitBreaker) {
    switch (circuitBreaker.getState()) {
    case CLOSED:/*ww w . j  a  va  2 s .  c  o m*/
        return addDetails(Health.up(), circuitBreaker).build();
    case OPEN:
        return addDetails(Health.down(), circuitBreaker).build();
    case HALF_OPEN:
        return addDetails(Health.unknown(), circuitBreaker).build();
    default:
        return addDetails(Health.unknown(), circuitBreaker).build();
    }
}