diff --git a/framework/sdk-parent/frontend/src/components/resource-pool/NodeOperationLabel.vue b/framework/sdk-parent/frontend/src/components/resource-pool/NodeOperationLabel.vue index 162d952138..5f53d38556 100644 --- a/framework/sdk-parent/frontend/src/components/resource-pool/NodeOperationLabel.vue +++ b/framework/sdk-parent/frontend/src/components/resource-pool/NodeOperationLabel.vue @@ -11,9 +11,9 @@ + style="color:#E5594B"> {{ " CPU:" + nodeOperationInfo.cpuUsage }} - + {{ " CPU:" + nodeOperationInfo.cpuUsage }} diff --git a/framework/sdk-parent/sdk/src/main/java/io/metersphere/service/PrometheusService.java b/framework/sdk-parent/sdk/src/main/java/io/metersphere/service/PrometheusService.java index 4b221e63e1..266a4d291f 100644 --- a/framework/sdk-parent/sdk/src/main/java/io/metersphere/service/PrometheusService.java +++ b/framework/sdk-parent/sdk/src/main/java/io/metersphere/service/PrometheusService.java @@ -78,9 +78,6 @@ public class PrometheusService { ResourcePoolOperationInfo nodeOperationInfo = new ResourcePoolOperationInfo(); nodeOperationInfo.setId(testResourcePoolDTO.getId()); - //如果没有在prometheus查到数据则runningTask为-1。 - int runningTask = -1; - for (TestResource testResource : testResourcePoolDTO.getResources()) { String config = testResource.getConfiguration(); try { @@ -105,13 +102,11 @@ public class PrometheusService { }}; String taskCountQL = this.generatePromQL(taskSeriesNames.toArray(new String[0]), nodeId); String result = this.runPromQL(headers, host, taskCountQL); + if (StringUtils.isNotBlank(result)) { - if (runningTask == -1) { - runningTask = 0; - } - runningTask += Integer.parseInt(result); + int taskResult = Integer.parseInt(result); + nodeOperationInfo.addNodeOperationInfo(String.valueOf(configMap.get("id")), ip, port, cpuUsage, taskResult); } - nodeOperationInfo.addNodeOperationInfo(String.valueOf(configMap.get("id")), ip, port, cpuUsage, runningTask); } } catch (Exception e) { LogUtil.error("查找node监控报错:" + testResourcePoolDTO.getName(), e); diff --git a/performance-test/frontend/src/business/test/components/PerformancePressureConfig.vue b/performance-test/frontend/src/business/test/components/PerformancePressureConfig.vue index 10d9fa9457..3f8d556f24 100644 --- a/performance-test/frontend/src/business/test/components/PerformancePressureConfig.vue +++ b/performance-test/frontend/src/business/test/components/PerformancePressureConfig.vue @@ -240,7 +240,20 @@ {{ - " " + $t("commons.cpu_usage") + " " + nodeCpuUsage(resourceNodes[threadGroup.resourceNodeIndex]) + " " + $t("commons.cpu_usage") + }} + + + + {{ + nodeCpuUsage(resourceNodes[threadGroup.resourceNodeIndex]) + }} + + + {{ + nodeCpuUsage(resourceNodes[threadGroup.resourceNodeIndex]) }} @@ -254,11 +267,11 @@