From 98467f95900187ac89510fcac211d669f55e90ce Mon Sep 17 00:00:00 2001 From: zeaslity Date: Tue, 11 Jul 2023 16:52:31 +0800 Subject: [PATCH] =?UTF-8?q?[=20Status=20]=20=E5=AE=8C=E6=88=90Agent=20Metr?= =?UTF-8?q?ic=E9=83=A8=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- agent-go/rabbitmq/OctopusMessage.go | 2 +- .../status/AgentAliveStatusMonitorService.java | 11 +++++------ .../status/AgentMetricStatusCollectService.java | 6 +----- .../io/wdd/rpc/status/CommonAndStatusCache.java | 13 ++++++++----- .../java/io/wdd/rpc/status/beans/NetworkStatus.java | 2 +- server/src/main/resources/application.yml | 6 +++++- 6 files changed, 21 insertions(+), 19 deletions(-) diff --git a/agent-go/rabbitmq/OctopusMessage.go b/agent-go/rabbitmq/OctopusMessage.go index 9de17b0..10fe6af 100644 --- a/agent-go/rabbitmq/OctopusMessage.go +++ b/agent-go/rabbitmq/OctopusMessage.go @@ -164,7 +164,7 @@ func statusOMHandler(octopusMessage *OctopusMessage) { // ping info statusRes = status.Ping() } else { - // status info + // metric info agentStatusString, _ := json.Marshal(status.ReportAppStatus()) statusRes = string(agentStatusString) } diff --git a/server/src/main/java/io/wdd/rpc/scheduler/service/status/AgentAliveStatusMonitorService.java b/server/src/main/java/io/wdd/rpc/scheduler/service/status/AgentAliveStatusMonitorService.java index 9c768cc..55c4456 100644 --- a/server/src/main/java/io/wdd/rpc/scheduler/service/status/AgentAliveStatusMonitorService.java +++ b/server/src/main/java/io/wdd/rpc/scheduler/service/status/AgentAliveStatusMonitorService.java @@ -112,12 +112,6 @@ public class AgentAliveStatusMonitorService { // 更新 二级缓存 commonAndStatusCache.updateAgentStatusCache(agentAliveStatusMap); - log.debug( - "[存活状态] - 当前时间为 [ %s ] , 所有的Agent存活状态为=> %s", - currentTimeString, - agentAliveStatusMap - ); - // 更新 一级缓存 // 这里仅仅是更新时间 redisTemplate @@ -136,6 +130,11 @@ public class AgentAliveStatusMonitorService { agentAliveStatusMap ); + log.debug( + "[存活状态] - 当前时间为 [ {} ] 一级和二级状态缓存均已经更新", + currentTimeString + ); + } diff --git a/server/src/main/java/io/wdd/rpc/scheduler/service/status/AgentMetricStatusCollectService.java b/server/src/main/java/io/wdd/rpc/scheduler/service/status/AgentMetricStatusCollectService.java index 191b810..766e039 100644 --- a/server/src/main/java/io/wdd/rpc/scheduler/service/status/AgentMetricStatusCollectService.java +++ b/server/src/main/java/io/wdd/rpc/scheduler/service/status/AgentMetricStatusCollectService.java @@ -1,7 +1,6 @@ package io.wdd.rpc.scheduler.service.status; -import io.wdd.rpc.message.sender.OMessageToAgentSender; import io.wdd.rpc.status.beans.AgentStatus; import io.wdd.rpc.status.service.SyncStatusService; import lombok.extern.slf4j.Slf4j; @@ -20,13 +19,10 @@ import static io.wdd.rpc.status.CommonAndStatusCache.ALL_HEALTHY_AGENT_TOPIC_NAM @Slf4j public class AgentMetricStatusCollectService { - @Resource - OMessageToAgentSender oMessageToAgentSender; @Resource SyncStatusService syncStatusService; - /** * 收集所有健康主机的运行数据 */ @@ -46,7 +42,7 @@ public class AgentMetricStatusCollectService { // todo 需要进行存储或者咋滴 log.info( - "[Agent Metric] - 所有主机的状态为 => %s", + "[Agent Metric] - 所有主机的状态为 => {}", agentMetricStatusMap ); diff --git a/server/src/main/java/io/wdd/rpc/status/CommonAndStatusCache.java b/server/src/main/java/io/wdd/rpc/status/CommonAndStatusCache.java index 8aa0b9c..f9719e8 100644 --- a/server/src/main/java/io/wdd/rpc/status/CommonAndStatusCache.java +++ b/server/src/main/java/io/wdd/rpc/status/CommonAndStatusCache.java @@ -141,7 +141,7 @@ public class CommonAndStatusCache { // 检查,排除没有节点的情况 if (CollectionUtils.isEmpty(ALL_AGENT_TOPIC_NAME_LIST)) { - log.warn("[Serer Boot Up] Octopus Serer First Boot Up ! No Agent Registered Ever!"); + log.warn("[Agent Status Cache] No Agent Registered Ever! Return"); return; } @@ -187,15 +187,13 @@ public class CommonAndStatusCache { Collections.singletonList(timeString) ); - log.debug("Agent存活状态 状态-Agent名称-Map 已经更新了"); - // 缓存相应的存活Agent List allHealthyAgentTopicNames = agentAliveStatusMap .entrySet() .stream() .filter( entry -> entry - .getKey() + .getValue() .equals(Boolean.TRUE) ) .map( @@ -205,7 +203,12 @@ public class CommonAndStatusCache { ALL_HEALTHY_AGENT_TOPIC_NAME_LIST.clear(); ALL_HEALTHY_AGENT_TOPIC_NAME_LIST.addAll(allHealthyAgentTopicNames); - + log.debug( + "[状态二级缓存] - ALL_HEALTHY_AGENT_TOPIC_NAME_LIST 为=> {},\n STATUS_AGENT_LIST_MAP 为=> {},\n ALL_AGENT_STATUS_MAP 为=> {}\n", + ALL_HEALTHY_AGENT_TOPIC_NAME_LIST, + STATUS_AGENT_LIST_MAP, + ALL_AGENT_STATUS_MAP + ); // help gc agentAliveStatusMap = null; diff --git a/server/src/main/java/io/wdd/rpc/status/beans/NetworkStatus.java b/server/src/main/java/io/wdd/rpc/status/beans/NetworkStatus.java index c5a067d..66489d1 100644 --- a/server/src/main/java/io/wdd/rpc/status/beans/NetworkStatus.java +++ b/server/src/main/java/io/wdd/rpc/status/beans/NetworkStatus.java @@ -25,7 +25,7 @@ public class NetworkStatus { @JsonProperty("sent") private Long sent; @JsonProperty("recv") - private Integer recv; + private Long recv; @JsonProperty("sent_rate") private String sentRate; @JsonProperty("recv_rate") diff --git a/server/src/main/resources/application.yml b/server/src/main/resources/application.yml index 750ef92..6a58e50 100644 --- a/server/src/main/resources/application.yml +++ b/server/src/main/resources/application.yml @@ -159,5 +159,9 @@ oss: secret: ukWae6TXjID2Wqxh+7mAPAf4busZPGzwAh/WDKZ5MOQ= capacity: 10737418240 - +# 开启debug模式 +logging: + level: + io.wdd: debug +debug: true