From c8cf75da5cb1de574920f66842ec365e7262756f Mon Sep 17 00:00:00 2001 From: song-tianyang Date: Fri, 20 Oct 2023 12:02:08 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E7=B3=BB=E7=BB=9F=E7=BB=84=E4=BB=B6):?= =?UTF-8?q?=20=E4=BF=AE=E6=94=B9=E6=9F=A5=E8=AF=A2node=E8=8A=82=E7=82=B9?= =?UTF-8?q?=E8=BF=90=E8=A1=8C=E4=BB=BB=E5=8A=A1=E5=87=BD=E6=95=B0=E4=B8=AD?= =?UTF-8?q?=E5=87=BA=E7=8E=B0=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1032229 --user=宋天阳 【性能测试】使用多节点资源池-固定节点执行-刷新查看另一节点也在运行中 https://www.tapd.cn/55049933/s/1428939 --- .../resource-pool/NodeOperationLabel.vue | 4 ++-- .../service/PrometheusService.java | 11 +++-------- .../components/PerformancePressureConfig.vue | 19 ++++++++++++++++--- 3 files changed, 21 insertions(+), 13 deletions(-) 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 @@