refactor(系统组件): 修改查询node节点运行任务函数中出现的bug
--bug=1032229 --user=宋天阳 【性能测试】使用多节点资源池-固定节点执行-刷新查看另一节点也在运行中 https://www.tapd.cn/55049933/s/1428939
This commit is contained in:
parent
dcf8e31c7c
commit
c8cf75da5c
|
@ -11,9 +11,9 @@
|
||||||
</el-tag>
|
</el-tag>
|
||||||
<span
|
<span
|
||||||
v-if="nodeOperationInfo!== undefined && nodeOperationInfo.runningTask>0 && nodeOperationInfo.cpuUsage!== undefined"
|
v-if="nodeOperationInfo!== undefined && nodeOperationInfo.runningTask>0 && nodeOperationInfo.cpuUsage!== undefined"
|
||||||
style="color:#A9A9A9">
|
style="color:#E5594B">
|
||||||
{{ " CPU:" + nodeOperationInfo.cpuUsage }}</span>
|
{{ " CPU:" + nodeOperationInfo.cpuUsage }}</span>
|
||||||
<span v-else-if="nodeOperationInfo!== undefined && nodeOperationInfo.cpuUsage!== undefined" style="color:#A9A9A9;">
|
<span v-else-if="nodeOperationInfo!== undefined && nodeOperationInfo.cpuUsage!== undefined" style="color:#89DB7E;">
|
||||||
{{ " CPU:" + nodeOperationInfo.cpuUsage }}</span>
|
{{ " CPU:" + nodeOperationInfo.cpuUsage }}</span>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -78,9 +78,6 @@ public class PrometheusService {
|
||||||
ResourcePoolOperationInfo nodeOperationInfo = new ResourcePoolOperationInfo();
|
ResourcePoolOperationInfo nodeOperationInfo = new ResourcePoolOperationInfo();
|
||||||
nodeOperationInfo.setId(testResourcePoolDTO.getId());
|
nodeOperationInfo.setId(testResourcePoolDTO.getId());
|
||||||
|
|
||||||
//如果没有在prometheus查到数据则runningTask为-1。
|
|
||||||
int runningTask = -1;
|
|
||||||
|
|
||||||
for (TestResource testResource : testResourcePoolDTO.getResources()) {
|
for (TestResource testResource : testResourcePoolDTO.getResources()) {
|
||||||
String config = testResource.getConfiguration();
|
String config = testResource.getConfiguration();
|
||||||
try {
|
try {
|
||||||
|
@ -105,13 +102,11 @@ public class PrometheusService {
|
||||||
}};
|
}};
|
||||||
String taskCountQL = this.generatePromQL(taskSeriesNames.toArray(new String[0]), nodeId);
|
String taskCountQL = this.generatePromQL(taskSeriesNames.toArray(new String[0]), nodeId);
|
||||||
String result = this.runPromQL(headers, host, taskCountQL);
|
String result = this.runPromQL(headers, host, taskCountQL);
|
||||||
|
|
||||||
if (StringUtils.isNotBlank(result)) {
|
if (StringUtils.isNotBlank(result)) {
|
||||||
if (runningTask == -1) {
|
int taskResult = Integer.parseInt(result);
|
||||||
runningTask = 0;
|
nodeOperationInfo.addNodeOperationInfo(String.valueOf(configMap.get("id")), ip, port, cpuUsage, taskResult);
|
||||||
}
|
|
||||||
runningTask += Integer.parseInt(result);
|
|
||||||
}
|
}
|
||||||
nodeOperationInfo.addNodeOperationInfo(String.valueOf(configMap.get("id")), ip, port, cpuUsage, runningTask);
|
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LogUtil.error("查找node监控报错:" + testResourcePoolDTO.getName(), e);
|
LogUtil.error("查找node监控报错:" + testResourcePoolDTO.getName(), e);
|
||||||
|
|
|
@ -240,7 +240,20 @@
|
||||||
|
|
||||||
<span v-if="nodeTaskCount(resourceNodes[threadGroup.resourceNodeIndex]) !== -1">
|
<span v-if="nodeTaskCount(resourceNodes[threadGroup.resourceNodeIndex]) !== -1">
|
||||||
{{
|
{{
|
||||||
" " + $t("commons.cpu_usage") + " " + nodeCpuUsage(resourceNodes[threadGroup.resourceNodeIndex])
|
" " + $t("commons.cpu_usage")
|
||||||
|
}}
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<span v-if="nodeTaskCount(resourceNodes[threadGroup.resourceNodeIndex])===0"
|
||||||
|
style="color:#89DB7E;background-color: #FFFFFF;border-color: #89DB7E;margin-left: 5px;margin-right: 5px">
|
||||||
|
{{
|
||||||
|
nodeCpuUsage(resourceNodes[threadGroup.resourceNodeIndex])
|
||||||
|
}}
|
||||||
|
</span>
|
||||||
|
<span v-else-if="nodeTaskCount(resourceNodes[threadGroup.resourceNodeIndex])>0"
|
||||||
|
style="color:#E5594B;background-color: #FFFFFF;border-color: #E5594B;margin-left: 5px;margin-right: 5px">
|
||||||
|
{{
|
||||||
|
nodeCpuUsage(resourceNodes[threadGroup.resourceNodeIndex])
|
||||||
}}
|
}}
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
|
@ -254,11 +267,11 @@
|
||||||
<el-table-column prop="runStatus" :label="$t('commons.running_status')">
|
<el-table-column prop="runStatus" :label="$t('commons.running_status')">
|
||||||
<template v-slot:default="{row}">
|
<template v-slot:default="{row}">
|
||||||
<el-tag size="mini" v-if="nodeTaskCount(row)===0"
|
<el-tag size="mini" v-if="nodeTaskCount(row)===0"
|
||||||
style="color:#E5594B;background-color: #FFFFFF;border-color: #E5594B;margin-left: 5px;margin-right: 5px">
|
style="color:#89DB7E;background-color: #FFFFFF;border-color: #89DB7E;margin-left: 5px;margin-right: 5px">
|
||||||
{{ $t("commons.idle") }}
|
{{ $t("commons.idle") }}
|
||||||
</el-tag>
|
</el-tag>
|
||||||
<el-tag size="mini" v-else-if="nodeTaskCount(row)>0"
|
<el-tag size="mini" v-else-if="nodeTaskCount(row)>0"
|
||||||
style="color:#89DB7E;background-color: #FFFFFF;border-color: #89DB7E;margin-left: 5px;margin-right: 5px">
|
style="color:#E5594B;background-color: #FFFFFF;border-color: #E5594B;margin-left: 5px;margin-right: 5px">
|
||||||
{{ $t("commons.running") }}
|
{{ $t("commons.running") }}
|
||||||
</el-tag>
|
</el-tag>
|
||||||
</template>
|
</template>
|
||||||
|
|
Loading…
Reference in New Issue