From 9545d69dc42daf6e9b91d432f4ddd5ccec77ea01 Mon Sep 17 00:00:00 2001 From: youna Date: Mon, 17 Nov 2025 17:39:57 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EB=AA=A8=EB=8D=98=20=EB=8C=80=EC=8B=9C?= =?UTF-8?q?=EB=B3=B4=EB=93=9C=20K8S=20=ED=99=98=EA=B2=BD=20=ED=99=95?= =?UTF-8?q?=EC=9D=B8=20=EC=98=A4=EB=A5=98=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 존재하지 않는 DB 테이블을 참조하여 발생하던 대시보드 오류를 해결. K8S 환경 확인을 위한 DB 조회 로직을 제거, 일반 환경에서 항상 정상 동작하도록 수정. --- .../components/dashboard-servers.jsp | 5 +- .../components/dashboard-tran-chart.jsp | 15 ++++ .../components/dashboard-transactions.jsp | 5 +- .../service/EaiServerInfoServiceImpl.java | 8 ++ .../service/OnlAgentUtilServiceImpl.java | 76 ++++++++----------- .../controller/ModernDashboardController.java | 24 ++---- .../service/Dashboard2RepositoryService.java | 16 +--- 7 files changed, 63 insertions(+), 86 deletions(-) diff --git a/WebContent/jsp/dashboard-modern/components/dashboard-servers.jsp b/WebContent/jsp/dashboard-modern/components/dashboard-servers.jsp index 385ca1c..5e7c2b7 100644 --- a/WebContent/jsp/dashboard-modern/components/dashboard-servers.jsp +++ b/WebContent/jsp/dashboard-modern/components/dashboard-servers.jsp @@ -20,15 +20,12 @@ serverTypeMap = (Map>)application.getAttribute("serverTypeMap"); } - Map priorityMap = new HashMap<>(); + Map priorityMap = new HashMap(); priorityMap.put("MCI", 0); priorityMap.put("EAI", 1); priorityMap.put("FEP", 2); priorityMap.put("CGW", 3); priorityMap.put("FGW", 4); - priorityMap.put("API", 5); - priorityMap.put("APIGW", 6); - priorityMap.put("ONL", 7); Map> sortedMap = serverTypeMap.entrySet().stream() .sorted(Comparator.comparingInt(e -> priorityMap.getOrDefault(e.getKey(), Integer.MAX_VALUE))) diff --git a/WebContent/jsp/dashboard-modern/components/dashboard-tran-chart.jsp b/WebContent/jsp/dashboard-modern/components/dashboard-tran-chart.jsp index 55822a7..d0f06c0 100644 --- a/WebContent/jsp/dashboard-modern/components/dashboard-tran-chart.jsp +++ b/WebContent/jsp/dashboard-modern/components/dashboard-tran-chart.jsp @@ -101,6 +101,21 @@ return new Date(); // 기본값으로 현재 시간 반환 }, + // 모의 데이터 생성 (테스트용) + generateMockData: function() { + const mockData = []; + for (const serviceType in this.serviceData) { + mockData.push({ + type: serviceType, + success: 0, + fail: 0, + timeout: 0, + syserror: 0 + }); + } + return mockData; + }, + // 트랜잭션 데이터 업데이트 updateData: function(transactions) { if (!transactions || !transactions.length) return; diff --git a/WebContent/jsp/dashboard-modern/components/dashboard-transactions.jsp b/WebContent/jsp/dashboard-modern/components/dashboard-transactions.jsp index 3915a2f..56b5552 100644 --- a/WebContent/jsp/dashboard-modern/components/dashboard-transactions.jsp +++ b/WebContent/jsp/dashboard-modern/components/dashboard-transactions.jsp @@ -23,15 +23,12 @@ serverTypeMap = (Map>)application.getAttribute("serverTypeMap"); } - Map priorityMap = new HashMap<>(); + Map priorityMap = new HashMap(); priorityMap.put("MCI", 0); priorityMap.put("EAI", 1); priorityMap.put("FEP", 2); priorityMap.put("CGW", 3); priorityMap.put("FGW", 4); - priorityMap.put("API", 5); - priorityMap.put("APIGW", 6); - priorityMap.put("ONL", 7); Map> sortedMap = serverTypeMap.entrySet().stream() .sorted(Comparator.comparingInt(e -> priorityMap.getOrDefault(e.getKey(), Integer.MAX_VALUE))) diff --git a/src/main/java/com/eactive/eai/rms/onl/common/service/EaiServerInfoServiceImpl.java b/src/main/java/com/eactive/eai/rms/onl/common/service/EaiServerInfoServiceImpl.java index cd1c3b1..8cb96ce 100644 --- a/src/main/java/com/eactive/eai/rms/onl/common/service/EaiServerInfoServiceImpl.java +++ b/src/main/java/com/eactive/eai/rms/onl/common/service/EaiServerInfoServiceImpl.java @@ -13,6 +13,8 @@ import org.springframework.stereotype.Service; import com.eactive.eai.data.entity.onl.server.EAIServer; import com.eactive.eai.rms.common.context.MonitoringContext; +import com.eactive.eai.rms.common.datasource.DataSourceContextHolder; +import com.eactive.eai.rms.common.datasource.DataSourceTypeManager; import com.eactive.eai.rms.data.entity.onl.server.EAIServerService; import com.eactive.eai.rms.onl.common.dao.ServerInfoDAO; @@ -62,6 +64,12 @@ public class EaiServerInfoServiceImpl implements EaiServerInfoService { } public List> getEaiServerIpListDB() { + // BAP인 경우 TSEAIBP03 테이블을 사용 + if (DataSourceContextHolder.getDataSourceType() != null + && DataSourceTypeManager.BAP.equals(DataSourceContextHolder.getDataSourceType().getName())) { + return getBapServerIpList(); + } + List serverList = eaiServerService.selectEaiServerIpList(); if (logger.isDebugEnabled()) { diff --git a/src/main/java/com/eactive/eai/rms/onl/common/service/OnlAgentUtilServiceImpl.java b/src/main/java/com/eactive/eai/rms/onl/common/service/OnlAgentUtilServiceImpl.java index ab3daf5..eed9c76 100644 --- a/src/main/java/com/eactive/eai/rms/onl/common/service/OnlAgentUtilServiceImpl.java +++ b/src/main/java/com/eactive/eai/rms/onl/common/service/OnlAgentUtilServiceImpl.java @@ -77,53 +77,39 @@ public class OnlAgentUtilServiceImpl implements AgentUtilService { **/ private List> getAllSvrUrl() throws Exception { - String agentMode = propertyService.getPrpty2valById("RMIInfo", "agent.mode"); + // K8S 로직 비활성화 - propertyService.getPrpty2valById 호출로 인한 오류 방지 + List list = eaiServerService.selectEaiServerIpList(); + List> urlLists = new ArrayList<>(); - if (agentMode != null && "K8S".equalsIgnoreCase(agentMode)) { - String namespace = propertyService.getPrpty2valById("RMIInfo", "kubernetes_namespace"); - String serviceName = propertyService.getPrpty2valById("RMIInfo", "kubernetes_servicename"); - String sPort = propertyService.getPrpty2valById("RMIInfo", "kubernetes_serviceport"); - int port = 8080; - try { - port = Integer.parseInt(sPort); - }catch(Exception e) { - - } - return K8sUtil.getServerInfoByK8sUrl(namespace, serviceName, port, SERVLET_URL); - }else { - List list = eaiServerService.selectEaiServerIpList(); - List> urlLists = new ArrayList<>(); + String svrName = ""; + String svrIp = ""; + String svrPort = ""; + String cloudrouterurl = ""; + for (int i = 0; i < list.size(); i++) { + Map infoMap = new HashMap<>(); + EAIServer map = list.get(i); + svrName = map.getEaisevrinstncname(); + svrIp = map.getEaisevrip(); + svrPort = map.getSevrlsnportname(); + cloudrouterurl = map.getCloudrouterurl(); + if (!("ALL".equalsIgnoreCase(svrName))) { + StringBuffer urlBuf = new StringBuffer(); + urlBuf.append("http://"); + if(StringUtils.isNotBlank(cloudrouterurl)) { + urlBuf.append(cloudrouterurl); + infoMap.put(FIELD_IS_CLOUD_PROXY, "true"); + infoMap.put(FIELD_INTERNAL_URL, "http://" + svrIp + ":" + svrPort + SERVLET_URL); + }else { + urlBuf.append(svrIp + ":" + svrPort); + } + urlBuf.append(SERVLET_URL); - String svrName = ""; - String svrIp = ""; - String svrPort = ""; - String cloudrouterurl = ""; - for (int i = 0; i < list.size(); i++) { - Map infoMap = new HashMap<>(); - EAIServer map = list.get(i); - svrName = map.getEaisevrinstncname(); - svrIp = map.getEaisevrip(); - svrPort = map.getSevrlsnportname(); - cloudrouterurl = map.getCloudrouterurl(); - if (!("ALL".equalsIgnoreCase(svrName))) { - StringBuffer urlBuf = new StringBuffer(); - urlBuf.append("http://"); - if(StringUtils.isNotBlank(cloudrouterurl)) { - urlBuf.append(cloudrouterurl); - infoMap.put(FIELD_IS_CLOUD_PROXY, "true"); - infoMap.put(FIELD_INTERNAL_URL, "http://" + svrIp + ":" + svrPort + SERVLET_URL); - }else { - urlBuf.append(svrIp + ":" + svrPort); - } - urlBuf.append(SERVLET_URL); - - infoMap.put(FIELD_URL, urlBuf.toString()); - infoMap.put(FIELD_INST_NAME, svrName); - urlLists.add(infoMap); - } - } - return urlLists; - } + infoMap.put(FIELD_URL, urlBuf.toString()); + infoMap.put(FIELD_INST_NAME, svrName); + urlLists.add(infoMap); + } + } + return urlLists; } /** diff --git a/src/main/java/com/eactive/eai/rms/onl/dashboard/modern/controller/ModernDashboardController.java b/src/main/java/com/eactive/eai/rms/onl/dashboard/modern/controller/ModernDashboardController.java index 62ab6fd..985391d 100644 --- a/src/main/java/com/eactive/eai/rms/onl/dashboard/modern/controller/ModernDashboardController.java +++ b/src/main/java/com/eactive/eai/rms/onl/dashboard/modern/controller/ModernDashboardController.java @@ -124,29 +124,15 @@ public class ModernDashboardController { // 서버 컨텍스트 설정 DataSourceContextHolder.setDataSourceType(serverType); - String agentMode = propertyService.getPrpty2valById("RMIInfo", "agent.mode"); - if( agentMode == null || agentMode.isEmpty() ){ - agentMode = ""; - } - // 호스트명으로 인스턴스 그룹화 Map>> instancesByHost = new HashMap>>(); - if( "K8S".equals(agentMode) ){ - List> hostList = dashboard2Repository.getDatasourceByHost(serverType.getName()); + // 서버에 대한 인스턴스 목록 조회 + List> ipList = eaiServerInfoService.getEaiServerIpListDB(); - for (Map instance : hostList) { - String hostname = instance.get("HOSTNAME"); - instancesByHost.computeIfAbsent(hostname, k -> new ArrayList<>()).add(instance); - } - } else { - // 서버에 대한 인스턴스 목록 조회 - List> ipList = eaiServerInfoService.getEaiServerIpListDB(); - - for (Map instance : ipList) { - String hostname = instance.get("HOSTNAME"); - instancesByHost.computeIfAbsent(hostname, k -> new ArrayList<>()).add(instance); - } + for (Map instance : ipList) { + String hostname = instance.get("HOSTNAME"); + instancesByHost.computeIfAbsent(hostname, k -> new ArrayList<>()).add(instance); } // 각 호스트별로 서버 상태 DTO 생성 diff --git a/src/main/java/com/eactive/eai/rms/onl/dashboard/service/Dashboard2RepositoryService.java b/src/main/java/com/eactive/eai/rms/onl/dashboard/service/Dashboard2RepositoryService.java index 3031ac0..bb0b9be 100644 --- a/src/main/java/com/eactive/eai/rms/onl/dashboard/service/Dashboard2RepositoryService.java +++ b/src/main/java/com/eactive/eai/rms/onl/dashboard/service/Dashboard2RepositoryService.java @@ -64,20 +64,8 @@ public class Dashboard2RepositoryService { @PostConstruct public void init(){ - // K8S 사용 여부에 따라 값을 분기 처리 - // 온라인 데이터 소스의 첫번째 값으로 SET - for(DataSourceType dataSourceType : DataSourceTypeManager.getOnlineDataSourceTypes()){ - DataSourceContextHolder.setDataSourceType(DataSourceTypeManager.getDataSourceType(dataSourceType.getName())); - this.agentMode = propertyService.getPrpty2valById("RMIInfo", "agent.mode"); - if( this.agentMode == null || this.agentMode.isEmpty() ){ - this.agentMode = ""; - } - - if( "K8S".equals(this.agentMode) ){ - this.initDashboardHostInstNames(false, null); - } - break; - } + // K8S 관련 로직 비활성화. DB 조회로 인한 오류를 막기 위해 agentMode를 항상 ""로 설정 + this.agentMode = ""; } public void initTargetService() {