diff --git a/collector/src/main/java/org/dromara/hertzbeat/collector/util/CollectUtil.java b/collector/src/main/java/org/dromara/hertzbeat/collector/util/CollectUtil.java index dc2dc001dc7..be71bc1fc67 100644 --- a/collector/src/main/java/org/dromara/hertzbeat/collector/util/CollectUtil.java +++ b/collector/src/main/java/org/dromara/hertzbeat/collector/util/CollectUtil.java @@ -47,7 +47,7 @@ public class CollectUtil { private static final String CRYING_PLACEHOLDER_REX = "\\^o\\^"; private static final String CRYING_PLACEHOLDER_REGEX = "(\\^o\\^)(\\w|-|$|\\.)+(\\^o\\^)"; private static final Pattern CRYING_PLACEHOLDER_REGEX_PATTERN = Pattern.compile(CRYING_PLACEHOLDER_REGEX); - private static final List UNIT_SYMBOLS = Arrays.asList("G", "g", "M", "m", "K", "k", "B", "b", "%"); + private static final List UNIT_SYMBOLS = Arrays.asList("%","G", "g", "M", "m", "K", "k", "B", "b"); /** * 关键字匹配计数 @@ -89,16 +89,16 @@ public static DoubleAndUnit extractDoubleAndUnitFromStr(String str) { // B KB MB GB % .... for (String unitSymbol : UNIT_SYMBOLS) { int index = str.indexOf(unitSymbol); - if (index > 0) { - Double doubleValue = Double.parseDouble(str.substring(0, index)); - String unit = str.substring(index).trim(); + if (index == 0) { + Double doubleValue = 0d; + String unit = str.trim(); doubleAndUnit.setValue(doubleValue); doubleAndUnit.setUnit(unit); return doubleAndUnit; } - if (index == 0) { - Double doubleValue = 0d; - String unit = str.trim(); + if (index > 0) { + Double doubleValue = Double.parseDouble(str.substring(0, index)); + String unit = str.substring(index).trim(); doubleAndUnit.setValue(doubleValue); doubleAndUnit.setUnit(unit); return doubleAndUnit; diff --git a/manager/src/main/resources/define/app-postgresql.yml b/manager/src/main/resources/define/app-postgresql.yml index 56a030e8aee..5024112e06e 100644 --- a/manager/src/main/resources/define/app-postgresql.yml +++ b/manager/src/main/resources/define/app-postgresql.yml @@ -176,9 +176,6 @@ metrics: priority: 1 fields: # 指标信息 包括 field名称 type字段类型:0-number数字,1-string字符串 instance是否为实例主键 unit:指标单位 - - field: shared_buffers - type: 0 - unit: MB - field: work_mem type: 0 unit: MB