diff --git a/collector/src/main/java/com/usthe/collector/dispatch/CommonDispatcher.java b/collector/src/main/java/com/usthe/collector/dispatch/CommonDispatcher.java index 1fe936d7d99..bb7d8f44f88 100644 --- a/collector/src/main/java/com/usthe/collector/dispatch/CommonDispatcher.java +++ b/collector/src/main/java/com/usthe/collector/dispatch/CommonDispatcher.java @@ -219,8 +219,9 @@ public void dispatchCollectData(Timeout timeout, Metrics metrics, CollectRep.Met // If the availability collection fails, the next indicator group scheduling will be cancelled and the next round of scheduling will be entered directly. // 若metricsSet为null表示执行完成 // 或判断采集指标组是否优先级为0,即为可用性采集指标组 若可用性采集失败 则取消后面的指标组调度直接进入下一轮调度 - if (metricsSet == null - || (metrics.getPriority() == (byte) 0 && metricsData.getCode() != CollectRep.Code.SUCCESS)) { + boolean isAvailableCollectFailed = metricsSet != null && !metricsSet.isEmpty() + && metrics.getPriority() == (byte) 0 && metricsData.getCode() != CollectRep.Code.SUCCESS; + if (metricsSet == null || isAvailableCollectFailed) { // The collection and execution of all index groups of this job are completed. // The periodic task pushes the task to the time wheel again. // First, determine the execution time of the task and the task collection interval. diff --git a/common/src/main/java/com/usthe/common/entity/job/Job.java b/common/src/main/java/com/usthe/common/entity/job/Job.java index 928e023aefa..0232f36089e 100644 --- a/common/src/main/java/com/usthe/common/entity/job/Job.java +++ b/common/src/main/java/com/usthe/common/entity/job/Job.java @@ -130,7 +130,7 @@ public class Job { * 127 - lastPriorMetrics */ @JsonIgnore - private transient List> priorMetrics; + private transient LinkedList> priorMetrics; /** * collector use - Temporarily store one-time task indicator group response data @@ -194,11 +194,10 @@ public synchronized Set getNextCollectMetrics(Metrics metrics, boolean if (priorMetrics == null || priorMetrics.isEmpty()) { return null; } - Set metricsSet = priorMetrics.get(0); + Set metricsSet = priorMetrics.peek(); if (first) { if (metricsSet.isEmpty()) { log.error("metrics must has one [availability] metrics at least."); - } return metricsSet; } @@ -211,11 +210,11 @@ public synchronized Set getNextCollectMetrics(Metrics metrics, boolean id, monitorId, app, metrics.getName()); } if (metricsSet.isEmpty()) { - priorMetrics.remove(0); - if (priorMetrics.size() == 0) { + priorMetrics.poll(); + if (priorMetrics.isEmpty()) { return null; } - return priorMetrics.get(0); + return priorMetrics.peek(); } else { return Collections.emptySet(); } diff --git a/manager/src/main/resources/define/app/app-nacos.yml b/manager/src/main/resources/define/app/app-nacos.yml index e3aa2fc3608..4a0bfd28afc 100644 --- a/manager/src/main/resources/define/app/app-nacos.yml +++ b/manager/src/main/resources/define/app/app-nacos.yml @@ -33,7 +33,7 @@ metrics: parseType: jsonPath parseScript: $.measurements[*] - name: memory - priority: 0 + priority: 1 fields: - field: jvm_memory_used type: 0 diff --git a/manager/src/main/resources/define/app/app-zookeeper.yml b/manager/src/main/resources/define/app/app-zookeeper.yml index 7df052c162a..8f3d2a0987e 100644 --- a/manager/src/main/resources/define/app/app-zookeeper.yml +++ b/manager/src/main/resources/define/app/app-zookeeper.yml @@ -102,7 +102,7 @@ metrics: parseType: netcat - name: stats - priority: 0 + priority: 1 # 指标组中的具体监控指标 fields: # 指标信息 包括 field名称 type字段类型:0-number数字,1-string字符串 instance是否为实例主键 unit:指标单位 @@ -163,8 +163,6 @@ metrics: - field: zk_min_latency type: 0 unit: ms - - # 协议 protocol: ssh ssh: