[Hotfix] 修复新接入集群时,健康状态信息页面出现空指针问题

This commit is contained in:
zengqiao
2022-10-31 14:55:22 +08:00
parent 55d5fc4bde
commit 81910d1958

View File

@@ -84,16 +84,16 @@ public class MultiClusterPhyManagerImpl implements MultiClusterPhyManager {
ClusterPhysHealthState physState = new ClusterPhysHealthState(clusterPhyList.size()); ClusterPhysHealthState physState = new ClusterPhysHealthState(clusterPhyList.size());
for (ClusterPhy clusterPhy: clusterPhyList) { for (ClusterPhy clusterPhy: clusterPhyList) {
ClusterMetrics metrics = clusterMetricService.getLatestMetricsFromCache(clusterPhy.getId()); ClusterMetrics metrics = clusterMetricService.getLatestMetricsFromCache(clusterPhy.getId());
Integer state = metrics.getMetric(ClusterMetricVersionItems.CLUSTER_METRIC_HEALTH_STATE).intValue(); Float state = metrics.getMetric(ClusterMetricVersionItems.CLUSTER_METRIC_HEALTH_STATE);
if (state == null) { if (state == null) {
physState.setUnknownCount(physState.getUnknownCount() + 1); physState.setUnknownCount(physState.getUnknownCount() + 1);
} else if (state.equals(HealthStateEnum.GOOD.getDimension())) { } else if (state.intValue() == HealthStateEnum.GOOD.getDimension()) {
physState.setGoodCount(physState.getGoodCount() + 1); physState.setGoodCount(physState.getGoodCount() + 1);
} else if (state.equals(HealthStateEnum.MEDIUM.getDimension())) { } else if (state.intValue() == HealthStateEnum.MEDIUM.getDimension()) {
physState.setMediumCount(physState.getMediumCount() + 1); physState.setMediumCount(physState.getMediumCount() + 1);
} else if (state.equals(HealthStateEnum.POOR.getDimension())) { } else if (state.intValue() == HealthStateEnum.POOR.getDimension()) {
physState.setPoorCount(physState.getPoorCount() + 1); physState.setPoorCount(physState.getPoorCount() + 1);
} else if (state.equals(HealthStateEnum.DEAD.getDimension())) { } else if (state.intValue() == HealthStateEnum.DEAD.getDimension()) {
physState.setDeadCount(physState.getDeadCount() + 1); physState.setDeadCount(physState.getDeadCount() + 1);
} else { } else {
physState.setUnknownCount(physState.getUnknownCount() + 1); physState.setUnknownCount(physState.getUnknownCount() + 1);