From 60c8103a8fa223288b38cd044cabbcb22c4f02b1 Mon Sep 17 00:00:00 2001 From: jsonwan Date: Fri, 10 Feb 2023 11:09:32 +0800 Subject: [PATCH 1/3] =?UTF-8?q?bugfix:=20IP=E9=80=89=E6=8B=A9=E5=99=A8?= =?UTF-8?q?=E9=9D=99=E6=80=81=E6=8B=93=E6=89=91=E6=90=9C=E7=B4=A2=E6=9D=A1?= =?UTF-8?q?=E4=BB=B6=E5=89=8D=E5=8A=A0=E4=B8=8A=E7=A9=BA=E6=A0=BC=E5=90=8E?= =?UTF-8?q?=E7=AD=9B=E9=80=89=E5=A4=B1=E6=95=88=20#1737?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 去除切分出的空字符串作为搜索条件 --- .../job/manage/service/host/impl/ScopeHostServiceImpl.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/host/impl/ScopeHostServiceImpl.java b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/host/impl/ScopeHostServiceImpl.java index 7fc7694272..675135e2fa 100644 --- a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/host/impl/ScopeHostServiceImpl.java +++ b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/host/impl/ScopeHostServiceImpl.java @@ -38,6 +38,7 @@ import lombok.AllArgsConstructor; import lombok.Getter; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.StopWatch; @@ -45,6 +46,7 @@ import java.util.Collection; import java.util.Collections; import java.util.List; +import java.util.stream.Collectors; /** * 资源范围下的主机服务 @@ -235,7 +237,9 @@ private BasicParsedSearchConditions buildSearchConditions(AppResourceScope appRe List searchContents = null; if (searchContent != null) { - searchContents = StringUtil.splitByNormalSeparator(searchContent); + searchContents = StringUtil.splitByNormalSeparator(searchContent.trim()).stream() + .filter(StringUtils::isNotBlank) + .collect(Collectors.toList()); } //获取所有云区域,找出名称符合条件的所有CloudAreaId From c66eacd9ab2295d13c1a332f1da996b7ff07211a Mon Sep 17 00:00:00 2001 From: jsonwan Date: Fri, 10 Feb 2023 11:29:06 +0800 Subject: [PATCH 2/3] =?UTF-8?q?perf:=20IP=E9=80=89=E6=8B=A9=E5=99=A8?= =?UTF-8?q?=E7=A1=AE=E8=AE=A4=E9=80=89=E4=B8=AD=E7=9A=84=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E6=8C=89Agent=E7=8A=B6=E6=80=81=E6=8E=92?= =?UTF-8?q?=E5=BA=8F=EF=BC=8C=E5=BC=82=E5=B8=B8=E7=9A=84=E5=9C=A8=E5=89=8D?= =?UTF-8?q?=20#1736?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 桶排序实现 --- .../bk/job/manage/api/web/impl/WebHostResourceImpl.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/api/web/impl/WebHostResourceImpl.java b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/api/web/impl/WebHostResourceImpl.java index 868a93584b..1cc435bbf2 100644 --- a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/api/web/impl/WebHostResourceImpl.java +++ b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/api/web/impl/WebHostResourceImpl.java @@ -606,9 +606,15 @@ public Response> getHostDetails(String username, .map(HostIdWithMeta::getHostId) .collect(Collectors.toList()); List hostList = hostDetailService.listHostDetails(appResourceScope, hostIds); + // 排序:Agent异常机器在前,Agent正常机器在后 List hostInfoVOList = hostList.parallelStream() + .filter(hostDTO -> !hostDTO.getGseAgentAlive()) .map(ApplicationHostDTO::toVO) .collect(Collectors.toList()); + hostInfoVOList.addAll(hostList.parallelStream() + .filter(ApplicationHostDTO::getGseAgentAlive) + .map(ApplicationHostDTO::toVO) + .collect(Collectors.toList())); return Response.buildSuccessResp(hostInfoVOList); } From ad02f02fb2f1255d7e7b366b2144f4d541b321b0 Mon Sep 17 00:00:00 2001 From: jsonwan Date: Fri, 10 Feb 2023 11:30:12 +0800 Subject: [PATCH 3/3] =?UTF-8?q?perf:=20IP=E9=80=89=E6=8B=A9=E5=99=A8?= =?UTF-8?q?=E7=A1=AE=E8=AE=A4=E9=80=89=E4=B8=AD=E7=9A=84=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E6=8C=89Agent=E7=8A=B6=E6=80=81=E6=8E=92?= =?UTF-8?q?=E5=BA=8F=EF=BC=8C=E5=BC=82=E5=B8=B8=E7=9A=84=E5=9C=A8=E5=89=8D?= =?UTF-8?q?=20#1736?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit format --- .../tencent/bk/job/manage/api/web/impl/WebHostResourceImpl.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/api/web/impl/WebHostResourceImpl.java b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/api/web/impl/WebHostResourceImpl.java index 1cc435bbf2..f722286efc 100644 --- a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/api/web/impl/WebHostResourceImpl.java +++ b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/api/web/impl/WebHostResourceImpl.java @@ -655,7 +655,6 @@ public Response agentStatistics(String username, } List dynamicGroupIdList = agentStatisticsReq.getDynamicGroupIds(); if (CollectionUtils.isNotEmpty(dynamicGroupIdList)) { - long bizId = Long.parseLong(scopeId); List hostsByDynamicGroup = new ArrayList<>(); for (String id : dynamicGroupIdList) { hostsByDynamicGroup.addAll(bizDynamicGroupHostService.listHostByDynamicGroup(appResourceScope, id));