use of com.alibaba.nacos.spring.metadata.NacosServiceMetaData in project nacos-spring-boot-project by nacos-group.
the class NacosConfigHealthIndicator method doHealthCheck.
@Override
protected void doHealthCheck(Health.Builder builder) throws Exception {
builder.up();
NacosServiceFactory nacosServiceFactory = CacheableEventPublishingNacosServiceFactory.getSingleton();
for (ConfigService configService : nacosServiceFactory.getConfigServices()) {
if (configService instanceof NacosServiceMetaData) {
NacosServiceMetaData nacosServiceMetaData = (NacosServiceMetaData) configService;
Properties properties = nacosServiceMetaData.getProperties();
builder.withDetail(JacksonUtils.toJson(PropertiesUtils.extractSafeProperties(properties)), configService.getServerStatus());
}
if (!configService.getServerStatus().toLowerCase().equals(UP_STATUS)) {
builder.down();
}
}
}
use of com.alibaba.nacos.spring.metadata.NacosServiceMetaData in project nacos-spring-boot-project by nacos-group.
the class NacosDiscoveryHealthIndicator method doHealthCheck.
@Override
protected void doHealthCheck(Health.Builder builder) throws Exception {
builder.up();
NacosServiceFactory nacosServiceFactory = CacheableEventPublishingNacosServiceFactory.getSingleton();
for (NamingService namingService : nacosServiceFactory.getNamingServices()) {
if (namingService instanceof NacosServiceMetaData) {
NacosServiceMetaData nacosServiceMetaData = (NacosServiceMetaData) namingService;
Properties properties = nacosServiceMetaData.getProperties();
builder.withDetail(JacksonUtils.toJson(PropertiesUtils.extractSafeProperties(properties)), namingService.getServerStatus());
}
if (!namingService.getServerStatus().equalsIgnoreCase(UP_STATUS)) {
builder.down();
}
}
}
Aggregations