Example usage for org.springframework.boot.actuate.health Status Status

List of usage examples for org.springframework.boot.actuate.health Status Status

Introduction

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

Prototype

public Status(String code, String description) 

Source Link

Document

Create a new Status instance with the given code and description.

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 {//  w ww  . j av a 2 s . c  om
            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();
}