[ server ] [ status ]- fix bug

This commit is contained in:
zeaslity
2023-02-02 16:47:35 +08:00
parent 5aacdae89b
commit 2fe8b8526f
3 changed files with 67 additions and 16 deletions

View File

@@ -161,15 +161,17 @@ public class MonitorAllAgentStatus {
private void updateAllAgentHealthyStatus() {
List statusList = redisTemplate
.opsForHash()
.multiGet(
ALL_AGENT_STATUS_REDIS_KEY,
ALL_AGENT_TOPIC_NAME_LIST
);
// current log to console is ok
// agent-topic-name : STATUS(healthy, failed, unknown)
// 结构保存为agentStatusMap ==> agent-topic-name : STATUS(healthy, failed, unknown)
HashMap<String, String> agentStatusMap = new HashMap<>(32);
for (int i = 0; i < ALL_AGENT_TOPIC_NAME_LIST.size(); i++) {
agentStatusMap.put(
@@ -227,17 +229,32 @@ public class MonitorAllAgentStatus {
allHealthyAgentTopicNames.add(ALL_AGENT_TOPIC_NAME_LIST.get(i));
}
}
// 缓存相应的存活Agent
ALL_HEALTHY_AGENT_TOPIC_NAMES = allHealthyAgentTopicNames;
// 执行Metric上报任务
buildStatusScheduleTask.buildAgentMetricScheduleTask();
// init the healthy map
// 需要将所有的Agent的状态置为 "0"
ALL_AGENT_TOPIC_NAME_LIST
.stream()
.forEach(
agentTopicName -> {
AGENT_HEALTHY_INIT_MAP.put(
agentTopicName,
"0"
);
}
);
// update time
AGENT_HEALTHY_INIT_MAP.put(
"updateTime",
currentTimeString
);
// init the healthy map
redisTemplate
.opsForHash()
.putAll(