[ Status ] 完成Agent Metric部分

This commit is contained in:
zeaslity
2023-07-11 16:52:31 +08:00
parent 6a34bfd6d2
commit 98467f9590
6 changed files with 21 additions and 19 deletions

View File

@@ -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)
}

View File

@@ -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
);
}

View File

@@ -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
);

View File

@@ -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<String> 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;

View File

@@ -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")

View File

@@ -159,5 +159,9 @@ oss:
secret: ukWae6TXjID2Wqxh+7mAPAf4busZPGzwAh/WDKZ5MOQ=
capacity: 10737418240
# 开启debug模式
logging:
level:
io.wdd: debug
debug: true