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

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

Introduction

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

Prototype

Status status

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

Click Source Link

Usage

From source file:org.springframework.cloud.client.discovery.health.DiscoveryClientHealthIndicator.java

@Override
public Health health() {
    Health.Builder builder = new Health.Builder();

    if (this.discoveryInitialized.get()) {
        try {//from  w w w  .  j ava  2 s.  co  m
            List<String> services = this.discoveryClient.getServices();
            String description = (this.properties.isIncludeDescription()) ? this.discoveryClient.description()
                    : "";
            builder.status(new Status("UP", description)).withDetail("services", services);
        } catch (Exception e) {
            log.error("Error", e);
            builder.down(e);
        }
    } else {
        builder.status(new Status(Status.UNKNOWN.getCode(), "Discovery Client not initialized"));
    }
    return builder.build();
}