Expose only important attributes in ConsulHealthIndicator
This commit is contained in:
committed by
Spencer Gibb
parent
6fdd751256
commit
5941331814
@@ -27,6 +27,7 @@ import com.ecwid.consul.v1.ConsulClient;
|
||||
import com.ecwid.consul.v1.QueryParams;
|
||||
import com.ecwid.consul.v1.Response;
|
||||
import com.ecwid.consul.v1.agent.model.Self;
|
||||
import com.ecwid.consul.v1.agent.model.Self.Config;
|
||||
|
||||
/**
|
||||
* @author Spencer Gibb
|
||||
@@ -40,10 +41,17 @@ public class ConsulHealthIndicator extends AbstractHealthIndicator {
|
||||
protected void doHealthCheck(Health.Builder builder) throws Exception {
|
||||
try {
|
||||
Response<Self> self = consul.getAgentSelf();
|
||||
Config config = self.getValue().getConfig();
|
||||
Response<Map<String, List<String>>> services = consul
|
||||
.getCatalogServices(QueryParams.DEFAULT);
|
||||
builder.up().withDetail("services", services.getValue())
|
||||
.withDetail("agent", self.getValue());
|
||||
builder.up()
|
||||
.withDetail("services", services.getValue())
|
||||
.withDetail("advertiseAddress", config.getDomain())
|
||||
.withDetail("datacenter", config.getDatacenter())
|
||||
.withDetail("domain", config.getDomain())
|
||||
.withDetail("nodeName", config.getNodeName())
|
||||
.withDetail("bindAddress", config.getBindAddress())
|
||||
.withDetail("clientAddress", config.getClientAddress());
|
||||
}
|
||||
catch (Exception e) {
|
||||
builder.down(e);
|
||||
|
||||
Reference in New Issue
Block a user