diff --git a/web/src/main/java/com/navercorp/pinpoint/web/dao/AgentInfoDao.java b/web/src/main/java/com/navercorp/pinpoint/web/dao/AgentInfoDao.java index 341cfb3a74f9..ee130534720f 100644 --- a/web/src/main/java/com/navercorp/pinpoint/web/dao/AgentInfoDao.java +++ b/web/src/main/java/com/navercorp/pinpoint/web/dao/AgentInfoDao.java @@ -35,4 +35,9 @@ public interface AgentInfoDao { AgentInfo getAgentInfo(String agentId, long agentStartTime, int deltaTimeInMilliSeconds); List getAgentInfos(List agentIds, long timestamp); + + /** + * No ServerMetaData, No JvmInfo + */ + List getSimpleAgentInfos(List agentIds, long timestamp); } diff --git a/web/src/main/java/com/navercorp/pinpoint/web/dao/hbase/HbaseAgentInfoDao.java b/web/src/main/java/com/navercorp/pinpoint/web/dao/hbase/HbaseAgentInfoDao.java index 24bc7f03d81f..e60a58fb9712 100644 --- a/web/src/main/java/com/navercorp/pinpoint/web/dao/hbase/HbaseAgentInfoDao.java +++ b/web/src/main/java/com/navercorp/pinpoint/web/dao/hbase/HbaseAgentInfoDao.java @@ -113,7 +113,7 @@ private Scan createScanForInitialAgentInfo(String agentId) { public AgentInfo getAgentInfo(final String agentId, final long timestamp) { Objects.requireNonNull(agentId, "agentId"); - Scan scan = createScan(agentId, timestamp); + Scan scan = createScan(agentId, timestamp, AgentInfoColumn.all()); TableName agentInfoTableName = tableNameProvider.getTableName(DESCRIPTOR.getTable()); return this.hbaseOperations2.find(agentInfoTableName, scan, agentInfoResultsExtractor); @@ -141,7 +141,7 @@ public AgentInfo getAgentInfo(String agentId, long agentStartTime, int deltaTime final long startTime = agentStartTime - deltaTimeInMilliSeconds; final long endTime = agentStartTime + deltaTimeInMilliSeconds; - Scan scan = createScan(agentId, startTime, endTime); + Scan scan = createScan(agentId, startTime, endTime, AgentInfoColumn.all()); TableName agentInfoTableName = tableNameProvider.getTableName(DESCRIPTOR.getTable()); return this.hbaseOperations2.find(agentInfoTableName, scan, agentInfoResultsExtractor); @@ -149,24 +149,33 @@ public AgentInfo getAgentInfo(String agentId, long agentStartTime, int deltaTime @Override public List getAgentInfos(List agentIds, long timestamp) { + return getAgentInfos0(agentIds, timestamp, AgentInfoColumn.all()); + } + + + public List getSimpleAgentInfos(List agentIds, long timestamp) { + return getAgentInfos0(agentIds, timestamp, AgentInfoColumn.identifier()); + } + + public List getAgentInfos0(List agentIds, long timestamp, AgentInfoColumn column) { if (CollectionUtils.isEmpty(agentIds)) { return Collections.emptyList(); } List scans = new ArrayList<>(agentIds.size()); for (String agentId : agentIds) { - scans.add(createScan(agentId, timestamp)); + scans.add(createScan(agentId, timestamp, column)); } TableName agentInfoTableName = tableNameProvider.getTableName(DESCRIPTOR.getTable()); return this.hbaseOperations2.findParallel(agentInfoTableName, scans, agentInfoResultsExtractor); } - private Scan createScan(String agentId, long currentTime) { - return createScan(agentId, currentTime, Long.MAX_VALUE); + private Scan createScan(String agentId, long currentTime, AgentInfoColumn column) { + return createScan(agentId, currentTime, Long.MAX_VALUE, column); } - private Scan createScan(String agentId, long startTime, long endTime) { + private Scan createScan(String agentId, long startTime, long endTime, AgentInfoColumn column) { Scan scan = new Scan(); byte[] startKeyBytes; @@ -181,7 +190,17 @@ private Scan createScan(String agentId, long startTime, long endTime) { scan.withStartRow(startKeyBytes); scan.withStopRow(endKeyBytes); - scan.addFamily(DESCRIPTOR.getName()); + + final byte[] family = DESCRIPTOR.getName(); + if (column.identifier) { + scan.addColumn(family, DESCRIPTOR.QUALIFIER_IDENTIFIER); + } + if (column.serverMetaData) { + scan.addColumn(family, DESCRIPTOR.QUALIFIER_SERVER_META_DATA); + } + if (column.jvm) { + scan.addColumn(family, DESCRIPTOR.QUALIFIER_JVM); + } scan.setMaxVersions(1); scan.setCaching(SCANNER_CACHING); @@ -189,4 +208,23 @@ private Scan createScan(String agentId, long startTime, long endTime) { return scan; } + private static class AgentInfoColumn { + private final boolean identifier; + private final boolean serverMetaData; + private final boolean jvm; + + public AgentInfoColumn(boolean identifier, boolean serverMetaData, boolean jvm) { + this.identifier = identifier; + this.serverMetaData = serverMetaData; + this.jvm = jvm; + } + + public static AgentInfoColumn all() { + return new AgentInfoColumn(true, true, true); + } + + public static AgentInfoColumn identifier() { + return new AgentInfoColumn(true, false, false); + } + } } diff --git a/web/src/main/java/com/navercorp/pinpoint/web/service/AgentInfoServiceImpl.java b/web/src/main/java/com/navercorp/pinpoint/web/service/AgentInfoServiceImpl.java index a381c7c5da17..5f819dea39f5 100644 --- a/web/src/main/java/com/navercorp/pinpoint/web/service/AgentInfoServiceImpl.java +++ b/web/src/main/java/com/navercorp/pinpoint/web/service/AgentInfoServiceImpl.java @@ -157,7 +157,7 @@ private ApplicationAgentHostList getApplicationAgentHostList0(int offset, int li String applicationName = applicationNameList.get(i); List agentIdList = getAgentIdList(applicationName, durationDays); - List agentInfoList = this.agentInfoDao.getAgentInfos(agentIdList, timeStamp); + List agentInfoList = this.agentInfoDao.getSimpleAgentInfos(agentIdList, timeStamp); builder.addAgentInfo(applicationName, agentInfoList); } return builder.build(); @@ -248,7 +248,7 @@ public List getAgentsByApplicationNameWithoutStatus0(String applicati } List agentIds = this.applicationIndexDao.selectAgentIds(applicationName); - List agentInfos = this.agentInfoDao.getAgentInfos(agentIds, timestamp); + List agentInfos = this.agentInfoDao.getSimpleAgentInfos(agentIds, timestamp); return agentInfos.stream() .filter(Objects::nonNull) diff --git a/web/src/main/java/com/navercorp/pinpoint/web/vo/AgentInfo.java b/web/src/main/java/com/navercorp/pinpoint/web/vo/AgentInfo.java index 1792e09a7468..b5b7c36762a1 100644 --- a/web/src/main/java/com/navercorp/pinpoint/web/vo/AgentInfo.java +++ b/web/src/main/java/com/navercorp/pinpoint/web/vo/AgentInfo.java @@ -123,9 +123,6 @@ public String getPorts() { return ports; } - public void setPorts(String ports) { - this.ports = ports; - } public short getServiceTypeCode() { return serviceTypeCode; @@ -139,49 +136,30 @@ public int getPid() { return pid; } - public void setPid(int pid) { - this.pid = pid; - } public String getVmVersion() { return vmVersion; } - public void setVmVersion(String vmVersion) { - this.vmVersion = vmVersion; - } - public String getAgentVersion() { return agentVersion; } - public void setAgentVersion(String agentVersion) { - this.agentVersion = agentVersion; - } public ServerMetaDataBo getServerMetaData() { return serverMetaData; } - public void setServerMetaData(ServerMetaDataBo serverMetaData) { - this.serverMetaData = serverMetaData; - } public JvmInfoBo getJvmInfo() { return jvmInfo; } - public void setJvmInfo(JvmInfoBo jvmInfo) { - this.jvmInfo = jvmInfo; - } public long getInitialStartTimestamp() { return initialStartTimestamp; } - public void setInitialStartTimestamp(long initialStartTimestamp) { - this.initialStartTimestamp = initialStartTimestamp; - } public boolean isContainer() { return container; @@ -232,6 +210,7 @@ public String toString() { sb.append(", pid=").append(pid); sb.append(", vmVersion='").append(vmVersion).append('\''); sb.append(", agentVersion='").append(agentVersion).append('\''); + sb.append(", serverMetaData='").append(serverMetaData).append('\''); sb.append(", jvmInfo=").append(jvmInfo); sb.append(", initialStartTimestamp=").append(initialStartTimestamp); sb.append(", container=").append(container);