[ server ] [ execution ]- optimize some controller - 2

This commit is contained in:
zeaslity
2023-01-16 18:02:36 +08:00
parent 41396e024c
commit 4812756408
6 changed files with 100 additions and 81 deletions

View File

@@ -1,24 +0,0 @@
package io.wdd.rpc.scheduler.config;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* @author Andya
* @create 2021/04/01
*/
@ApiModel(value = "更新job cron时间参数")
@JsonInclude(JsonInclude.Include.NON_NULL)
public class UpdateJobBean {
@ApiModelProperty(value = "jobTime的cron表达式", example = "0 0 1 * * ?")
String jobCronTime;
public String getJobCronTime() {
return jobCronTime;
}
public void setJobCronTime(String jobCronTime) {
this.jobCronTime = jobCronTime;
}
}

View File

@@ -16,15 +16,19 @@ public class AgentRunMetricStatusJob extends QuartzJobBean {
@Resource
AgentRuntimeMetricStatus agentRuntimeMetricStatus;
@Override
protected void executeInternal(JobExecutionContext jobExecutionContext) throws JobExecutionException {
// 从JobDetailContext中获取相应的信息
JobDataMap jobDataMap = jobExecutionContext.getJobDetail().getJobDataMap();
JobDataMap jobDataMap = jobExecutionContext
.getJobDetail()
.getJobDataMap();
// 执行Agent Metric 状态收集任务
agentRuntimeMetricStatus.collect((Integer) jobDataMap.get(METRIC_REPORT_TIMES_COUNT), (Integer) jobDataMap.get(METRIC_REPORT_TIME_PINCH));
agentRuntimeMetricStatus.collect(
(Integer) jobDataMap.get(METRIC_REPORT_TIMES_COUNT),
(Integer) jobDataMap.get(METRIC_REPORT_TIME_PINCH)
);
// todo 机构设计状态会被存储至 Redis Stream Key 中
// AgentTopicName-Metric

View File

@@ -30,6 +30,9 @@ public class BuildStatusScheduleTask {
@Value(value = "${octopus.status.healthy.start-delay}")
int healthyCheckStartDelaySeconds;
@Value(value = "${octopus.status.metric.cron}")
int metricReportCronExpress;
@Value(value = "${octopus.status.metric.pinch}")
int metricReportTimePinch;
@@ -64,16 +67,16 @@ public class BuildStatusScheduleTask {
long totalSeconds = (nextValidTime.getTime() - now.getTime()) / 1000;
metricReportTimesCount = (int) (totalSeconds / metricReportTimePinch) - 1;
System.out.println("totalSeconds = " + totalSeconds);
System.out.println("metricReportTimesCount = " + metricReportTimesCount);
/*System.out.println("totalSeconds = " + totalSeconds);
System.out.println("metricReportTimesCount = " + metricReportTimesCount);*/
} catch (ParseException e) {
throw new RuntimeException(e);
}
HashMap<String, Integer> map = new HashMap<String, Integer>();
map.put(METRIC_REPORT_TIME_PINCH,metricReportTimePinch);
map.put(METRIC_REPORT_TIMES_COUNT,metricReportTimesCount);
map.put(METRIC_REPORT_TIME_PINCH, metricReportTimePinch);
map.put(METRIC_REPORT_TIMES_COUNT, metricReportTimesCount);
// build the Job 只发送一次消息然后让Agent获取消息 (重复间隔,重复次数) 进行相应的处理!
// todo 解决创建太多对象的问题,需要缓存相应的内容