[ Status ] 完成Agent Metric部分
This commit is contained in:
@@ -164,7 +164,7 @@ func statusOMHandler(octopusMessage *OctopusMessage) {
|
|||||||
// ping info
|
// ping info
|
||||||
statusRes = status.Ping()
|
statusRes = status.Ping()
|
||||||
} else {
|
} else {
|
||||||
// status info
|
// metric info
|
||||||
agentStatusString, _ := json.Marshal(status.ReportAppStatus())
|
agentStatusString, _ := json.Marshal(status.ReportAppStatus())
|
||||||
statusRes = string(agentStatusString)
|
statusRes = string(agentStatusString)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -112,12 +112,6 @@ public class AgentAliveStatusMonitorService {
|
|||||||
// 更新 二级缓存
|
// 更新 二级缓存
|
||||||
commonAndStatusCache.updateAgentStatusCache(agentAliveStatusMap);
|
commonAndStatusCache.updateAgentStatusCache(agentAliveStatusMap);
|
||||||
|
|
||||||
log.debug(
|
|
||||||
"[存活状态] - 当前时间为 [ %s ] , 所有的Agent存活状态为=> %s",
|
|
||||||
currentTimeString,
|
|
||||||
agentAliveStatusMap
|
|
||||||
);
|
|
||||||
|
|
||||||
// 更新 一级缓存
|
// 更新 一级缓存
|
||||||
// 这里仅仅是更新时间
|
// 这里仅仅是更新时间
|
||||||
redisTemplate
|
redisTemplate
|
||||||
@@ -136,6 +130,11 @@ public class AgentAliveStatusMonitorService {
|
|||||||
agentAliveStatusMap
|
agentAliveStatusMap
|
||||||
);
|
);
|
||||||
|
|
||||||
|
log.debug(
|
||||||
|
"[存活状态] - 当前时间为 [ {} ] 一级和二级状态缓存均已经更新",
|
||||||
|
currentTimeString
|
||||||
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package io.wdd.rpc.scheduler.service.status;
|
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.beans.AgentStatus;
|
||||||
import io.wdd.rpc.status.service.SyncStatusService;
|
import io.wdd.rpc.status.service.SyncStatusService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -20,13 +19,10 @@ import static io.wdd.rpc.status.CommonAndStatusCache.ALL_HEALTHY_AGENT_TOPIC_NAM
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
public class AgentMetricStatusCollectService {
|
public class AgentMetricStatusCollectService {
|
||||||
|
|
||||||
@Resource
|
|
||||||
OMessageToAgentSender oMessageToAgentSender;
|
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
SyncStatusService syncStatusService;
|
SyncStatusService syncStatusService;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 收集所有健康主机的运行数据
|
* 收集所有健康主机的运行数据
|
||||||
*/
|
*/
|
||||||
@@ -46,7 +42,7 @@ public class AgentMetricStatusCollectService {
|
|||||||
|
|
||||||
// todo 需要进行存储或者咋滴
|
// todo 需要进行存储或者咋滴
|
||||||
log.info(
|
log.info(
|
||||||
"[Agent Metric] - 所有主机的状态为 => %s",
|
"[Agent Metric] - 所有主机的状态为 => {}",
|
||||||
agentMetricStatusMap
|
agentMetricStatusMap
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -141,7 +141,7 @@ public class CommonAndStatusCache {
|
|||||||
|
|
||||||
// 检查,排除没有节点的情况
|
// 检查,排除没有节点的情况
|
||||||
if (CollectionUtils.isEmpty(ALL_AGENT_TOPIC_NAME_LIST)) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -187,15 +187,13 @@ public class CommonAndStatusCache {
|
|||||||
Collections.singletonList(timeString)
|
Collections.singletonList(timeString)
|
||||||
);
|
);
|
||||||
|
|
||||||
log.debug("Agent存活状态 状态-Agent名称-Map 已经更新了");
|
|
||||||
|
|
||||||
// 缓存相应的存活Agent
|
// 缓存相应的存活Agent
|
||||||
List<String> allHealthyAgentTopicNames = agentAliveStatusMap
|
List<String> allHealthyAgentTopicNames = agentAliveStatusMap
|
||||||
.entrySet()
|
.entrySet()
|
||||||
.stream()
|
.stream()
|
||||||
.filter(
|
.filter(
|
||||||
entry -> entry
|
entry -> entry
|
||||||
.getKey()
|
.getValue()
|
||||||
.equals(Boolean.TRUE)
|
.equals(Boolean.TRUE)
|
||||||
)
|
)
|
||||||
.map(
|
.map(
|
||||||
@@ -205,7 +203,12 @@ public class CommonAndStatusCache {
|
|||||||
|
|
||||||
ALL_HEALTHY_AGENT_TOPIC_NAME_LIST.clear();
|
ALL_HEALTHY_AGENT_TOPIC_NAME_LIST.clear();
|
||||||
ALL_HEALTHY_AGENT_TOPIC_NAME_LIST.addAll(allHealthyAgentTopicNames);
|
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
|
// help gc
|
||||||
agentAliveStatusMap = null;
|
agentAliveStatusMap = null;
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ public class NetworkStatus {
|
|||||||
@JsonProperty("sent")
|
@JsonProperty("sent")
|
||||||
private Long sent;
|
private Long sent;
|
||||||
@JsonProperty("recv")
|
@JsonProperty("recv")
|
||||||
private Integer recv;
|
private Long recv;
|
||||||
@JsonProperty("sent_rate")
|
@JsonProperty("sent_rate")
|
||||||
private String sentRate;
|
private String sentRate;
|
||||||
@JsonProperty("recv_rate")
|
@JsonProperty("recv_rate")
|
||||||
|
|||||||
@@ -159,5 +159,9 @@ oss:
|
|||||||
secret: ukWae6TXjID2Wqxh+7mAPAf4busZPGzwAh/WDKZ5MOQ=
|
secret: ukWae6TXjID2Wqxh+7mAPAf4busZPGzwAh/WDKZ5MOQ=
|
||||||
capacity: 10737418240
|
capacity: 10737418240
|
||||||
|
|
||||||
|
# 开启debug模式
|
||||||
|
logging:
|
||||||
|
level:
|
||||||
|
io.wdd: debug
|
||||||
|
debug: true
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user