diff --git a/linkis-extensions/linkis-et-monitor/pom.xml b/linkis-extensions/linkis-et-monitor/pom.xml
index 5e62fa60b5..6972c9e1a4 100644
--- a/linkis-extensions/linkis-et-monitor/pom.xml
+++ b/linkis-extensions/linkis-et-monitor/pom.xml
@@ -87,11 +87,11 @@
${project.version}
provided
-
- org.apache.linkis
- linkis-rpc
- ${project.version}
-
+
+ org.apache.linkis
+ linkis-rpc
+ ${project.version}
+
diff --git a/linkis-extensions/linkis-et-monitor/src/main/assembly/distribution.xml b/linkis-extensions/linkis-et-monitor/src/main/assembly/distribution.xml
index 8cc9e7ea7b..647b84c833 100644
--- a/linkis-extensions/linkis-et-monitor/src/main/assembly/distribution.xml
+++ b/linkis-extensions/linkis-et-monitor/src/main/assembly/distribution.xml
@@ -16,10 +16,8 @@
~ limitations under the License.
-->
-
+
linkis-et-monitor
dir
diff --git a/linkis-extensions/linkis-et-monitor/src/main/java/org/apache/linkis/monitor/scan/app/LinkisDirtyDataCleanApplication.java b/linkis-extensions/linkis-et-monitor/src/main/java/org/apache/linkis/monitor/scan/app/LinkisDirtyDataCleanApplication.java
deleted file mode 100644
index 3530ef5139..0000000000
--- a/linkis-extensions/linkis-et-monitor/src/main/java/org/apache/linkis/monitor/scan/app/LinkisDirtyDataCleanApplication.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.linkis.monitor.scan.app;
-
-import org.apache.linkis.monitor.scan.app.dirtydata.entrance.EntranceDirtyDataHandler;
-import org.apache.linkis.monitor.scan.utils.log.LogUtils;
-import org.apache.linkis.server.utils.LinkisMainHelper;
-
-import org.apache.commons.lang3.StringUtils;
-
-import org.springframework.context.annotation.AnnotationConfigApplicationContext;
-import org.springframework.context.support.AbstractApplicationContext;
-
-import org.slf4j.Logger;
-
-public class LinkisDirtyDataCleanApplication {
- private static final Logger logger = LogUtils.stdOutLogger();
-
- /** @param args: args[0]: host args[1] port */
- public static void main(String[] args) throws ReflectiveOperationException {
- if (args.length == 0
- || StringUtils.equalsIgnoreCase(args[0], "help")
- || StringUtils.equalsIgnoreCase(args[0], "--help")) {
- LogUtils.stdOutLogger()
- .info(
- "[help-message]this app cleans entrance dirty-data. args[0]: command-type (entrance/help/...) args[1]: entrance-hostname(not null), args[2]: entrance-port(can be null)");
- return;
- }
- String serviceName = System.getProperty(LinkisMainHelper.SERVER_NAME_KEY());
- LinkisMainHelper.formatPropertyFiles(serviceName);
-
- if (StringUtils.equalsIgnoreCase(args[0], "entrance")) {
- AbstractApplicationContext context =
- new AnnotationConfigApplicationContext(LinkisJobHistoryScanSpringConfiguration.class);
-
- String host = "";
- String port = "";
- if (args.length > 1) {
- host = args[1];
- }
- if (args.length > 2) {
- port = args[2];
- }
- if (args.length > 3) {
- printIllegalInput("wrong number of arguments");
- return;
- }
- try {
- removeDirtyEurekaInstance(host, port);
- } catch (Exception e) {
- LogUtils.stdOutLogger().error("Failed to remove dirty eureka-instance", e);
- }
- try {
- removeDbDirtyData(host, port);
- } catch (Exception e) {
- LogUtils.stdOutLogger().error("Failed to remove dirty db-data", e);
- }
-
- context.close();
- } else {
- LogUtils.stdOutLogger().error("Upsupported command type: " + args[0]);
- }
- }
-
- private static void printIllegalInput(String msg) {
- LogUtils.stdOutLogger().error("illegal input: " + msg);
- LogUtils.stdOutLogger()
- .info(
- "[help-message] this app cleans entrance dirty-data. args[0]: entrance-hostname, args[1]: entrance-port");
- return;
- }
-
- private static void removeDirtyEurekaInstance(String host, String port) {
- if (StringUtils.isBlank(host)) {
- printIllegalInput("host cannot be blank");
- return;
- }
- if (StringUtils.isBlank(port)) {
- EntranceDirtyDataHandler.handleEurekaDirtyData(host);
- } else {
- EntranceDirtyDataHandler.handleEurekaDirtyData(host, port);
- }
- }
-
- private static void removeDbDirtyData(String host, String port) {
- if (StringUtils.isBlank(host)) {
- printIllegalInput("host cannot be blank");
- return;
- }
- if (StringUtils.isBlank(port)) {
- EntranceDirtyDataHandler.handleDbDirtData(host);
- } else {
- EntranceDirtyDataHandler.handleDbDirtData(host, port);
- }
- }
-}
diff --git a/linkis-extensions/linkis-et-monitor/src/main/java/org/apache/linkis/monitor/scan/app/LinkisJobHistoryScanApplication.java b/linkis-extensions/linkis-et-monitor/src/main/java/org/apache/linkis/monitor/scan/app/LinkisJobHistoryScanApplication.java
deleted file mode 100644
index 8b4366805e..0000000000
--- a/linkis-extensions/linkis-et-monitor/src/main/java/org/apache/linkis/monitor/scan/app/LinkisJobHistoryScanApplication.java
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.linkis.monitor.scan.app;
-
-import org.apache.linkis.monitor.scan.app.factory.MapperFactory;
-import org.apache.linkis.monitor.scan.app.jobhistory.JobHistoryDataFetcher;
-import org.apache.linkis.monitor.scan.app.jobhistory.errorcode.JobHistoryErrCodeRule;
-import org.apache.linkis.monitor.scan.app.jobhistory.errorcode.JobHistoryErrorCodeAlertSender;
-import org.apache.linkis.monitor.scan.app.jobhistory.jobtime.JobTimeExceedAlertSender;
-import org.apache.linkis.monitor.scan.app.jobhistory.jobtime.JobTimeExceedRule;
-import org.apache.linkis.monitor.scan.constants.Constants;
-import org.apache.linkis.monitor.scan.core.pac.DataFetcher;
-import org.apache.linkis.monitor.scan.core.scanner.AnomalyScanner;
-import org.apache.linkis.monitor.scan.core.scanner.DefaultScanner;
-import org.apache.linkis.monitor.scan.utils.alert.AlertDesc;
-import org.apache.linkis.monitor.scan.utils.alert.ims.ImsAlertDesc;
-import org.apache.linkis.monitor.scan.utils.alert.ims.JobHistoryScanImsAlertPropFileParserUtils;
-import org.apache.linkis.monitor.scan.utils.log.LogUtils;
-import org.apache.linkis.server.utils.LinkisMainHelper;
-
-import org.apache.commons.lang3.exception.ExceptionUtils;
-
-import org.springframework.context.annotation.AnnotationConfigApplicationContext;
-import org.springframework.context.support.AbstractApplicationContext;
-
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-
-import org.slf4j.Logger;
-
-public class LinkisJobHistoryScanApplication {
- private static final Logger logger = LogUtils.stdOutLogger();
-
- /** @param args: args[0]: startTime, args[1] endTime */
- public static void main(String[] args) throws ReflectiveOperationException {
-
- String serviceName = System.getProperty(LinkisMainHelper.SERVER_NAME_KEY());
- LinkisMainHelper.formatPropertyFiles(serviceName);
-
- long intervalMs = Constants.SCAN_INTERVALS_SECONDS() * 1000;
- long maxIntervalMs = Constants.MAX_INTERVALS_SECONDS() * 1000;
- long endTime = System.currentTimeMillis();
- long startTime = endTime - intervalMs;
- /** parse input into timestamp */
- if (args != null && args.length == 2) {
- SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHH");
- Long tmpStart;
- Long tmpEnd;
- try {
- tmpStart = format.parse(args[0]).getTime();
- tmpEnd = format.parse(args[1]).getTime();
- } catch (ParseException e) {
- logger.info(
- "Failed to parse input into startTime and endTime." + ExceptionUtils.getMessage(e));
- return;
- }
- if (endTime <= startTime) {
- logger.info("[error] startTime larger than endTime");
- return;
- }
- if (tmpStart != null && tmpEnd != null) {
- startTime = tmpStart;
- endTime = tmpEnd;
- }
- }
- long realIntervals = endTime - startTime < maxIntervalMs ? endTime - startTime : maxIntervalMs;
-
- runApp(startTime, endTime, realIntervals, maxIntervalMs);
- }
-
- private static void runApp(long startTime, long endTime, long realIntervals, long maxIntervalMs) {
-
- AbstractApplicationContext context =
- new AnnotationConfigApplicationContext(LinkisJobHistoryScanSpringConfiguration.class);
-
- AnomalyScanner scanner = new DefaultScanner();
- boolean shouldStart = false;
-
- List fetchers = generateFetchers(startTime, endTime, maxIntervalMs);
- if (fetchers == null) {
- logger.warn("generated 0 dataFetchers, plz check input");
- return;
- }
-
- Map errorCodeAlerts =
- JobHistoryScanImsAlertPropFileParserUtils.getAlerts(Constants.SCAN_PREFIX_ERRORCODE());
- if (errorCodeAlerts == null || errorCodeAlerts.size() == 0) {
- logger.info("[INFO] Loaded 0 errorcode alert from alert-rule properties file.");
- } else {
- logger.info(
- "[INFO] Loaded {} errorcode alert from alert-rules properties file.",
- errorCodeAlerts.size());
- shouldStart = true;
- addIntervalToImsAlerts(errorCodeAlerts, realIntervals);
- JobHistoryErrCodeRule jobHistoryErrCodeRule =
- new JobHistoryErrCodeRule(
- errorCodeAlerts.keySet(), new JobHistoryErrorCodeAlertSender(errorCodeAlerts));
- scanner.addScanRule(jobHistoryErrCodeRule);
- }
-
- Map jobTimeAlerts =
- JobHistoryScanImsAlertPropFileParserUtils.getAlerts(
- Constants.SCAN_PREFIX_UNFINISHED_JOBTIME_EXCEED_SEC());
- if (jobTimeAlerts == null || jobTimeAlerts.size() == 0) {
- logger.info("[INFO] Loaded 0 alerts jobtime alert-rule from alert properties file.");
- } else {
- logger.info(
- "[INFO] Loaded {} alerts jobtime alert-rules from alert properties file.",
- jobTimeAlerts.size());
- shouldStart = true;
- addIntervalToImsAlerts(jobTimeAlerts, realIntervals);
- JobTimeExceedRule jobTimeExceedRule =
- new JobTimeExceedRule(
- jobTimeAlerts.keySet(), new JobTimeExceedAlertSender(jobTimeAlerts));
- scanner.addScanRule(jobTimeExceedRule);
- }
- if (shouldStart) {
- scanner.addDataFetchers(fetchers);
- scanner.run();
- scanner.shutdown(); // wait all alert to be send
- }
- context.close();
- }
-
- private static List generateFetchers(
- long startTime, long endTime, long maxIntervalMs) {
- List ret = new ArrayList<>();
- long pe = endTime;
- long ps;
- while (pe > startTime) {
- ps = pe - maxIntervalMs > startTime ? pe - maxIntervalMs : startTime;
- String[] fetcherArgs = new String[] {String.valueOf(ps), String.valueOf(pe)};
- ret.add(new JobHistoryDataFetcher(fetcherArgs, MapperFactory.getJobHistoryMapper()));
- logger.info(
- "Generated dataFetcher for startTime: "
- + new Date(ps).toString()
- + ". EndTime: "
- + new Date(pe).toString());
- pe = pe - maxIntervalMs;
- }
- return ret;
- }
-
- private static void addIntervalToImsAlerts(Map alerts, long realIntervals) {
- for (AlertDesc alert : alerts.values()) {
- if (!(alert instanceof ImsAlertDesc)) {
- logger.info("[warn] ignore wrong alert" + alert);
- } else {
- ((ImsAlertDesc) alert).hitIntervalMs_$eq(realIntervals);
- }
- }
- }
-}
diff --git a/linkis-extensions/linkis-et-monitor/src/main/java/org/apache/linkis/monitor/scan/app/instance/dao/InstanceLabelDao.java b/linkis-extensions/linkis-et-monitor/src/main/java/org/apache/linkis/monitor/scan/app/instance/dao/InstanceLabelDao.java
index 8f73f0349a..5fa3b7a5c0 100644
--- a/linkis-extensions/linkis-et-monitor/src/main/java/org/apache/linkis/monitor/scan/app/instance/dao/InstanceLabelDao.java
+++ b/linkis-extensions/linkis-et-monitor/src/main/java/org/apache/linkis/monitor/scan/app/instance/dao/InstanceLabelDao.java
@@ -21,7 +21,6 @@
import java.util.List;
-
public interface InstanceLabelDao {
/**
* Remove label
diff --git a/linkis-extensions/linkis-et-monitor/src/main/java/org/apache/linkis/monitor/scan/app/instance/entity/InsPersistenceLabel.java b/linkis-extensions/linkis-et-monitor/src/main/java/org/apache/linkis/monitor/scan/app/instance/entity/InsPersistenceLabel.java
index e828328b43..36fb21c13b 100644
--- a/linkis-extensions/linkis-et-monitor/src/main/java/org/apache/linkis/monitor/scan/app/instance/entity/InsPersistenceLabel.java
+++ b/linkis-extensions/linkis-et-monitor/src/main/java/org/apache/linkis/monitor/scan/app/instance/entity/InsPersistenceLabel.java
@@ -79,4 +79,20 @@ public Date getCreateTime() {
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
+
+ public String getLabelKey() {
+ return labelKey;
+ }
+
+ public void setLabelKey(String labelKey) {
+ this.labelKey = labelKey;
+ }
+
+ public String getFeature() {
+ return feature;
+ }
+
+ public void setFeature(String feature) {
+ this.feature = feature;
+ }
}
diff --git a/linkis-extensions/linkis-et-monitor/src/main/java/org/apache/linkis/monitor/scan/app/jobhistory/dao/JobHistoryMapper.java b/linkis-extensions/linkis-et-monitor/src/main/java/org/apache/linkis/monitor/scan/app/jobhistory/dao/JobHistoryMapper.java
index b3774860af..bfdc640652 100644
--- a/linkis-extensions/linkis-et-monitor/src/main/java/org/apache/linkis/monitor/scan/app/jobhistory/dao/JobHistoryMapper.java
+++ b/linkis-extensions/linkis-et-monitor/src/main/java/org/apache/linkis/monitor/scan/app/jobhistory/dao/JobHistoryMapper.java
@@ -24,7 +24,6 @@
import java.util.Date;
import java.util.List;
-
public interface JobHistoryMapper {
List selectJobHistory(JobHistory jobReq);
diff --git a/linkis-extensions/linkis-et-monitor/src/main/java/org/apache/linkis/monitor/scan/app/monitor/config/MonitorConfig.java b/linkis-extensions/linkis-et-monitor/src/main/java/org/apache/linkis/monitor/scan/app/monitor/config/MonitorConfig.java
index fab9a5cbe7..32b47c289c 100644
--- a/linkis-extensions/linkis-et-monitor/src/main/java/org/apache/linkis/monitor/scan/app/monitor/config/MonitorConfig.java
+++ b/linkis-extensions/linkis-et-monitor/src/main/java/org/apache/linkis/monitor/scan/app/monitor/config/MonitorConfig.java
@@ -29,9 +29,9 @@ public class MonitorConfig {
public static final CommonVars USER_MODE_TIMEOUT =
CommonVars.apply("linkis.monitor.user.timeOut", 300);
public static final CommonVars USER_MODE_AUTHTOKEN =
- CommonVars.apply("linkis.monitor.user.authToken","VALIDATOR-AUTH");
+ CommonVars.apply("linkis.monitor.user.authToken", "VALIDATOR-AUTH");
public static final CommonVars USER_MODE_ENGINE =
- CommonVars.apply("linkis.monitor.user.enginelist","[]");
+ CommonVars.apply("linkis.monitor.user.enginelist", "[]");
public static final CommonVars ECM_TASK_MAJOR =
CommonVars.apply("linkis.monitor.ecmResourceTask.major", 0.03);
@@ -43,7 +43,7 @@ public class MonitorConfig {
CommonVars.apply("linkis.monitor.metrics.userAuthKey");
public static final CommonVars JOB_HISTORY_TIME_EXCEED =
- CommonVars.apply("linkis.monitor.jobhistory.id.timeExceed",0L);
+ CommonVars.apply("linkis.monitor.jobhistory.id.timeExceed", 0L);
public static final CommonVars ENTRANCE_TASK_USERTOTAL =
CommonVars.apply("linkis.monitor.entranceTask.userTotalTask", 1000);
@@ -52,7 +52,7 @@ public class MonitorConfig {
public static final CommonVars ENTRANCE_TASK_TOTAL_MINOR =
CommonVars.apply("linkis.monitor.entranceTask.linkisTotalTaskMinor", 10000);
public static final CommonVars ENTRANCE_TASK_USERLIST =
- CommonVars.apply("linkis.monitor.entranceTask.userlist","[]");
+ CommonVars.apply("linkis.monitor.entranceTask.userlist", "[]");
public static final CommonVars SCHEDULED_CONFIG_NUM =
CommonVars.apply("linkis.monitor.scheduled.pool.cores.num", 10);
@@ -61,11 +61,24 @@ public class MonitorConfig {
CommonVars.apply("linkis.monitor.shell.time.out.minute", 30);
public static final CommonVars USER_MODE_INTERFACE_TIMEOUT =
- CommonVars.apply("linkis.monitor.user.mode.time.out", 30*1000);
+ CommonVars.apply("linkis.monitor.user.mode.time.out", 30 * 1000);
- public static final CommonVars CHATBOT_KEY_ID = CommonVars.apply("linkis.monitor.chatbot.key.id","23e6afad1b78a0c5eed67e4d24de7063");
- public static final CommonVars CHATBOT_TYPE = CommonVars.apply("linkis.monitor.chatbot.type","text");
- public static final CommonVars CHATBOT_SERVICE_NAME= CommonVars.apply("linkis.monitor.chatbot.serviceName","大数据生产助手(BDP_PRD)");
- public static final CommonVars CHATBOT_URL= CommonVars.apply("linkis.monitor.chatbot.url","http://172.21.3.43:1377/pros-chatbot/yuanfang/sendEMsg");
- public static final CommonVars SOLUTION_URL = CommonVars.apply("linkis.monitor.jobhistory.solution.url", "http://kn.dss.weoa.com/linkis/qa");
+ public static final CommonVars CHATBOT_KEY_ID =
+ CommonVars.apply("linkis.monitor.chatbot.key.id", "23e6afad1b78a0c5eed67e4d24de7063");
+ public static final CommonVars CHATBOT_TYPE =
+ CommonVars.apply("linkis.monitor.chatbot.type", "text");
+ public static final CommonVars CHATBOT_SERVICE_NAME =
+ CommonVars.apply("linkis.monitor.chatbot.serviceName", "");
+ public static final CommonVars CHATBOT_URL =
+ CommonVars.apply("linkis.monitor.chatbot.url", "");
+ public static final CommonVars SOLUTION_URL =
+ CommonVars.apply(
+ "linkis.monitor.jobhistory.solution.url",
+ "https://linkis.apache.org/docs/latest/tuning-and-troubleshooting/error-guide/error-code");
+
+ public static final CommonVars TASK_RUNTIME_TIMEOUT_DESC =
+ CommonVars.apply(
+ "linkis.monitor.jobhistory.task.timeout.desc",
+ "[Linkis任务信息]您好,您在Linkis/DSS提交的任务(任务ID:{0}),已经运行超过{1}h,"
+ + "请关注是否任务正常,如果不正常您可以到Linkis/DSS管理台进行任务的kill,集群信息为BDAP({2})。详细解决方案见Q47:{3} ");
}
diff --git a/linkis-extensions/linkis-et-monitor/src/main/java/org/apache/linkis/monitor/scan/app/monitor/entity/ChatbotEntity.java b/linkis-extensions/linkis-et-monitor/src/main/java/org/apache/linkis/monitor/scan/app/monitor/entity/ChatbotEntity.java
index 3cf288adbb..4f912b9e82 100644
--- a/linkis-extensions/linkis-et-monitor/src/main/java/org/apache/linkis/monitor/scan/app/monitor/entity/ChatbotEntity.java
+++ b/linkis-extensions/linkis-et-monitor/src/main/java/org/apache/linkis/monitor/scan/app/monitor/entity/ChatbotEntity.java
@@ -20,68 +20,78 @@
import org.apache.linkis.monitor.scan.app.monitor.config.MonitorConfig;
public class ChatbotEntity {
- private String keyid;
- private String content;
- private String type;
- private String userName;
- private String serviceName;
+ private String keyid;
+ private String content;
+ private String type;
+ private String userName;
+ private String serviceName;
- public ChatbotEntity(String content, String userName) {
- this.keyid = MonitorConfig.CHATBOT_KEY_ID.getValue();
- this.content = content;
- this.type = MonitorConfig.CHATBOT_TYPE.getValue();
- this.userName = userName;
- this.serviceName = MonitorConfig.CHATBOT_SERVICE_NAME.getValue();
- }
+ public ChatbotEntity(String content, String userName) {
+ this.keyid = MonitorConfig.CHATBOT_KEY_ID.getValue();
+ this.content = content;
+ this.type = MonitorConfig.CHATBOT_TYPE.getValue();
+ this.userName = userName;
+ this.serviceName = MonitorConfig.CHATBOT_SERVICE_NAME.getValue();
+ }
- public String getKeyid() {
- return keyid;
- }
+ public String getKeyid() {
+ return keyid;
+ }
- public void setKeyid(String keyid) {
- this.keyid = keyid;
- }
+ public void setKeyid(String keyid) {
+ this.keyid = keyid;
+ }
- public String getContent() {
- return content;
- }
+ public String getContent() {
+ return content;
+ }
- public void setContent(String content) {
- this.content = content;
- }
+ public void setContent(String content) {
+ this.content = content;
+ }
- public String getType() {
- return type;
- }
+ public String getType() {
+ return type;
+ }
- public void setType(String type) {
- this.type = type;
- }
+ public void setType(String type) {
+ this.type = type;
+ }
- public String getUserName() {
- return userName;
- }
+ public String getUserName() {
+ return userName;
+ }
- public void setUserName(String userName) {
- this.userName = userName;
- }
+ public void setUserName(String userName) {
+ this.userName = userName;
+ }
- public String getServiceName() {
- return serviceName;
- }
+ public String getServiceName() {
+ return serviceName;
+ }
- public void setServiceName(String serviceNameuserName) {
- this.serviceName = serviceNameuserName;
- }
+ public void setServiceName(String serviceNameuserName) {
+ this.serviceName = serviceNameuserName;
+ }
- @Override
- public String toString() {
- return "ChatbotEntity{" +
- "keyid='" + keyid + '\'' +
- ", content='" + content + '\'' +
- ", type='" + type + '\'' +
- ", userName='" + userName + '\'' +
- ", serviceName='" + serviceName + '\'' +
- '}';
- }
+ @Override
+ public String toString() {
+ return "ChatbotEntity{"
+ + "keyid='"
+ + keyid
+ + '\''
+ + ", content='"
+ + content
+ + '\''
+ + ", type='"
+ + type
+ + '\''
+ + ", userName='"
+ + userName
+ + '\''
+ + ", serviceName='"
+ + serviceName
+ + '\''
+ + '}';
+ }
}
diff --git a/linkis-extensions/linkis-et-monitor/src/main/java/org/apache/linkis/monitor/scan/app/monitor/scheduled/BmlClear.java b/linkis-extensions/linkis-et-monitor/src/main/java/org/apache/linkis/monitor/scan/app/monitor/scheduled/BmlClear.java
index 75d415ac0d..11ee06226f 100644
--- a/linkis-extensions/linkis-et-monitor/src/main/java/org/apache/linkis/monitor/scan/app/monitor/scheduled/BmlClear.java
+++ b/linkis-extensions/linkis-et-monitor/src/main/java/org/apache/linkis/monitor/scan/app/monitor/scheduled/BmlClear.java
@@ -29,7 +29,6 @@
import org.slf4j.Logger;
-
@Component
@PropertySource(value = "classpath:linkis-et-monitor.properties", encoding = "UTF-8")
public class BmlClear {
diff --git a/linkis-extensions/linkis-et-monitor/src/main/java/org/apache/linkis/monitor/scan/app/monitor/scheduled/EcRecordClear.java b/linkis-extensions/linkis-et-monitor/src/main/java/org/apache/linkis/monitor/scan/app/monitor/scheduled/EcRecordClear.java
index dced6117b1..ac9cb4ea61 100644
--- a/linkis-extensions/linkis-et-monitor/src/main/java/org/apache/linkis/monitor/scan/app/monitor/scheduled/EcRecordClear.java
+++ b/linkis-extensions/linkis-et-monitor/src/main/java/org/apache/linkis/monitor/scan/app/monitor/scheduled/EcRecordClear.java
@@ -30,9 +30,7 @@
import org.slf4j.Logger;
-/***
- * Task: clean up linkis_cg_ec_resource_info_record data
- */
+/** * Task: clean up linkis_cg_ec_resource_info_record data */
@Component
@PropertySource(value = "classpath:linkis-et-monitor.properties", encoding = "UTF-8")
public class EcRecordClear {
diff --git a/linkis-extensions/linkis-et-monitor/src/main/java/org/apache/linkis/monitor/scan/app/monitor/scheduled/JobHistoryClear.java b/linkis-extensions/linkis-et-monitor/src/main/java/org/apache/linkis/monitor/scan/app/monitor/scheduled/JobHistoryClear.java
index 4880a600cc..ae14770420 100644
--- a/linkis-extensions/linkis-et-monitor/src/main/java/org/apache/linkis/monitor/scan/app/monitor/scheduled/JobHistoryClear.java
+++ b/linkis-extensions/linkis-et-monitor/src/main/java/org/apache/linkis/monitor/scan/app/monitor/scheduled/JobHistoryClear.java
@@ -30,9 +30,7 @@
import org.slf4j.Logger;
-/***
- * Task: clean up linkis_ps_job_history_group_history data
- */
+/** * Task: clean up linkis_ps_job_history_group_history data */
@Component
@PropertySource(value = "classpath:linkis-et-monitor.properties", encoding = "UTF-8")
public class JobHistoryClear {
diff --git a/linkis-extensions/linkis-et-monitor/src/main/java/org/apache/linkis/monitor/scan/app/monitor/scheduled/JobHistoryMonitor.java b/linkis-extensions/linkis-et-monitor/src/main/java/org/apache/linkis/monitor/scan/app/monitor/scheduled/JobHistoryMonitor.java
index 01873a988b..fbca945a8d 100644
--- a/linkis-extensions/linkis-et-monitor/src/main/java/org/apache/linkis/monitor/scan/app/monitor/scheduled/JobHistoryMonitor.java
+++ b/linkis-extensions/linkis-et-monitor/src/main/java/org/apache/linkis/monitor/scan/app/monitor/scheduled/JobHistoryMonitor.java
@@ -25,8 +25,8 @@
import org.apache.linkis.monitor.scan.app.jobhistory.jobtime.JobTimeExceedRule;
import org.apache.linkis.monitor.scan.app.jobhistory.labels.JobHistoryLabelsAlertSender;
import org.apache.linkis.monitor.scan.app.jobhistory.labels.JobHistoryLabelsRule;
-import org.apache.linkis.monitor.scan.app.jobhistory.runtime.CommonRunTimeAlertSender;
import org.apache.linkis.monitor.scan.app.jobhistory.runtime.CommonJobRunTimeRule;
+import org.apache.linkis.monitor.scan.app.jobhistory.runtime.CommonRunTimeAlertSender;
import org.apache.linkis.monitor.scan.app.jobhistory.runtime.JobHistoryRunTimeAlertSender;
import org.apache.linkis.monitor.scan.app.jobhistory.runtime.JobHistoryRunTimeRule;
import org.apache.linkis.monitor.scan.app.monitor.config.MonitorConfig;
@@ -37,7 +37,7 @@
import org.apache.linkis.monitor.scan.core.scanner.DefaultScanner;
import org.apache.linkis.monitor.scan.utils.alert.AlertDesc;
import org.apache.linkis.monitor.scan.utils.alert.ims.ImsAlertDesc;
-import org.apache.linkis.monitor.scan.utils.alert.ims.JobHistoryScanImsAlertPropFileParserUtils;
+import org.apache.linkis.monitor.scan.utils.alert.ims.MonitorAlertUtils;
import org.apache.linkis.monitor.scan.utils.alert.ims.UserLabelAlertUtils;
import org.apache.linkis.monitor.scan.utils.log.LogUtils;
@@ -49,216 +49,219 @@
import org.slf4j.Logger;
-/***
- * jobHistory monitor
- * 1.errorCode: Monitor the error code
- * 2.userLabel: tenant label monitoring, scan the execution data within the first 20 minutes, and judge the labels field of the data
- * 3.jobResultRunTime: Scan the execution data within the first 20 minutes, and judge the completed tasks. If the parm field in the jobhistory contains (task.notification.conditions) and the result of executing the task is (Succeed, Failed, Canceled, Timeout, ALL) any one of them, an alarm is triggered and the result of the job is that it has ended. All three are indispensable
- * 4.jobResultRunTimeForDSS: Scan the execution data within the first 20 minutes, scan the tasks that have been marked for notification, if the task has ended, a notification will be initiated
- * 5.jobHistoryUnfinishedScan: monitor the status of the execution task, scan the data outside 12 hours and within 24 hours
+/**
+ * * jobHistory monitor 1.errorCode: Monitor the error code 2.userLabel: tenant label monitoring,
+ * scan the execution data within the first 20 minutes, and judge the labels field of the data
+ * 3.jobResultRunTime: Scan the execution data within the first 20 minutes, and judge the completed
+ * tasks. If the parm field in the jobhistory contains (task.notification.conditions) and the result
+ * of executing the task is (Succeed, Failed, Canceled, Timeout, ALL) any one of them, an alarm is
+ * triggered and the result of the job is that it has ended. All three are indispensable
+ * 4.jobResultRunTimeForDSS: Scan the execution data within the first 20 minutes, scan the tasks
+ * that have been marked for notification, if the task has ended, a notification will be initiated
+ * 5.jobHistoryUnfinishedScan: monitor the status of the execution task, scan the data outside 12
+ * hours and within 24 hours
*/
@Component
@PropertySource(value = "classpath:linkis-et-monitor.properties", encoding = "UTF-8")
public class JobHistoryMonitor {
- private static final Logger logger = LogUtils.stdOutLogger();
- private static final long backtrackNum = 1000000L;
+ private static final Logger logger = LogUtils.stdOutLogger();
+ private static final long backtrackNum = 1000000L;
- /**
- * Scan tasks completed within 20 minutes
- */
- @Scheduled(cron = "0 0/10 * * * ?")
- public void jobHistoryFinishedScan() {
- long intervalMs = 20 * 60 * 1000; // 20分钟
- long maxIntervalMs = Constants.MAX_INTERVALS_SECONDS() * 1000;
- long endTime = System.currentTimeMillis();
- long startTime = endTime - intervalMs;
- long realIntervals = endTime - startTime < maxIntervalMs ? endTime - startTime : maxIntervalMs;
- AnomalyScanner scanner = new DefaultScanner();
- boolean shouldStart = false;
- long id;
- if (null == CacheUtils.cacheBuilder.getIfPresent("jobHistoryId")) {
- //20230206:新增获取最大值-100W 作为初始id进行查询,防止慢查询
- long maxId = MapperFactory.getJobHistoryMapper().selectMaxId();
- long beginId = 0L;
- if (maxId > backtrackNum) {
- beginId = maxId - backtrackNum;
- }
- id = MapperFactory.getJobHistoryMapper().selectIdByHalfDay(beginId);
- CacheUtils.cacheBuilder.put("jobHistoryId", id);
- } else {
- id = CacheUtils.cacheBuilder.getIfPresent("jobHistoryId");
- }
- List fetchers = generateFetchersfortime(startTime, endTime, id, "updated_time");
- if (fetchers == null) {
- logger.warn("generated 0 dataFetchers, plz check input");
- return;
- }
- // errorCode
- try {
- Map errorCodeAlerts = JobHistoryScanImsAlertPropFileParserUtils.getAlerts(Constants.SCAN_PREFIX_ERRORCODE());
-
- if (errorCodeAlerts == null || errorCodeAlerts.size() == 0) {
- logger.info("[INFO] Loaded 0 errorcode alert from alert-rule properties file.");
- } else {
- logger.info(
- "[INFO] Loaded {} errorcode alert from alert-rules properties file.",
- errorCodeAlerts.size());
- shouldStart = true;
- addIntervalToImsAlerts(errorCodeAlerts, realIntervals);
- JobHistoryErrCodeRule jobHistoryErrCodeRule =
- new JobHistoryErrCodeRule(
- errorCodeAlerts.keySet(), new JobHistoryErrorCodeAlertSender(errorCodeAlerts));
- scanner.addScanRule(jobHistoryErrCodeRule);
- }
- } catch (Exception e) {
- logger.warn("Jobhistory Monitor ErrorCode Faily: "+ e.getMessage());
- }
- // userLabel
- try {
- Map userLabelAlerts =
- UserLabelAlertUtils.getAlerts(Constants.USER_LABEL_MONITOR(), "");
- if (userLabelAlerts == null || userLabelAlerts.size() == 0) {
- logger.info("[INFO] Loaded 0 alerts userLabel alert-rule from alert properties file.");
- } else {
- logger.info(
- "[INFO] Loaded {} alerts userLabel alert-rules from alert properties file.",
- userLabelAlerts.size());
- shouldStart = true;
- JobHistoryLabelsRule jobHistoryLabelsRule =
- new JobHistoryLabelsRule(new JobHistoryLabelsAlertSender());
- scanner.addScanRule(jobHistoryLabelsRule);
- }
- } catch (Exception e) {
- logger.warn("Jobhistory Monitor UserLabel Faily: "+ e.getMessage());
- }
- // jobResultRunTime
- try {
- Map jobResultAlerts =
- JobHistoryScanImsAlertPropFileParserUtils.getAlerts(Constants.SCAN_PREFIX_ERRORCODE());
- if (jobResultAlerts == null || jobResultAlerts.size() == 0) {
- logger.info("[INFO] Loaded 0 jobResult alert from alert-rule properties file.");
- } else {
- logger.info(
- "[INFO] Loaded {} alerts jobResult alert-rules from alert properties file.",
- jobResultAlerts.size());
- shouldStart = true;
- JobHistoryRunTimeRule jobHistoryRunTimeRule =
- new JobHistoryRunTimeRule(new JobHistoryRunTimeAlertSender());
- scanner.addScanRule(jobHistoryRunTimeRule);
- }
- } catch (Exception e) {
- logger.warn("Jobhistory Monitor JobResultRunTime Faily: "+ e.getMessage());
- }
- // jobResultRunTimeForDSS
- try {
- Map dssJobResultAlerts =
- JobHistoryScanImsAlertPropFileParserUtils.getAlerts(Constants.SCAN_PREFIX_ERRORCODE());
- if (dssJobResultAlerts == null || dssJobResultAlerts.size() == 0) {
- logger.info("[INFO] Loaded 0 jobResult alert from alert-rule properties file.");
- } else {
- logger.info(
- "[INFO] Loaded {} alerts jobResult alert-rules from alert properties file.",
- dssJobResultAlerts.size());
- shouldStart = true;
+ /** Scan tasks completed within 20 minutes */
+ @Scheduled(cron = "0 0/10 * * * ?")
+ public void jobHistoryFinishedScan() {
+ long intervalMs = 20 * 60 * 1000; // 20分钟
+ long maxIntervalMs = Constants.ERRORCODE_MAX_INTERVALS_SECONDS() * 1000;
+ long endTime = System.currentTimeMillis();
+ long startTime = endTime - intervalMs;
+ long realIntervals = endTime - startTime < maxIntervalMs ? endTime - startTime : maxIntervalMs;
+ AnomalyScanner scanner = new DefaultScanner();
+ boolean shouldStart = false;
+ long id;
+ if (null == CacheUtils.cacheBuilder.getIfPresent("jobHistoryId")) {
+ long maxId = MapperFactory.getJobHistoryMapper().selectMaxId();
+ long beginId = 0L;
+ if (maxId > backtrackNum) {
+ beginId = maxId - backtrackNum;
+ }
+ id = MapperFactory.getJobHistoryMapper().selectIdByHalfDay(beginId);
+ CacheUtils.cacheBuilder.put("jobHistoryId", id);
+ } else {
+ id = CacheUtils.cacheBuilder.getIfPresent("jobHistoryId");
+ }
+ List fetchers = generateFetchersfortime(startTime, endTime, id, "updated_time");
+ if (fetchers == null) {
+ logger.warn("generated 0 dataFetchers, plz check input");
+ return;
+ }
+ // errorCode
+ try {
+ Map errorCodeAlerts =
+ MonitorAlertUtils.getAlerts(Constants.SCAN_PREFIX_ERRORCODE(), null);
- CommonJobRunTimeRule commonJobRunTimeRule =
- new CommonJobRunTimeRule(new CommonRunTimeAlertSender());
- scanner.addScanRule(commonJobRunTimeRule);
- }
- } catch (Exception e) {
- logger.warn("Jobhistory JobResultRunTimeForDSS ErrorCode Faily: "+ e.getMessage());
- }
- run(scanner, fetchers, shouldStart);
+ if (errorCodeAlerts == null || errorCodeAlerts.size() == 0) {
+ logger.info("[INFO] Loaded 0 errorcode alert from alert-rule properties file.");
+ } else {
+ logger.info(
+ "[INFO] Loaded {} errorcode alert from alert-rules properties file.",
+ errorCodeAlerts.size());
+ shouldStart = true;
+ addIntervalToImsAlerts(errorCodeAlerts, realIntervals);
+ JobHistoryErrCodeRule jobHistoryErrCodeRule =
+ new JobHistoryErrCodeRule(
+ errorCodeAlerts.keySet(), new JobHistoryErrorCodeAlertSender(errorCodeAlerts));
+ scanner.addScanRule(jobHistoryErrCodeRule);
+ }
+ } catch (Exception e) {
+ logger.warn("Jobhistory Monitor ErrorCode Faily: " + e.getMessage());
+ }
+ // userLabel
+ try {
+ Map userLabelAlerts =
+ UserLabelAlertUtils.getAlerts(Constants.USER_LABEL_MONITOR(), "");
+ if (userLabelAlerts == null || userLabelAlerts.size() == 0) {
+ logger.info("[INFO] Loaded 0 alerts userLabel alert-rule from alert properties file.");
+ } else {
+ logger.info(
+ "[INFO] Loaded {} alerts userLabel alert-rules from alert properties file.",
+ userLabelAlerts.size());
+ shouldStart = true;
+ JobHistoryLabelsRule jobHistoryLabelsRule =
+ new JobHistoryLabelsRule(new JobHistoryLabelsAlertSender());
+ scanner.addScanRule(jobHistoryLabelsRule);
+ }
+ } catch (Exception e) {
+ logger.warn("Jobhistory Monitor UserLabel Faily: " + e.getMessage());
+ }
+ // jobResultRunTime
+ try {
+ Map jobResultAlerts =
+ MonitorAlertUtils.getAlerts((Constants.SCAN_PREFIX_ERRORCODE()), null);
+ if (jobResultAlerts == null || jobResultAlerts.size() == 0) {
+ logger.info("[INFO] Loaded 0 jobResult alert from alert-rule properties file.");
+ } else {
+ logger.info(
+ "[INFO] Loaded {} alerts jobResult alert-rules from alert properties file.",
+ jobResultAlerts.size());
+ shouldStart = true;
+ JobHistoryRunTimeRule jobHistoryRunTimeRule =
+ new JobHistoryRunTimeRule(new JobHistoryRunTimeAlertSender());
+ scanner.addScanRule(jobHistoryRunTimeRule);
+ }
+ } catch (Exception e) {
+ logger.warn("Jobhistory Monitor JobResultRunTime Faily: " + e.getMessage());
}
+ // jobResultRunTimeForDSS
+ try {
+ Map dssJobResultAlerts =
+ MonitorAlertUtils.getAlerts((Constants.SCAN_PREFIX_ERRORCODE()), null);
+ if (dssJobResultAlerts == null || dssJobResultAlerts.size() == 0) {
+ logger.info("[INFO] Loaded 0 jobResult alert from alert-rule properties file.");
+ } else {
+ logger.info(
+ "[INFO] Loaded {} alerts jobResult alert-rules from alert properties file.",
+ dssJobResultAlerts.size());
+ shouldStart = true;
- /***
- * Whether scanning data within 12 hours has timed out
- */
- @Scheduled(cron = "${linkis.monitor.jobHistory.ScanTask.cron}")
- public void jobHistoryUnfinishedScan() {
- long id =
- Optional.ofNullable(CacheUtils.cacheBuilder.getIfPresent("jobhistoryScan"))
- .orElse(MonitorConfig.JOB_HISTORY_TIME_EXCEED.getValue());
- long intervalMs = Constants.SCAN_INTERVALS_SECONDS() * 1000;
- long maxIntervalMs = Constants.MAX_INTERVALS_SECONDS() * 1000;
- long endTime = System.currentTimeMillis();
- long startTime = endTime - intervalMs;
- long realIntervals = endTime - startTime < maxIntervalMs ? endTime - startTime : maxIntervalMs;
- AnomalyScanner scanner = new DefaultScanner();
- boolean shouldStart = false;
- List fetchers = generateFetchers(startTime, endTime, maxIntervalMs, id, "created_time");
- if (fetchers == null) {
- logger.warn("generated 0 dataFetchers, plz check input");
- return;
- }
- Map jobTimeAlerts =
- JobHistoryScanImsAlertPropFileParserUtils.getAlerts(
- Constants.SCAN_PREFIX_UNFINISHED_JOBTIME_EXCEED_SEC());
- if (jobTimeAlerts == null || jobTimeAlerts.size() == 0) {
- logger.info("[INFO] Loaded 0 alerts jobtime alert-rule from alert properties file.");
- } else {
- logger.info(
- "[INFO] Loaded {} alerts jobtime alert-rules from alert properties file.",
- jobTimeAlerts.size());
- shouldStart = true;
- addIntervalToImsAlerts(jobTimeAlerts, realIntervals);
- JobTimeExceedRule jobTimeExceedRule =
- new JobTimeExceedRule(
- jobTimeAlerts.keySet(), new JobTimeExceedAlertSender(jobTimeAlerts));
- scanner.addScanRule(jobTimeExceedRule);
- }
- run(scanner, fetchers, shouldStart);
+ CommonJobRunTimeRule commonJobRunTimeRule =
+ new CommonJobRunTimeRule(new CommonRunTimeAlertSender());
+ scanner.addScanRule(commonJobRunTimeRule);
+ }
+ } catch (Exception e) {
+ logger.warn("Jobhistory JobResultRunTimeForDSS ErrorCode Faily: " + e.getMessage());
}
+ run(scanner, fetchers, shouldStart);
+ }
- public static void run(AnomalyScanner scanner, List fetchers, Boolean shouldStart) {
- if (shouldStart) {
- scanner.addDataFetchers(fetchers);
- scanner.run();
- // scanner.shutdown(); // wait all alert to be send
- }
+ /** * Whether scanning data within 12 hours has timed out */
+ @Scheduled(cron = "${linkis.monitor.jobHistory.ScanTask.cron}")
+ public void jobHistoryUnfinishedScan() {
+ long id =
+ Optional.ofNullable(CacheUtils.cacheBuilder.getIfPresent("jobhistoryScan"))
+ .orElse(MonitorConfig.JOB_HISTORY_TIME_EXCEED.getValue());
+ long intervalMs = Constants.ERRORCODE_SCAN_INTERVALS_SECONDS() * 1000;
+ long maxIntervalMs = Constants.ERRORCODE_MAX_INTERVALS_SECONDS() * 1000;
+ long endTime = System.currentTimeMillis();
+ long startTime = endTime - intervalMs;
+ long realIntervals = endTime - startTime < maxIntervalMs ? endTime - startTime : maxIntervalMs;
+ AnomalyScanner scanner = new DefaultScanner();
+ boolean shouldStart = false;
+ List fetchers =
+ generateFetchers(startTime, endTime, maxIntervalMs, id, "created_time");
+ if (fetchers == null) {
+ logger.warn("generated 0 dataFetchers, plz check input");
+ return;
}
+ Map jobTimeAlerts =
+ MonitorAlertUtils.getAlerts((Constants.SCAN_PREFIX_UNFINISHED_JOBTIME_EXCEED_SEC()), null);
+ if (jobTimeAlerts == null || jobTimeAlerts.size() == 0) {
+ logger.info("[INFO] Loaded 0 alerts jobtime alert-rule from alert properties file.");
+ } else {
+ logger.info(
+ "[INFO] Loaded {} alerts jobtime alert-rules from alert properties file.",
+ jobTimeAlerts.size());
+ shouldStart = true;
+ addIntervalToImsAlerts(jobTimeAlerts, realIntervals);
+ JobTimeExceedRule jobTimeExceedRule =
+ new JobTimeExceedRule(
+ jobTimeAlerts.keySet(), new JobTimeExceedAlertSender(jobTimeAlerts));
+ scanner.addScanRule(jobTimeExceedRule);
+ }
+ run(scanner, fetchers, shouldStart);
+ }
- private static List generateFetchers(
- long startTime, long endTime, long maxIntervalMs, long id, String timeType) {
- List ret = new ArrayList<>();
- long pe = endTime;
- long ps;
- while (pe > startTime) {
- ps = pe - maxIntervalMs > startTime ? pe - maxIntervalMs : startTime;
- String[] fetcherArgs =
- new String[]{String.valueOf(ps), String.valueOf(pe), String.valueOf(id), timeType};
- ret.add(new JobHistoryDataFetcher(fetcherArgs, MapperFactory.getJobHistoryMapper()));
- logger.info(
- "Generated dataFetcher for startTime: "
- + new Date(ps).toString()
- + ". EndTime: "
- + new Date(pe).toString());
- pe = pe - maxIntervalMs;
- }
- return ret;
+ public static void run(AnomalyScanner scanner, List fetchers, Boolean shouldStart) {
+ if (shouldStart) {
+ scanner.addDataFetchers(fetchers);
+ scanner.run();
+ // scanner.shutdown(); // wait all alert to be send
}
+ }
- private static List generateFetchersfortime(long startTime, long endTime, long id, String timeType) {
- List fetchers = new ArrayList<>();
- String[] fetcherArgs =
- new String[]{String.valueOf(startTime), String.valueOf(endTime), String.valueOf(id), timeType};
- fetchers.add(new JobHistoryDataFetcher(fetcherArgs, MapperFactory.getJobHistoryMapper()));
- logger.info(
- "Generated dataFetcher for startTime: "
- + new Date(startTime).toString()
- + ". EndTime: "
- + new Date(endTime).toString());
- return fetchers;
+ private static List generateFetchers(
+ long startTime, long endTime, long maxIntervalMs, long id, String timeType) {
+ List ret = new ArrayList<>();
+ long pe = endTime;
+ long ps;
+ while (pe > startTime) {
+ ps = pe - maxIntervalMs > startTime ? pe - maxIntervalMs : startTime;
+ String[] fetcherArgs =
+ new String[] {String.valueOf(ps), String.valueOf(pe), String.valueOf(id), timeType};
+ ret.add(new JobHistoryDataFetcher(fetcherArgs, MapperFactory.getJobHistoryMapper()));
+ logger.info(
+ "Generated dataFetcher for startTime: "
+ + new Date(ps).toString()
+ + ". EndTime: "
+ + new Date(pe).toString());
+ pe = pe - maxIntervalMs;
}
+ return ret;
+ }
+
+ private static List generateFetchersfortime(
+ long startTime, long endTime, long id, String timeType) {
+ List fetchers = new ArrayList<>();
+ String[] fetcherArgs =
+ new String[] {
+ String.valueOf(startTime), String.valueOf(endTime), String.valueOf(id), timeType
+ };
+ fetchers.add(new JobHistoryDataFetcher(fetcherArgs, MapperFactory.getJobHistoryMapper()));
+ logger.info(
+ "Generated dataFetcher for startTime: "
+ + new Date(startTime).toString()
+ + ". EndTime: "
+ + new Date(endTime).toString());
+ return fetchers;
+ }
- private static void addIntervalToImsAlerts(Map alerts, long realIntervals) {
- for (AlertDesc alert : alerts.values()) {
- if (!(alert instanceof ImsAlertDesc)) {
- logger.info("[warn] ignore wrong alert" + alert);
- } else {
- ((ImsAlertDesc) alert).hitIntervalMs_$eq(realIntervals);
- }
- }
+ private static void addIntervalToImsAlerts(Map alerts, long realIntervals) {
+ for (AlertDesc alert : alerts.values()) {
+ if (!(alert instanceof ImsAlertDesc)) {
+ logger.info("[warn] ignore wrong alert" + alert);
+ } else {
+ ((ImsAlertDesc) alert).hitIntervalMs_$eq(realIntervals);
+ }
}
+ }
}
diff --git a/linkis-extensions/linkis-et-monitor/src/main/java/org/apache/linkis/monitor/scan/app/monitor/scheduled/ResourceMonitor.java b/linkis-extensions/linkis-et-monitor/src/main/java/org/apache/linkis/monitor/scan/app/monitor/scheduled/ResourceMonitor.java
index b7066ba420..459aaf70ff 100644
--- a/linkis-extensions/linkis-et-monitor/src/main/java/org/apache/linkis/monitor/scan/app/monitor/scheduled/ResourceMonitor.java
+++ b/linkis-extensions/linkis-et-monitor/src/main/java/org/apache/linkis/monitor/scan/app/monitor/scheduled/ResourceMonitor.java
@@ -41,9 +41,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-/***
- * Monitor the usage of ECM resources for monitoring and metrics reporting
- */
+/** * Monitor the usage of ECM resources for monitoring and metrics reporting */
@Component
@PropertySource(value = "classpath:linkis-et-monitor.properties", encoding = "UTF-8")
public class ResourceMonitor {
@@ -68,7 +66,7 @@ public void ecmResourceTask() {
List