[ server ] - agent runtime metric status - both agent side
This commit is contained in:
@@ -8,6 +8,9 @@ import org.springframework.scheduling.quartz.QuartzJobBean;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import static io.wdd.rpc.status.AgentRuntimeMetricStatus.METRIC_REPORT_TIMES_COUNT;
|
||||
import static io.wdd.rpc.status.AgentRuntimeMetricStatus.METRIC_REPORT_TIME_PINCH;
|
||||
|
||||
public class AgentRunMetricStatusJob extends QuartzJobBean {
|
||||
|
||||
@Resource
|
||||
@@ -19,12 +22,9 @@ public class AgentRunMetricStatusJob extends QuartzJobBean {
|
||||
|
||||
// 从JobDetailContext中获取相应的信息
|
||||
JobDataMap jobDataMap = jobExecutionContext.getJobDetail().getJobDataMap();
|
||||
System.out.println("jobDataMap = " + jobDataMap);
|
||||
|
||||
int metricRepeatCount = 10;
|
||||
int metricRepeatPinch = 5;
|
||||
// 执行Agent Metric 状态收集任务
|
||||
agentRuntimeMetricStatus.collect(metricRepeatCount, metricRepeatPinch);
|
||||
agentRuntimeMetricStatus.collect((Integer) jobDataMap.get(METRIC_REPORT_TIMES_COUNT), (Integer) jobDataMap.get(METRIC_REPORT_TIME_PINCH));
|
||||
|
||||
// todo 机构设计状态会被存储至 Redis Stream Key 中
|
||||
// AgentTopicName-Metric
|
||||
|
||||
@@ -12,6 +12,10 @@ import javax.annotation.PostConstruct;
|
||||
import javax.annotation.Resource;
|
||||
import java.text.ParseException;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
|
||||
import static io.wdd.rpc.status.AgentRuntimeMetricStatus.METRIC_REPORT_TIMES_COUNT;
|
||||
import static io.wdd.rpc.status.AgentRuntimeMetricStatus.METRIC_REPORT_TIME_PINCH;
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
@@ -67,15 +71,19 @@ public class BuildStatusScheduleTask {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
// build the Job
|
||||
HashMap<String, Integer> map = new HashMap<String, Integer>();
|
||||
map.put(METRIC_REPORT_TIME_PINCH,metricReportTimePinch);
|
||||
map.put(METRIC_REPORT_TIMES_COUNT,metricReportTimesCount);
|
||||
|
||||
// build the Job 只发送一次消息,然后让Agent获取消息 (重复间隔,重复次数) 进行相应的处理!
|
||||
// todo 解决创建太多对象的问题,需要缓存相应的内容
|
||||
octopusQuartzService.addJob(
|
||||
AgentRunMetricStatusJob.class,
|
||||
"agentRunMetricStatusJob",
|
||||
JOB_GROUP_NAME,
|
||||
metricReportTimePinch,
|
||||
metricReportTimesCount,
|
||||
null
|
||||
1,
|
||||
map
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
@@ -23,6 +23,9 @@ public class AgentRuntimeMetricStatus {
|
||||
|
||||
public static List<String> ALL_HEALTHY_AGENT_TOPIC_NAMES;
|
||||
|
||||
public static final String METRIC_REPORT_TIME_PINCH = "metricRepeatPinch";
|
||||
public static final String METRIC_REPORT_TIMES_COUNT = "metricRepeatCount";
|
||||
|
||||
@Resource
|
||||
CollectAgentStatus collectAgentStatus;
|
||||
|
||||
@@ -47,7 +50,7 @@ public class AgentRuntimeMetricStatus {
|
||||
return OctopusStatusMessage.builder()
|
||||
.type(METRIC_STATUS_MESSAGE_TYPE)
|
||||
.metricRepeatCount(metricRepeatCount)
|
||||
.metricRepeatCount(metricRepeatCount)
|
||||
.metricRepeatPinch(metricRepeatPinch)
|
||||
.agentTopicName(agentTopicName)
|
||||
.build();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user