[collector] jsonPath解析http响应数据和calculates表达式计算实现

This commit is contained in:
tomsun28
2021-11-20 18:13:16 +08:00
parent 116e4ed13d
commit 78527d48a6
6 changed files with 57 additions and 9 deletions

View File

@@ -98,6 +98,10 @@ public class Metrics {
* 指标类型 number:数字 string:字符串
*/
private String type;
/**
* 此字段是否为实例主键
*/
private boolean instance = false;
/**
* 指标单位
*/

View File

@@ -57,4 +57,9 @@ public interface CommonConstants {
*/
byte SUSPENDING = 0x04;
/**
* null空值占位符
*/
String NULL_VALUE = " ";
}

View File

@@ -0,0 +1,30 @@
package com.usthe.common.util;
import lombok.extern.slf4j.Slf4j;
/**
* 公共工具类
* @author tomsun28
* @date 2021/11/20 17:29
*/
@Slf4j
public class CommonUtil {
/**
* 将字符串str转换为double数字类型
* @param str string
* @return double 数字
*/
public static Double parseDoubleStr(String str) {
if (str == null || "".equals(str)) {
return null;
}
try {
return Double.parseDouble(str);
} catch (Exception e) {
log.debug(e.getMessage(), e);
return null;
}
}
}

View File

@@ -45,6 +45,9 @@ public class IpDomainUtil {
* @return 存在true
*/
public static boolean isHasSchema(String domainIp) {
if (domainIp == null || "".equals(domainIp)) {
return false;
}
return DOMAIN_SCHEMA.matcher(domainIp).matches();
}