[ Status ] 完成Agent Metric部分

This commit is contained in:
zeaslity
2023-07-10 16:29:22 +08:00
parent 2f477fd1cc
commit 6a34bfd6d2
3 changed files with 9 additions and 14 deletions

View File

@@ -147,16 +147,16 @@ public class OctopusAgentServiceImpl implements OctopusAgentService {
); );
// 构造结果 // 构造结果
OctopusMessageSynScReplayContend OctopusMessageSynScReplayContend = OctopusMessageSynScReplayContend.build( OctopusMessageSynScReplayContend octopusMessageSynScReplayContend = OctopusMessageSynScReplayContend.build(
ALL_HEALTHY_AGENT_TOPIC_NAME_LIST.size(), ALL_HEALTHY_AGENT_TOPIC_NAME_LIST.size(),
CurrentAppOctopusMessageType, CurrentAppOctopusMessageType,
currentTime currentTime
); );
CountDownLatch countDownLatch = OctopusMessageSynScReplayContend.getCountDownLatch(); CountDownLatch countDownLatch = octopusMessageSynScReplayContend.getCountDownLatch();
// 调用后台接收处理所有的Replay信息 // 调用后台接收处理所有的Replay信息
asyncWaitOctopusMessageResultService.waitFor(OctopusMessageSynScReplayContend); asyncWaitOctopusMessageResultService.waitFor(octopusMessageSynScReplayContend);
/* CompletableFuture<Void> getAllAgentCoreInfoFuture = waitCollectAllAgentCoreInfo( /* CompletableFuture<Void> getAllAgentCoreInfoFuture = waitCollectAllAgentCoreInfo(
result, result,
@@ -176,10 +176,10 @@ public class OctopusAgentServiceImpl implements OctopusAgentService {
// 超时,或者 全部信息已经收集 // 超时,或者 全部信息已经收集
// 此处调用,即可中断 异步任务的收集工作 // 此处调用,即可中断 异步任务的收集工作
asyncWaitOctopusMessageResultService.stopWaiting(OctopusMessageSynScReplayContend); asyncWaitOctopusMessageResultService.stopWaiting(octopusMessageSynScReplayContend);
// 处理结果 // 处理结果
OctopusMessageSynScReplayContend octopusMessageSynScReplayContend
.getReplayOMList() .getReplayOMList()
.stream() .stream()
.forEach( .forEach(
@@ -207,7 +207,7 @@ public class OctopusAgentServiceImpl implements OctopusAgentService {
); );
// help gc // help gc
OctopusMessageSynScReplayContend = null; octopusMessageSynScReplayContend = null;
} }
return result; return result;

View File

@@ -79,13 +79,8 @@ public class StatusController {
@PostMapping("/agent/status/update") @PostMapping("/agent/status/update")
public R<Map<String, List<String>>> ManualUpdateAgentStatus() { public R<Map<String, List<String>>> ManualUpdateAgentStatus() {
// 手动调用更新 // 暴露此部分 Status的核心代码
Map<String, Boolean> agentAliveStatusMap = syncStatusService.SyncCollectAgentAliveStatus( agentAliveStatusMonitorService.collectAllAgentAliveStatus();
ALL_AGENT_TOPIC_NAME_LIST,
5
);
agentAliveStatusMonitorService.updateAllAgentHealthyStatus(agentAliveStatusMap);
return R.ok(STATUS_AGENT_LIST_MAP); return R.ok(STATUS_AGENT_LIST_MAP);
} }

View File

@@ -23,7 +23,7 @@ public class BuildStatusScheduleTask {
@Value(value = "${octopus.status.healthy.start-delay}") @Value(value = "${octopus.status.healthy.start-delay}")
int healthyCheckStartDelaySeconds; int healthyCheckStartDelaySeconds;
@Value(value = "${octopus.status.metric.cron}") @Value(value = "${octopus.status.metric.cron}")
int metricReportCronExpress; String metricReportCronExpress;
@Value(value = "${octopus.status.metric.start-delay}") @Value(value = "${octopus.status.metric.start-delay}")
int metricReportStartDelaySeconds; int metricReportStartDelaySeconds;