优化监控看板、初始化mtr模块
This commit is contained in:
+34
-13
@@ -215,7 +215,10 @@ public class EchartsDataUtils {
|
||||
if ("percentile95".equals(metricName) && !fixedPercentile95Value.equals(0)) {
|
||||
return fixedPercentile95Value;
|
||||
}
|
||||
|
||||
// deployDevice特殊处理
|
||||
if ("deployDevice".equals(metricName)) {
|
||||
return fixedPercentile95Value;
|
||||
}
|
||||
// 智能补全策略
|
||||
if (hasRealData) {
|
||||
// 数据集中有真实数据:所有缺失点都补null
|
||||
@@ -259,7 +262,11 @@ public class EchartsDataUtils {
|
||||
dataNames.forEach(name -> {
|
||||
List<Object> seriesData = new ArrayList<>();
|
||||
for (int i = 0; i < dataSize; i++) {
|
||||
if (i == 0) {
|
||||
// deployDevice特殊处理:始终补空字符串
|
||||
if ("deployDevice".equals(name)) {
|
||||
seriesData.add("");
|
||||
}
|
||||
else if (i == 0) {
|
||||
// 第一个点补0
|
||||
seriesData.add(0);
|
||||
} else {
|
||||
@@ -291,21 +298,35 @@ public class EchartsDataUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* 查找percentile95的固定值(第一个非零值)
|
||||
* 查找特殊字段的固定值
|
||||
* percentile95: 第一个非零值
|
||||
* deployDevice: 第一个非空值,没值填充空字符串
|
||||
*/
|
||||
private static <T> Object findFixedValueForPercentile95(List<T> list, Map<String, Function<T, ?>> dataExtractors) {
|
||||
if (!dataExtractors.containsKey("percentile95")) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
Function<T, ?> extractor = dataExtractors.get("percentile95");
|
||||
for (T item : list) {
|
||||
Object value = extractor.apply(item);
|
||||
if (value != null) {
|
||||
return value;
|
||||
// 处理percentile95字段
|
||||
if (dataExtractors.containsKey("percentile95")) {
|
||||
Function<T, ?> extractor = dataExtractors.get("percentile95");
|
||||
for (T item : list) {
|
||||
Object value = extractor.apply(item);
|
||||
if (value != null && !isZeroValue(value)) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
||||
// 处理deployDevice字段
|
||||
if (dataExtractors.containsKey("deployDevice")) {
|
||||
Function<T, ?> extractor = dataExtractors.get("deployDevice");
|
||||
for (T item : list) {
|
||||
Object value = extractor.apply(item);
|
||||
if (value != null) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
return ""; // deployDevice没值返回空字符串
|
||||
}
|
||||
|
||||
return 0; // 默认返回0
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+1
-1
@@ -155,7 +155,7 @@ public class SpeedUtils {
|
||||
throws NoSuchFieldException, IllegalAccessException {
|
||||
|
||||
if (list == null || list.isEmpty()) {
|
||||
return null;
|
||||
return "Kb";
|
||||
}
|
||||
|
||||
BigDecimal totalInSpeedBit = BigDecimal.ZERO;
|
||||
|
||||
Reference in New Issue
Block a user