From 227b48a6b2a25294b2bcbb30af544d19d604155c Mon Sep 17 00:00:00 2001 From: emeroad Date: Fri, 8 Apr 2022 20:37:58 +0900 Subject: [PATCH] [#8757] Remove duplicate AgentStatDao from collector --- ...{AgentStatDaoV2.java => AgentStatDao.java} | 4 +- .../dao/hbase/stat/DefaultAgentStatDao.java | 4 +- .../dao/hbase/stat/HBaseDaoConfiguration.java | 109 ++++++++++++++++++ .../dao/hbase/stat/HBaseLoadedClassDao.java | 41 ------- .../hbase/stat/HBaseTotalThreadCountDao.java | 40 ------- .../dao/hbase/stat/HbaseActiveTraceDao.java | 44 ------- .../dao/hbase/stat/HbaseCpuLoadDao.java | 43 ------- .../hbase/stat/HbaseDataSourceListDao.java | 1 - .../stat/HbaseDeadlockThreadCountDao.java | 41 ------- .../dao/hbase/stat/HbaseDirectBufferDao.java | 42 ------- .../hbase/stat/HbaseFileDescriptorDao.java | 43 ------- .../dao/hbase/stat/HbaseJvmGcDao.java | 43 ------- .../dao/hbase/stat/HbaseJvmGcDetailedDao.java | 43 ------- .../dao/hbase/stat/HbaseResponseTimeDao.java | 43 ------- .../dao/hbase/stat/HbaseTransactionDao.java | 43 ------- .../service/HBaseAgentStatService.java | 12 +- .../thrift/ThriftAgentStatHandlerV2Test.java | 28 ++--- 17 files changed, 134 insertions(+), 490 deletions(-) rename collector/src/main/java/com/navercorp/pinpoint/collector/dao/{AgentStatDaoV2.java => AgentStatDao.java} (88%) create mode 100644 collector/src/main/java/com/navercorp/pinpoint/collector/dao/hbase/stat/HBaseDaoConfiguration.java delete mode 100644 collector/src/main/java/com/navercorp/pinpoint/collector/dao/hbase/stat/HBaseLoadedClassDao.java delete mode 100644 collector/src/main/java/com/navercorp/pinpoint/collector/dao/hbase/stat/HBaseTotalThreadCountDao.java delete mode 100644 collector/src/main/java/com/navercorp/pinpoint/collector/dao/hbase/stat/HbaseActiveTraceDao.java delete mode 100644 collector/src/main/java/com/navercorp/pinpoint/collector/dao/hbase/stat/HbaseCpuLoadDao.java delete mode 100644 collector/src/main/java/com/navercorp/pinpoint/collector/dao/hbase/stat/HbaseDeadlockThreadCountDao.java delete mode 100644 collector/src/main/java/com/navercorp/pinpoint/collector/dao/hbase/stat/HbaseDirectBufferDao.java delete mode 100644 collector/src/main/java/com/navercorp/pinpoint/collector/dao/hbase/stat/HbaseFileDescriptorDao.java delete mode 100644 collector/src/main/java/com/navercorp/pinpoint/collector/dao/hbase/stat/HbaseJvmGcDao.java delete mode 100644 collector/src/main/java/com/navercorp/pinpoint/collector/dao/hbase/stat/HbaseJvmGcDetailedDao.java delete mode 100644 collector/src/main/java/com/navercorp/pinpoint/collector/dao/hbase/stat/HbaseResponseTimeDao.java delete mode 100644 collector/src/main/java/com/navercorp/pinpoint/collector/dao/hbase/stat/HbaseTransactionDao.java diff --git a/collector/src/main/java/com/navercorp/pinpoint/collector/dao/AgentStatDaoV2.java b/collector/src/main/java/com/navercorp/pinpoint/collector/dao/AgentStatDao.java similarity index 88% rename from collector/src/main/java/com/navercorp/pinpoint/collector/dao/AgentStatDaoV2.java rename to collector/src/main/java/com/navercorp/pinpoint/collector/dao/AgentStatDao.java index c5e0808e4d4b..87a5aab4766d 100644 --- a/collector/src/main/java/com/navercorp/pinpoint/collector/dao/AgentStatDaoV2.java +++ b/collector/src/main/java/com/navercorp/pinpoint/collector/dao/AgentStatDao.java @@ -18,13 +18,15 @@ import com.navercorp.pinpoint.common.server.bo.stat.AgentStatBo; import com.navercorp.pinpoint.common.server.bo.stat.AgentStatDataPoint; +import org.springframework.stereotype.Repository; import java.util.List; /** * @author HyunGil Jeong */ -public interface AgentStatDaoV2 { +@Repository +public interface AgentStatDao { void insert(String agentId, List agentStatDataPoints); void dispatch(AgentStatBo agentStatBo); diff --git a/collector/src/main/java/com/navercorp/pinpoint/collector/dao/hbase/stat/DefaultAgentStatDao.java b/collector/src/main/java/com/navercorp/pinpoint/collector/dao/hbase/stat/DefaultAgentStatDao.java index fb65f18917f8..ffe2e9ad3bc7 100644 --- a/collector/src/main/java/com/navercorp/pinpoint/collector/dao/hbase/stat/DefaultAgentStatDao.java +++ b/collector/src/main/java/com/navercorp/pinpoint/collector/dao/hbase/stat/DefaultAgentStatDao.java @@ -1,6 +1,6 @@ package com.navercorp.pinpoint.collector.dao.hbase.stat; -import com.navercorp.pinpoint.collector.dao.AgentStatDaoV2; +import com.navercorp.pinpoint.collector.dao.AgentStatDao; import com.navercorp.pinpoint.collector.util.CollectorUtils; import com.navercorp.pinpoint.common.hbase.HbaseOperations2; import com.navercorp.pinpoint.common.hbase.HbaseTable; @@ -18,7 +18,7 @@ import java.util.Objects; import java.util.function.Function; -public abstract class DefaultAgentStatDao implements AgentStatDaoV2 { +public class DefaultAgentStatDao implements AgentStatDao { private final AgentStatType agentStatType; private final HbaseTable tableName; diff --git a/collector/src/main/java/com/navercorp/pinpoint/collector/dao/hbase/stat/HBaseDaoConfiguration.java b/collector/src/main/java/com/navercorp/pinpoint/collector/dao/hbase/stat/HBaseDaoConfiguration.java new file mode 100644 index 000000000000..4e6d473085f3 --- /dev/null +++ b/collector/src/main/java/com/navercorp/pinpoint/collector/dao/hbase/stat/HBaseDaoConfiguration.java @@ -0,0 +1,109 @@ +package com.navercorp.pinpoint.collector.dao.hbase.stat; + +import com.navercorp.pinpoint.collector.dao.AgentStatDao; +import com.navercorp.pinpoint.common.hbase.HbaseOperations2; +import com.navercorp.pinpoint.common.hbase.HbaseTable; +import com.navercorp.pinpoint.common.hbase.TableNameProvider; +import com.navercorp.pinpoint.common.server.bo.serializer.stat.AgentStatHbaseOperationFactory; +import com.navercorp.pinpoint.common.server.bo.serializer.stat.AgentStatSerializer; +import com.navercorp.pinpoint.common.server.bo.stat.ActiveTraceBo; +import com.navercorp.pinpoint.common.server.bo.stat.AgentStatBo; +import com.navercorp.pinpoint.common.server.bo.stat.AgentStatDataPoint; +import com.navercorp.pinpoint.common.server.bo.stat.AgentStatType; +import com.navercorp.pinpoint.common.server.bo.stat.CpuLoadBo; +import com.navercorp.pinpoint.common.server.bo.stat.DataSourceListBo; +import com.navercorp.pinpoint.common.server.bo.stat.DeadlockThreadCountBo; +import com.navercorp.pinpoint.common.server.bo.stat.DirectBufferBo; +import com.navercorp.pinpoint.common.server.bo.stat.FileDescriptorBo; +import com.navercorp.pinpoint.common.server.bo.stat.JvmGcBo; +import com.navercorp.pinpoint.common.server.bo.stat.JvmGcDetailedBo; +import com.navercorp.pinpoint.common.server.bo.stat.LoadedClassBo; +import com.navercorp.pinpoint.common.server.bo.stat.ResponseTimeBo; +import com.navercorp.pinpoint.common.server.bo.stat.TotalThreadCountBo; +import com.navercorp.pinpoint.common.server.bo.stat.TransactionBo; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import java.util.List; +import java.util.Objects; +import java.util.function.Function; + +@Configuration +public class HBaseDaoConfiguration { + + private final HbaseOperations2 hbaseTemplate; + private final HbaseTable hbaseTable = HbaseTable.AGENT_STAT_VER2; + private final TableNameProvider tableNameProvider; + private final AgentStatHbaseOperationFactory operations; + + public HBaseDaoConfiguration(HbaseOperations2 hbaseTemplate, TableNameProvider tableNameProvider, AgentStatHbaseOperationFactory operations) { + this.hbaseTemplate = Objects.requireNonNull(hbaseTemplate, "hbaseTemplate"); + this.tableNameProvider = Objects.requireNonNull(tableNameProvider, "tableNameProvider"); + this.operations = Objects.requireNonNull(operations, "operations"); + } + + private AgentStatDao newAgentStatDao(AgentStatType agentStatType, Function> dataPointFunction, AgentStatSerializer serializer) { + return new DefaultAgentStatDao<>(agentStatType, hbaseTable, dataPointFunction, + hbaseTemplate, tableNameProvider, operations, serializer); + } + + @Bean + public AgentStatDao getActiveTraceDao(AgentStatSerializer serializer) { + return newAgentStatDao(AgentStatType.TRANSACTION, AgentStatBo::getActiveTraceBos, serializer); + } + + @Bean + public AgentStatDao getCpuLoadDao(AgentStatSerializer serializer) { + return newAgentStatDao(AgentStatType.CPU_LOAD, AgentStatBo::getCpuLoadBos, serializer); + } + + @Bean + public AgentStatDao getDataSourceListDao(AgentStatSerializer serializer) { + return new HbaseDataSourceListDao(hbaseTemplate, tableNameProvider, operations, serializer); + } + + @Bean + public AgentStatDao getDeadlockThreadCountDao(AgentStatSerializer serializer) { + return newAgentStatDao(AgentStatType.DEADLOCK, AgentStatBo::getDeadlockThreadCountBos, serializer); + } + + @Bean + public AgentStatDao getDirectBufferDao(AgentStatSerializer serializer) { + return newAgentStatDao(AgentStatType.DIRECT_BUFFER, AgentStatBo::getDirectBufferBos, serializer); + } + + @Bean + public AgentStatDao getFileDescriptorDao(AgentStatSerializer serializer) { + return newAgentStatDao(AgentStatType.FILE_DESCRIPTOR, AgentStatBo::getFileDescriptorBos, serializer); + } + + @Bean + public AgentStatDao getJvmGcDao(AgentStatSerializer serializer) { + return newAgentStatDao(AgentStatType.JVM_GC, AgentStatBo::getJvmGcBos, serializer); + } + + @Bean + public AgentStatDao getJvmGcDetailedDao(AgentStatSerializer serializer) { + return newAgentStatDao(AgentStatType.JVM_GC_DETAILED, AgentStatBo::getJvmGcDetailedBos, serializer); + } + + @Bean + public AgentStatDao getLoadedClassDao(AgentStatSerializer serializer) { + return newAgentStatDao(AgentStatType.LOADED_CLASS, AgentStatBo::getLoadedClassBos, serializer); + } + + @Bean + public AgentStatDao getResponseTimeDao(AgentStatSerializer serializer) { + return newAgentStatDao(AgentStatType.RESPONSE_TIME, AgentStatBo::getResponseTimeBos, serializer); + } + + @Bean + public AgentStatDao getTotalThreadCountDao(AgentStatSerializer serializer) { + return newAgentStatDao(AgentStatType.TOTAL_THREAD, AgentStatBo::getTotalThreadCountBos, serializer); + } + + @Bean + public AgentStatDao getTransactionDao(AgentStatSerializer serializer) { + return newAgentStatDao(AgentStatType.TRANSACTION, AgentStatBo::getTransactionBos, serializer); + } +} diff --git a/collector/src/main/java/com/navercorp/pinpoint/collector/dao/hbase/stat/HBaseLoadedClassDao.java b/collector/src/main/java/com/navercorp/pinpoint/collector/dao/hbase/stat/HBaseLoadedClassDao.java deleted file mode 100644 index 8d322e309e32..000000000000 --- a/collector/src/main/java/com/navercorp/pinpoint/collector/dao/hbase/stat/HBaseLoadedClassDao.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2020 NAVER Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.navercorp.pinpoint.collector.dao.hbase.stat; - -import com.navercorp.pinpoint.common.hbase.HbaseOperations2; -import com.navercorp.pinpoint.common.hbase.HbaseTable; -import com.navercorp.pinpoint.common.hbase.TableNameProvider; -import com.navercorp.pinpoint.common.server.bo.serializer.stat.AgentStatHbaseOperationFactory; -import com.navercorp.pinpoint.common.server.bo.serializer.stat.AgentStatSerializer; -import com.navercorp.pinpoint.common.server.bo.stat.AgentStatBo; -import com.navercorp.pinpoint.common.server.bo.stat.AgentStatType; -import com.navercorp.pinpoint.common.server.bo.stat.LoadedClassBo; -import org.springframework.stereotype.Repository; - -@Repository -public class HBaseLoadedClassDao extends DefaultAgentStatDao { - - public HBaseLoadedClassDao(HbaseOperations2 hbaseTemplate, - TableNameProvider tableNameProvider, - AgentStatHbaseOperationFactory operationFactory, - AgentStatSerializer serializer) { - super(AgentStatType.LOADED_CLASS, HbaseTable.AGENT_STAT_VER2, AgentStatBo::getLoadedClassBos, - hbaseTemplate, tableNameProvider, operationFactory, serializer); - } - - -} diff --git a/collector/src/main/java/com/navercorp/pinpoint/collector/dao/hbase/stat/HBaseTotalThreadCountDao.java b/collector/src/main/java/com/navercorp/pinpoint/collector/dao/hbase/stat/HBaseTotalThreadCountDao.java deleted file mode 100644 index b3365bb79e6e..000000000000 --- a/collector/src/main/java/com/navercorp/pinpoint/collector/dao/hbase/stat/HBaseTotalThreadCountDao.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright 2020 Naver Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.navercorp.pinpoint.collector.dao.hbase.stat; - -import com.navercorp.pinpoint.common.hbase.HbaseOperations2; -import com.navercorp.pinpoint.common.hbase.HbaseTable; -import com.navercorp.pinpoint.common.hbase.TableNameProvider; -import com.navercorp.pinpoint.common.server.bo.serializer.stat.AgentStatHbaseOperationFactory; -import com.navercorp.pinpoint.common.server.bo.serializer.stat.AgentStatSerializer; -import com.navercorp.pinpoint.common.server.bo.stat.AgentStatBo; -import com.navercorp.pinpoint.common.server.bo.stat.AgentStatType; -import com.navercorp.pinpoint.common.server.bo.stat.TotalThreadCountBo; -import org.springframework.stereotype.Repository; - -@Repository -public class HBaseTotalThreadCountDao extends DefaultAgentStatDao { - - public HBaseTotalThreadCountDao(HbaseOperations2 hbaseTemplate, - TableNameProvider tableNameProvider, - AgentStatHbaseOperationFactory operationFactory, - AgentStatSerializer serializer) { - super(AgentStatType.TOTAL_THREAD, HbaseTable.AGENT_STAT_VER2, AgentStatBo::getTotalThreadCountBos, - hbaseTemplate, tableNameProvider, operationFactory, serializer); - } - -} diff --git a/collector/src/main/java/com/navercorp/pinpoint/collector/dao/hbase/stat/HbaseActiveTraceDao.java b/collector/src/main/java/com/navercorp/pinpoint/collector/dao/hbase/stat/HbaseActiveTraceDao.java deleted file mode 100644 index c396248e945a..000000000000 --- a/collector/src/main/java/com/navercorp/pinpoint/collector/dao/hbase/stat/HbaseActiveTraceDao.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2016 Naver Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.navercorp.pinpoint.collector.dao.hbase.stat; - -import com.navercorp.pinpoint.common.hbase.HbaseOperations2; -import com.navercorp.pinpoint.common.hbase.HbaseTable; -import com.navercorp.pinpoint.common.hbase.TableNameProvider; -import com.navercorp.pinpoint.common.server.bo.serializer.stat.AgentStatHbaseOperationFactory; -import com.navercorp.pinpoint.common.server.bo.serializer.stat.AgentStatSerializer; -import com.navercorp.pinpoint.common.server.bo.stat.ActiveTraceBo; -import com.navercorp.pinpoint.common.server.bo.stat.AgentStatBo; -import com.navercorp.pinpoint.common.server.bo.stat.AgentStatType; -import org.springframework.stereotype.Repository; - - -/** - * @author HyunGil Jeong - */ -@Repository -public class HbaseActiveTraceDao extends DefaultAgentStatDao { - - public HbaseActiveTraceDao(HbaseOperations2 hbaseTemplate, - TableNameProvider tableNameProvider, - AgentStatHbaseOperationFactory operationFactory, - AgentStatSerializer serializer) { - super(AgentStatType.ACTIVE_TRACE, HbaseTable.AGENT_STAT_VER2, AgentStatBo::getActiveTraceBos, - hbaseTemplate, tableNameProvider, operationFactory, serializer); - } - -} diff --git a/collector/src/main/java/com/navercorp/pinpoint/collector/dao/hbase/stat/HbaseCpuLoadDao.java b/collector/src/main/java/com/navercorp/pinpoint/collector/dao/hbase/stat/HbaseCpuLoadDao.java deleted file mode 100644 index d18596597c4d..000000000000 --- a/collector/src/main/java/com/navercorp/pinpoint/collector/dao/hbase/stat/HbaseCpuLoadDao.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2016 Naver Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.navercorp.pinpoint.collector.dao.hbase.stat; - -import com.navercorp.pinpoint.common.hbase.HbaseOperations2; -import com.navercorp.pinpoint.common.hbase.HbaseTable; -import com.navercorp.pinpoint.common.hbase.TableNameProvider; -import com.navercorp.pinpoint.common.server.bo.serializer.stat.AgentStatHbaseOperationFactory; -import com.navercorp.pinpoint.common.server.bo.serializer.stat.AgentStatSerializer; -import com.navercorp.pinpoint.common.server.bo.stat.AgentStatBo; -import com.navercorp.pinpoint.common.server.bo.stat.AgentStatType; -import com.navercorp.pinpoint.common.server.bo.stat.CpuLoadBo; -import org.springframework.stereotype.Repository; - -/** - * @author HyunGil Jeong - */ -@Repository -public class HbaseCpuLoadDao extends DefaultAgentStatDao { - - public HbaseCpuLoadDao(HbaseOperations2 hbaseTemplate, - TableNameProvider tableNameProvider, - AgentStatHbaseOperationFactory operationFactory, - AgentStatSerializer serializer) { - super(AgentStatType.CPU_LOAD, HbaseTable.AGENT_STAT_VER2, AgentStatBo::getCpuLoadBos, - hbaseTemplate, tableNameProvider, operationFactory, serializer); - } - -} diff --git a/collector/src/main/java/com/navercorp/pinpoint/collector/dao/hbase/stat/HbaseDataSourceListDao.java b/collector/src/main/java/com/navercorp/pinpoint/collector/dao/hbase/stat/HbaseDataSourceListDao.java index 4935a9778a64..30ac6ec31920 100644 --- a/collector/src/main/java/com/navercorp/pinpoint/collector/dao/hbase/stat/HbaseDataSourceListDao.java +++ b/collector/src/main/java/com/navercorp/pinpoint/collector/dao/hbase/stat/HbaseDataSourceListDao.java @@ -36,7 +36,6 @@ /** * @author Taejin Koo */ -@Repository public class HbaseDataSourceListDao extends DefaultAgentStatDao { public HbaseDataSourceListDao(HbaseOperations2 hbaseTemplate, diff --git a/collector/src/main/java/com/navercorp/pinpoint/collector/dao/hbase/stat/HbaseDeadlockThreadCountDao.java b/collector/src/main/java/com/navercorp/pinpoint/collector/dao/hbase/stat/HbaseDeadlockThreadCountDao.java deleted file mode 100644 index 72a746804ccb..000000000000 --- a/collector/src/main/java/com/navercorp/pinpoint/collector/dao/hbase/stat/HbaseDeadlockThreadCountDao.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2017 NAVER Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.navercorp.pinpoint.collector.dao.hbase.stat; - -import com.navercorp.pinpoint.common.hbase.HbaseOperations2; -import com.navercorp.pinpoint.common.hbase.HbaseTable; -import com.navercorp.pinpoint.common.hbase.TableNameProvider; -import com.navercorp.pinpoint.common.server.bo.serializer.stat.AgentStatHbaseOperationFactory; -import com.navercorp.pinpoint.common.server.bo.serializer.stat.AgentStatSerializer; -import com.navercorp.pinpoint.common.server.bo.stat.AgentStatBo; -import com.navercorp.pinpoint.common.server.bo.stat.AgentStatType; -import com.navercorp.pinpoint.common.server.bo.stat.DeadlockThreadCountBo; -import org.springframework.stereotype.Repository; - -/** - * @author Taejin Koo - */ -@Repository -public class HbaseDeadlockThreadCountDao extends DefaultAgentStatDao { - - public HbaseDeadlockThreadCountDao(HbaseOperations2 hbaseTemplate, - TableNameProvider tableNameProvider, - AgentStatHbaseOperationFactory operationFactory, - AgentStatSerializer serializer) { - super(AgentStatType.DEADLOCK, HbaseTable.AGENT_STAT_VER2, AgentStatBo::getDeadlockThreadCountBos, hbaseTemplate, tableNameProvider, operationFactory, serializer); - } -} diff --git a/collector/src/main/java/com/navercorp/pinpoint/collector/dao/hbase/stat/HbaseDirectBufferDao.java b/collector/src/main/java/com/navercorp/pinpoint/collector/dao/hbase/stat/HbaseDirectBufferDao.java deleted file mode 100644 index 330ecd094baa..000000000000 --- a/collector/src/main/java/com/navercorp/pinpoint/collector/dao/hbase/stat/HbaseDirectBufferDao.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2018 Naver Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.navercorp.pinpoint.collector.dao.hbase.stat; - -import com.navercorp.pinpoint.common.hbase.HbaseOperations2; -import com.navercorp.pinpoint.common.hbase.HbaseTable; -import com.navercorp.pinpoint.common.hbase.TableNameProvider; -import com.navercorp.pinpoint.common.server.bo.serializer.stat.AgentStatHbaseOperationFactory; -import com.navercorp.pinpoint.common.server.bo.serializer.stat.AgentStatSerializer; -import com.navercorp.pinpoint.common.server.bo.stat.AgentStatBo; -import com.navercorp.pinpoint.common.server.bo.stat.AgentStatType; -import com.navercorp.pinpoint.common.server.bo.stat.DirectBufferBo; -import org.springframework.stereotype.Repository; - -/** - * @author Roy Kim - */ -@Repository -public class HbaseDirectBufferDao extends DefaultAgentStatDao { - - public HbaseDirectBufferDao(HbaseOperations2 hbaseTemplate, - TableNameProvider tableNameProvider, - AgentStatHbaseOperationFactory operationFactory, - AgentStatSerializer serializer) { - super(AgentStatType.DIRECT_BUFFER, HbaseTable.AGENT_STAT_VER2, AgentStatBo::getDirectBufferBos, - hbaseTemplate, tableNameProvider, operationFactory, serializer); - } -} diff --git a/collector/src/main/java/com/navercorp/pinpoint/collector/dao/hbase/stat/HbaseFileDescriptorDao.java b/collector/src/main/java/com/navercorp/pinpoint/collector/dao/hbase/stat/HbaseFileDescriptorDao.java deleted file mode 100644 index 61221331c1a2..000000000000 --- a/collector/src/main/java/com/navercorp/pinpoint/collector/dao/hbase/stat/HbaseFileDescriptorDao.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2018 Naver Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.navercorp.pinpoint.collector.dao.hbase.stat; - -import com.navercorp.pinpoint.common.hbase.HbaseOperations2; -import com.navercorp.pinpoint.common.hbase.HbaseTable; -import com.navercorp.pinpoint.common.hbase.TableNameProvider; -import com.navercorp.pinpoint.common.server.bo.serializer.stat.AgentStatHbaseOperationFactory; -import com.navercorp.pinpoint.common.server.bo.serializer.stat.AgentStatSerializer; -import com.navercorp.pinpoint.common.server.bo.stat.AgentStatBo; -import com.navercorp.pinpoint.common.server.bo.stat.AgentStatType; -import com.navercorp.pinpoint.common.server.bo.stat.FileDescriptorBo; -import org.springframework.stereotype.Repository; - -/** - * @author Roy Kim - */ -@Repository -public class HbaseFileDescriptorDao extends DefaultAgentStatDao { - - public HbaseFileDescriptorDao(HbaseOperations2 hbaseTemplate, - TableNameProvider tableNameProvider, - AgentStatHbaseOperationFactory operationFactory, - AgentStatSerializer serializer) { - super(AgentStatType.FILE_DESCRIPTOR, HbaseTable.AGENT_STAT_VER2, AgentStatBo::getFileDescriptorBos, - hbaseTemplate, tableNameProvider, operationFactory, serializer); - } - -} diff --git a/collector/src/main/java/com/navercorp/pinpoint/collector/dao/hbase/stat/HbaseJvmGcDao.java b/collector/src/main/java/com/navercorp/pinpoint/collector/dao/hbase/stat/HbaseJvmGcDao.java deleted file mode 100644 index 59162db53cad..000000000000 --- a/collector/src/main/java/com/navercorp/pinpoint/collector/dao/hbase/stat/HbaseJvmGcDao.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2016 Naver Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.navercorp.pinpoint.collector.dao.hbase.stat; - -import com.navercorp.pinpoint.common.hbase.HbaseOperations2; -import com.navercorp.pinpoint.common.hbase.HbaseTable; -import com.navercorp.pinpoint.common.hbase.TableNameProvider; -import com.navercorp.pinpoint.common.server.bo.serializer.stat.AgentStatHbaseOperationFactory; -import com.navercorp.pinpoint.common.server.bo.serializer.stat.AgentStatSerializer; -import com.navercorp.pinpoint.common.server.bo.stat.AgentStatBo; -import com.navercorp.pinpoint.common.server.bo.stat.AgentStatType; -import com.navercorp.pinpoint.common.server.bo.stat.JvmGcBo; -import org.springframework.stereotype.Repository; - -/** - * @author HyunGil Jeong - */ -@Repository -public class HbaseJvmGcDao extends DefaultAgentStatDao { - - public HbaseJvmGcDao(HbaseOperations2 hbaseTemplate, - TableNameProvider tableNameProvider, - AgentStatHbaseOperationFactory operationFactory, - AgentStatSerializer serializer) { - super(AgentStatType.JVM_GC, HbaseTable.AGENT_STAT_VER2, AgentStatBo::getJvmGcBos, - hbaseTemplate, tableNameProvider, operationFactory, serializer); - } - -} diff --git a/collector/src/main/java/com/navercorp/pinpoint/collector/dao/hbase/stat/HbaseJvmGcDetailedDao.java b/collector/src/main/java/com/navercorp/pinpoint/collector/dao/hbase/stat/HbaseJvmGcDetailedDao.java deleted file mode 100644 index 7999a3a1fdf4..000000000000 --- a/collector/src/main/java/com/navercorp/pinpoint/collector/dao/hbase/stat/HbaseJvmGcDetailedDao.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2016 Naver Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.navercorp.pinpoint.collector.dao.hbase.stat; - -import com.navercorp.pinpoint.common.hbase.HbaseOperations2; -import com.navercorp.pinpoint.common.hbase.HbaseTable; -import com.navercorp.pinpoint.common.hbase.TableNameProvider; -import com.navercorp.pinpoint.common.server.bo.serializer.stat.AgentStatHbaseOperationFactory; -import com.navercorp.pinpoint.common.server.bo.serializer.stat.AgentStatSerializer; -import com.navercorp.pinpoint.common.server.bo.stat.AgentStatBo; -import com.navercorp.pinpoint.common.server.bo.stat.AgentStatType; -import com.navercorp.pinpoint.common.server.bo.stat.JvmGcDetailedBo; -import org.springframework.stereotype.Repository; - -/** - * @author HyunGil Jeong - */ -@Repository -public class HbaseJvmGcDetailedDao extends DefaultAgentStatDao { - - public HbaseJvmGcDetailedDao(HbaseOperations2 hbaseTemplate, - TableNameProvider tableNameProvider, - AgentStatHbaseOperationFactory operationFactory, - AgentStatSerializer serializer) { - super(AgentStatType.JVM_GC_DETAILED, HbaseTable.AGENT_STAT_VER2, AgentStatBo::getJvmGcDetailedBos, - hbaseTemplate, tableNameProvider, operationFactory, serializer); - } - -} diff --git a/collector/src/main/java/com/navercorp/pinpoint/collector/dao/hbase/stat/HbaseResponseTimeDao.java b/collector/src/main/java/com/navercorp/pinpoint/collector/dao/hbase/stat/HbaseResponseTimeDao.java deleted file mode 100644 index 179c0e91e317..000000000000 --- a/collector/src/main/java/com/navercorp/pinpoint/collector/dao/hbase/stat/HbaseResponseTimeDao.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2017 NAVER Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.navercorp.pinpoint.collector.dao.hbase.stat; - -import com.navercorp.pinpoint.common.hbase.HbaseOperations2; -import com.navercorp.pinpoint.common.hbase.HbaseTable; -import com.navercorp.pinpoint.common.hbase.TableNameProvider; -import com.navercorp.pinpoint.common.server.bo.serializer.stat.AgentStatHbaseOperationFactory; -import com.navercorp.pinpoint.common.server.bo.serializer.stat.AgentStatSerializer; -import com.navercorp.pinpoint.common.server.bo.stat.AgentStatBo; -import com.navercorp.pinpoint.common.server.bo.stat.AgentStatType; -import com.navercorp.pinpoint.common.server.bo.stat.ResponseTimeBo; -import org.springframework.stereotype.Repository; - -/** - * @author Taejin Koo - */ -@Repository -public class HbaseResponseTimeDao extends DefaultAgentStatDao { - - public HbaseResponseTimeDao(HbaseOperations2 hbaseTemplate, - TableNameProvider tableNameProvider, - AgentStatHbaseOperationFactory operationFactory, - AgentStatSerializer serializer) { - super(AgentStatType.RESPONSE_TIME, HbaseTable.AGENT_STAT_VER2, AgentStatBo::getResponseTimeBos, - hbaseTemplate, tableNameProvider, operationFactory, serializer); - } - -} diff --git a/collector/src/main/java/com/navercorp/pinpoint/collector/dao/hbase/stat/HbaseTransactionDao.java b/collector/src/main/java/com/navercorp/pinpoint/collector/dao/hbase/stat/HbaseTransactionDao.java deleted file mode 100644 index f8cc9a6add6b..000000000000 --- a/collector/src/main/java/com/navercorp/pinpoint/collector/dao/hbase/stat/HbaseTransactionDao.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2016 Naver Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.navercorp.pinpoint.collector.dao.hbase.stat; - -import com.navercorp.pinpoint.common.hbase.HbaseOperations2; -import com.navercorp.pinpoint.common.hbase.HbaseTable; -import com.navercorp.pinpoint.common.hbase.TableNameProvider; -import com.navercorp.pinpoint.common.server.bo.serializer.stat.AgentStatHbaseOperationFactory; -import com.navercorp.pinpoint.common.server.bo.serializer.stat.AgentStatSerializer; -import com.navercorp.pinpoint.common.server.bo.stat.AgentStatBo; -import com.navercorp.pinpoint.common.server.bo.stat.AgentStatType; -import com.navercorp.pinpoint.common.server.bo.stat.TransactionBo; -import org.springframework.stereotype.Repository; - -/** - * @author HyunGil Jeong - */ -@Repository -public class HbaseTransactionDao extends DefaultAgentStatDao { - - public HbaseTransactionDao(HbaseOperations2 hbaseTemplate, - TableNameProvider tableNameProvider, - AgentStatHbaseOperationFactory operationFactory, - AgentStatSerializer serializer) { - super(AgentStatType.TRANSACTION, HbaseTable.AGENT_STAT_VER2, AgentStatBo::getTransactionBos, - hbaseTemplate, tableNameProvider, operationFactory, serializer); - } - -} diff --git a/collector/src/main/java/com/navercorp/pinpoint/collector/service/HBaseAgentStatService.java b/collector/src/main/java/com/navercorp/pinpoint/collector/service/HBaseAgentStatService.java index d957730d2f6b..1948762200a4 100644 --- a/collector/src/main/java/com/navercorp/pinpoint/collector/service/HBaseAgentStatService.java +++ b/collector/src/main/java/com/navercorp/pinpoint/collector/service/HBaseAgentStatService.java @@ -15,7 +15,7 @@ */ package com.navercorp.pinpoint.collector.service; -import com.navercorp.pinpoint.collector.dao.AgentStatDaoV2; +import com.navercorp.pinpoint.collector.dao.AgentStatDao; import com.navercorp.pinpoint.common.server.bo.stat.AgentStatBo; import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; @@ -31,19 +31,19 @@ public class HBaseAgentStatService implements AgentStatService { private final Logger logger = LogManager.getLogger(HBaseAgentStatService.class.getName()); - private final AgentStatDaoV2[] agentStatDaoList; + private final AgentStatDao[] agentStatDaoList; - public HBaseAgentStatService(AgentStatDaoV2[] agentStatDaoList) { + public HBaseAgentStatService(AgentStatDao[] agentStatDaoList) { this.agentStatDaoList = Objects.requireNonNull(agentStatDaoList, "agentStatDaoList"); - for (AgentStatDaoV2 agentStatDaoV2 : agentStatDaoList) { - logger.info("AgentStatDaoV2:{}", agentStatDaoV2.getClass().getSimpleName()); + for (AgentStatDao agentStatDao : agentStatDaoList) { + logger.info("AgentStatDaoV2:{}", agentStatDao.getClass().getSimpleName()); } } @Override public void save(AgentStatBo agentStatBo) { - for (AgentStatDaoV2 agentStatDao : agentStatDaoList) { + for (AgentStatDao agentStatDao : agentStatDaoList) { try { agentStatDao.dispatch(agentStatBo); } catch (Exception e) { diff --git a/collector/src/test/java/com/navercorp/pinpoint/collector/handler/thrift/ThriftAgentStatHandlerV2Test.java b/collector/src/test/java/com/navercorp/pinpoint/collector/handler/thrift/ThriftAgentStatHandlerV2Test.java index d791169fe864..849db1fbcd0b 100644 --- a/collector/src/test/java/com/navercorp/pinpoint/collector/handler/thrift/ThriftAgentStatHandlerV2Test.java +++ b/collector/src/test/java/com/navercorp/pinpoint/collector/handler/thrift/ThriftAgentStatHandlerV2Test.java @@ -16,7 +16,7 @@ package com.navercorp.pinpoint.collector.handler.thrift; -import com.navercorp.pinpoint.collector.dao.AgentStatDaoV2; +import com.navercorp.pinpoint.collector.dao.AgentStatDao; import com.navercorp.pinpoint.collector.mapper.thrift.stat.ThriftAgentStatBatchMapper; import com.navercorp.pinpoint.collector.mapper.thrift.stat.ThriftAgentStatMapper; import com.navercorp.pinpoint.collector.service.AgentStatService; @@ -47,40 +47,40 @@ public class ThriftAgentStatHandlerV2Test { private ThriftAgentStatBatchMapper agentStatBatchMapper; @Mock - private AgentStatDaoV2 jvmGcDao; + private AgentStatDao jvmGcDao; @Mock - private AgentStatDaoV2 jvmGcDetailedDao; + private AgentStatDao jvmGcDetailedDao; @Mock - private AgentStatDaoV2 cpuLoadDao; + private AgentStatDao cpuLoadDao; @Mock - private AgentStatDaoV2 transactionDao; + private AgentStatDao transactionDao; @Mock - private AgentStatDaoV2 activeTraceDao; + private AgentStatDao activeTraceDao; @Mock - private AgentStatDaoV2 dataSourceDao; + private AgentStatDao dataSourceDao; @Mock - private AgentStatDaoV2 responseTimeDao; + private AgentStatDao responseTimeDao; @Mock - private AgentStatDaoV2 deadlockDao; + private AgentStatDao deadlockDao; @Mock - private AgentStatDaoV2 fileDescriptorDao; + private AgentStatDao fileDescriptorDao; @Mock - private AgentStatDaoV2 directBufferDao; + private AgentStatDao directBufferDao; @Mock - private AgentStatDaoV2 totalThreadCountDao; + private AgentStatDao totalThreadCountDao; @Mock - private AgentStatDaoV2 loadedClassDao; + private AgentStatDao loadedClassDao; @Spy private List agentStatServiceList = new ArrayList<>(); @@ -91,7 +91,7 @@ public class ThriftAgentStatHandlerV2Test { @Before public void setUp() throws Exception { MockitoAnnotations.initMocks(this); - hBaseAgentStatService = new HBaseAgentStatService(new AgentStatDaoV2[] {jvmGcDao, jvmGcDetailedDao, cpuLoadDao, transactionDao, + hBaseAgentStatService = new HBaseAgentStatService(new AgentStatDao[] {jvmGcDao, jvmGcDetailedDao, cpuLoadDao, transactionDao, activeTraceDao, dataSourceDao, responseTimeDao, deadlockDao, fileDescriptorDao, directBufferDao, totalThreadCountDao, loadedClassDao}); agentStatServiceList.add(hBaseAgentStatService);