fix: 修复性能测试查询监控缓存
This commit is contained in:
parent
457d8624fb
commit
2ed49ae127
|
@ -1,16 +1,15 @@
|
||||||
package io.metersphere.consul;
|
package io.metersphere.consul;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import io.metersphere.base.domain.TestResource;
|
import io.metersphere.base.domain.TestResource;
|
||||||
import io.metersphere.commons.constants.PerformanceTestStatus;
|
|
||||||
import io.metersphere.commons.constants.ResourcePoolTypeEnum;
|
import io.metersphere.commons.constants.ResourcePoolTypeEnum;
|
||||||
import io.metersphere.commons.constants.ResourceStatusEnum;
|
import io.metersphere.commons.constants.ResourceStatusEnum;
|
||||||
import io.metersphere.controller.request.resourcepool.QueryResourcePoolRequest;
|
import io.metersphere.controller.request.resourcepool.QueryResourcePoolRequest;
|
||||||
import io.metersphere.dto.LoadTestDTO;
|
import io.metersphere.dto.LoadTestDTO;
|
||||||
import io.metersphere.dto.NodeDTO;
|
import io.metersphere.dto.NodeDTO;
|
||||||
import io.metersphere.dto.TestResourcePoolDTO;
|
import io.metersphere.dto.TestResourcePoolDTO;
|
||||||
import io.metersphere.performance.dto.Monitor;
|
|
||||||
import io.metersphere.performance.request.QueryTestPlanRequest;
|
import io.metersphere.performance.request.QueryTestPlanRequest;
|
||||||
import io.metersphere.performance.service.PerformanceTestService;
|
import io.metersphere.performance.service.PerformanceTestService;
|
||||||
import io.metersphere.service.TestResourcePoolService;
|
import io.metersphere.service.TestResourcePoolService;
|
||||||
|
@ -19,7 +18,10 @@ import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.*;
|
import java.util.Collections;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
|
@ -49,13 +51,16 @@ public class ConsulService {
|
||||||
for (LoadTestDTO loadTestDTO : list) {
|
for (LoadTestDTO loadTestDTO : list) {
|
||||||
String advancedConfiguration = performanceTestService.getAdvancedConfiguration(loadTestDTO.getId());
|
String advancedConfiguration = performanceTestService.getAdvancedConfiguration(loadTestDTO.getId());
|
||||||
JSONObject adv = JSON.parseObject(advancedConfiguration);
|
JSONObject adv = JSON.parseObject(advancedConfiguration);
|
||||||
Object monitorParams = adv.get("monitorParams");
|
Object o1 = adv.get("monitorParams");
|
||||||
if (monitorParams == null) {
|
if (o1 == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
List<Monitor> monitors = JSON.parseArray(monitorParams.toString(), Monitor.class);
|
|
||||||
for (Monitor monitor : monitors) {
|
JSONArray monitorParams = adv.getJSONArray("monitorParams");
|
||||||
result.put(monitor.getIp() + "-" + monitor.getPort(), Collections.singletonList("metersphere"));
|
|
||||||
|
for (int i = 0; i < monitorParams.size(); i++) {
|
||||||
|
JSONObject o = monitorParams.getJSONObject(i);
|
||||||
|
result.put(o.getString("ip") + "-" + o.getInteger("port"), Collections.singletonList("metersphere"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (TestResourcePoolDTO pool : testResourcePoolDTOS) {
|
for (TestResourcePoolDTO pool : testResourcePoolDTOS) {
|
||||||
|
|
Loading…
Reference in New Issue