fixed:
1. 修复探测功能初次探测后,影响配置的问题。 2. 修复采集任务异常时,某些状态未处理的问题。 3. 修复数据插入TdEngine时转义的问题。 4. 修复开发环境读取探测配置文件时路径错误的问题
This commit is contained in:
@@ -78,7 +78,13 @@ public class CalculateAlarm {
|
||||
.priority(CommonConstants.ALERT_PRIORITY_CODE_EMERGENCY)
|
||||
.status(CommonConstants.ALERT_STATUS_CODE_PENDING)
|
||||
.times(1);
|
||||
if (metricsData.getCode() == CollectRep.Code.UN_REACHABLE) {
|
||||
if (metricsData.getCode() == CollectRep.Code.UN_AVAILABLE) {
|
||||
// 采集器不可用
|
||||
alertBuilder.target(CommonConstants.AVAILABLE)
|
||||
.content("监控紧急可用性告警: " + metricsData.getCode().name());
|
||||
triggeredMonitorStateAlertMap.put(monitorId, CollectRep.Code.UN_AVAILABLE);
|
||||
dataQueue.addAlertData(alertBuilder.build());
|
||||
} else if (metricsData.getCode() == CollectRep.Code.UN_REACHABLE) {
|
||||
// UN_REACHABLE 对端不可达(网络层icmp)
|
||||
alertBuilder.target(CommonConstants.REACHABLE)
|
||||
.content("监控紧急可达性告警: " + metricsData.getCode().name());
|
||||
@@ -91,8 +97,11 @@ public class CalculateAlarm {
|
||||
triggeredMonitorStateAlertMap.put(monitorId, CollectRep.Code.UN_CONNECTABLE);
|
||||
dataQueue.addAlertData(alertBuilder.build());
|
||||
} else {
|
||||
// todo 其它规范异常 TIMEOUT ...
|
||||
return;
|
||||
// 其他异常
|
||||
alertBuilder.target(CommonConstants.AVAILABLE)
|
||||
.content("监控紧急可用性告警: " + metricsData.getCode().name());
|
||||
triggeredMonitorStateAlertMap.put(monitorId, metricsData.getCode());
|
||||
dataQueue.addAlertData(alertBuilder.build());
|
||||
}
|
||||
return;
|
||||
} else {
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.usthe.common.entity.job;
|
||||
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.google.gson.Gson;
|
||||
import com.usthe.common.entity.message.CollectRep;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
@@ -180,4 +181,11 @@ public class Job {
|
||||
}
|
||||
responseDataTemp.add(metricsData);
|
||||
}
|
||||
|
||||
private static final Gson GSON = new Gson();
|
||||
|
||||
public Job clone(){
|
||||
// 深度克隆
|
||||
return GSON.fromJson(GSON.toJsonTree(this), Job.class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ public class AppServiceImpl implements AppService, CommandLineRunner {
|
||||
if (appDefine == null) {
|
||||
throw new IllegalArgumentException("The app " + app + " not support.");
|
||||
}
|
||||
return appDefine;
|
||||
return appDefine.clone();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -123,7 +123,7 @@ public class AppServiceImpl implements AppService, CommandLineRunner {
|
||||
public void run(String... args) throws Exception {
|
||||
// 读取app定义配置加载到内存中 define/app/*.yml
|
||||
Yaml yaml = new Yaml();
|
||||
String classpath = this.getClass().getResource(File.separator).getPath();
|
||||
String classpath = this.getClass().getClassLoader().getResource("").getPath();
|
||||
String defineAppPath = classpath + File.separator + "define" + File.separator + "app";
|
||||
File directory = new File(defineAppPath);
|
||||
if (!directory.exists() || directory.listFiles() == null) {
|
||||
|
||||
@@ -138,7 +138,7 @@ public class TdEngineDataStorage implements DisposableBean {
|
||||
if (CommonConstants.NULL_VALUE.equals(value)) {
|
||||
sqlRowBuffer.append("NULL");
|
||||
} else {
|
||||
sqlRowBuffer.append("'").append(value).append("'");
|
||||
sqlRowBuffer.append("'").append(formatStringValue(value)).append("'");
|
||||
}
|
||||
}
|
||||
if (index != fields.size() - 1) {
|
||||
@@ -197,7 +197,9 @@ public class TdEngineDataStorage implements DisposableBean {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private String formatStringValue(String value){
|
||||
return value.replaceAll("(\\\\)|(')","\\\\$0");
|
||||
}
|
||||
@Override
|
||||
public void destroy() throws Exception {
|
||||
if (hikariDataSource != null) {
|
||||
|
||||
Reference in New Issue
Block a user