From ab4731ef2761c3b7d4f0cfe0aac3b76d0ce90f59 Mon Sep 17 00:00:00 2001 From: "minwoo.jung" Date: Wed, 8 Jan 2025 16:33:59 +0900 Subject: [PATCH] [#11905] Delete the logic associated with flink. --- .../navercorp/pinpoint/batch/BatchModule.java | 1 - .../batch/common/BatchJobLauncher.java | 8 - .../batch/common/BatchProperties.java | 33 +- .../batch/flink/HealthCheckTaskletV2.java | 145 -- .../src/main/resources/batch-root.properties | 7 - .../job/applicationContext-flinkCheckJob.xml | 19 - .../pinpoint/batch/BatchPropertiesTest.java | 10 +- .../batch/flink/HealthCheckTaskletV2Test.java | 55 - .../collector/PinpointCollectorModule.java | 2 - .../collector/config/FlinkContextModule.java | 34 - .../collector/config/FlinkProperties.java | 77 - .../flink/ClusterConnectionManager.java | 34 - .../flink/FlinkClusterConnectionManager.java | 121 -- .../collector/flink/FlinkClusterService.java | 165 -- .../collector/flink/SenderContext.java | 41 - .../flink/TcpDataSenderRepository.java | 77 - .../flink/ZookeeperClusterManager.java | 291 ---- .../mapper/flink/FlinkStatMapper.java | 11 - .../mapper/flink/TFActiveTraceMapper.java | 68 - .../mapper/flink/TFAgentStatBatchMapper.java | 51 - .../mapper/flink/TFAgentStatMapper.java | 89 - .../mapper/flink/TFCpuLoadMapper.java | 50 - .../mapper/flink/TFDataSourceBoMapper.java | 37 - .../flink/TFDataSourceListBoMapper.java | 62 - .../mapper/flink/TFDirectBufferMapper.java | 52 - .../mapper/flink/TFFileDescriptorMapper.java | 49 - .../collector/mapper/flink/TFJvmGcMapper.java | 50 - .../mapper/flink/TFLoadedClassMapper.java | 48 - .../mapper/flink/TFResponseTimeMapper.java | 49 - .../flink/TFTotalThreadCountMapper.java | 46 - .../mapper/flink/TFTransactionMapper.java | 54 - .../collector/sender/FlinkRequestFactory.java | 32 - .../collector/sender/FlinkTcpDataSender.java | 73 - .../service/SendAgentStatService.java | 56 - .../service/SendDataToFlinkService.java | 74 - .../applicationContext-collector-flink.xml | 38 - .../pinpoint-collector-root.properties | 9 - .../mapper/flink/TFActiveTraceMapperTest.java | 64 - .../flink/TFAgentStatBatchMapperTest.java | 84 - .../mapper/flink/TFAgentStatMapperTest.java | 523 ------ .../mapper/flink/TFCpuLoadMapperTest.java | 40 - .../flink/TFDataSourceBoMapperTest.java | 53 - .../flink/TFDataSourceListBoMapperTest.java | 88 - .../flink/TFDirectBufferMapperTest.java | 44 - .../flink/TFFileDescriptorMapperTest.java | 38 - .../mapper/flink/TFJvmGcMapperTest.java | 42 - .../flink/TFLoadedClassCountMapperTest.java | 36 - .../flink/TFResponseTimeMapperTest.java | 38 - .../flink/TFTotalThreadCountMapperTest.java | 34 - .../mapper/flink/TFTransactionMapperTest.java | 49 - .../zookeeper/ZookeeperClusterProperties.java | 16 - .../cluster/zookeeper/ZookeeperConstants.java | 1 - .../config/ClusterConfigurationFactory.java | 45 - .../config/ClusterConfigurationTest.java | 37 - .../test/resources/test-cluster.properties | 14 +- .../server/CommonsHbaseConfiguration.java | 4 - .../bo/codec/stat/ApplicationStatCodec.java | 35 - .../bo/codec/stat/ApplicationStatDecoder.java | 51 - .../bo/codec/stat/ApplicationStatEncoder.java | 50 - .../bo/codec/stat/join/ActiveTraceCodec.java | 134 -- .../join/ApplicationCoderConfiguration.java | 142 -- .../bo/codec/stat/join/CpuLoadCodec.java | 124 -- .../bo/codec/stat/join/DataSourceCodec.java | 182 -- .../bo/codec/stat/join/DirectBufferCodec.java | 158 -- .../codec/stat/join/FileDescriptorCodec.java | 116 -- .../bo/codec/stat/join/LoadedClassCodec.java | 128 -- .../bo/codec/stat/join/MemoryCodec.java | 127 -- .../bo/codec/stat/join/ResponseTimeCodec.java | 115 -- .../stat/join/TotalThreadCountCodec.java | 110 -- .../bo/codec/stat/join/TransactionCodec.java | 126 -- .../stat/strategy/JoinEncodingStrategy.java | 42 - .../strategy/JoinFieldStrategyAnalyzer.java | 41 - .../JoinIntFieldEncodingStrategy.java | 131 -- .../JoinIntFieldStrategyAnalyzer.java | 103 -- .../JoinLongFieldEncodingStrategy.java | 131 -- .../JoinLongFieldStrategyAnalyzer.java | 102 -- .../stat/ApplicationStatDecodingContext.java | 52 - .../ApplicationStatHbaseOperationFactory.java | 112 -- .../stat/ApplicationStatRowKeyComponent.java | 47 - .../stat/ApplicationStatRowKeyDecoder.java | 40 - .../stat/ApplicationStatRowKeyEncoder.java | 45 - ...ApplicationStatSerializeConfiguration.java | 93 -- .../stat/join/ApplicationStatSerializer.java | 55 - .../bo/stat/join/AbstractJoinFieldBo.java | 108 -- .../bo/stat/join/JoinActiveTraceBo.java | 154 -- .../server/bo/stat/join/JoinAgentStatBo.java | 255 --- .../bo/stat/join/JoinApplicationStatBo.java | 447 ----- .../server/bo/stat/join/JoinCpuLoadBo.java | 143 -- .../server/bo/stat/join/JoinDataSourceBo.java | 132 -- .../bo/stat/join/JoinDataSourceListBo.java | 173 -- .../bo/stat/join/JoinDirectBufferBo.java | 193 --- .../bo/stat/join/JoinDoubleFieldBo.java | 77 - .../server/bo/stat/join/JoinFieldBo.java | 34 - .../bo/stat/join/JoinFileDescriptorBo.java | 123 -- .../server/bo/stat/join/JoinIntFieldBo.java | 68 - .../bo/stat/join/JoinLoadedClassBo.java | 147 -- .../server/bo/stat/join/JoinLongFieldBo.java | 75 - .../server/bo/stat/join/JoinMemoryBo.java | 145 -- .../bo/stat/join/JoinResponseTimeBo.java | 127 -- .../bo/stat/join/JoinTotalThreadCountBo.java | 118 -- .../bo/stat/join/JoinTransactionBo.java | 138 -- .../common/server/bo/stat/join/StatType.java | 118 -- .../codec/stat/join/ActiveTraceCodecTest.java | 75 - .../bo/codec/stat/join/CpuLoadCodecTest.java | 75 - .../codec/stat/join/DataSourceCodecTest.java | 87 - .../stat/join/DirectBufferCodecTest.java | 76 - .../stat/join/FileDescriptorCodecTest.java | 76 - .../stat/join/LoadedClassCountCodecTest.java | 72 - .../bo/codec/stat/join/MemoryCodecTest.java | 76 - .../stat/join/ResponseTimeCodecTest.java | 75 - .../stat/join/TotalThreadCountCodecTest.java | 72 - .../codec/stat/join/TransactionCodecTest.java | 75 - .../bo/stat/join/JoinActiveTraceBoTest.java | 53 - .../stat/join/JoinApplicationStatBoTest.java | 1462 ----------------- .../bo/stat/join/JoinCpuLoadBoTest.java | 51 - .../bo/stat/join/JoinDataSourceBoTest.java | 55 - .../stat/join/JoinDataSourceListBoTest.java | 105 -- .../bo/stat/join/JoinDirectBufferBoTest.java | 75 - .../stat/join/JoinFileDescriptorBoTest.java | 50 - .../bo/stat/join/JoinLoadedClassBoTest.java | 48 - .../server/bo/stat/join/JoinMemoryBoTest.java | 53 - .../bo/stat/join/JoinResponseTimeBoTest.java | 53 - .../stat/join/JoinTotalThreadCountBoTest.java | 47 - .../bo/stat/join/JoinTransactionBoTest.java | 52 - flink/pom.xml | 196 +-- .../navercorp/pinpoint/flink/Bootstrap.java | 201 --- .../navercorp/pinpoint/flink/FlinkModule.java | 74 - .../pinpoint/flink/StatStreamingVer2Job.java | 112 -- .../flink/cache/FlinkCacheConfiguration.java | 55 - .../flink/cluster/FlinkServerRegister.java | 227 --- .../flink/cluster/zookeeper/PushZNodeJob.java | 30 - .../ZookeeperClusterDataManagerHelper.java | 53 - .../flink/config/DataReceiverProperties.java | 76 - .../config/FlinkExecutorConfiguration.java | 70 - .../flink/config/FlinkProperties.java | 111 -- .../hbase/ApplicationDaoConfiguration.java | 104 -- .../flink/dao/hbase/ApplicationMetricDao.java | 12 - .../hbase/DefaultApplicationMetricDao.java | 73 - .../DefaultStatisticsDaoInterceptor.java | 33 - .../flink/dao/hbase/StatisticsDao.java | 101 -- .../dao/hbase/StatisticsDaoInterceptor.java | 28 - .../function/AgentStatTimestampAssigner.java | 31 - .../function/ApplicationStatBoFilter.java | 36 - .../function/ApplicationStatBoWindow.java | 104 -- .../ApplicationStatBoWindowInterceptor.java | 30 - .../function/ApplicationStatKeySelector.java | 31 - ...ultApplicationStatBoWindowInterceptor.java | 37 - .../function/JoinAgentStatBoFunction.java | 47 - .../pinpoint/flink/function/Timestamp.java | 40 - .../pinpoint/flink/function/Timestamp2.java | 40 - .../Hbase2HadoopResourceCleanerRegistry.java | 137 -- .../flink/mapper/thrift/ThriftBoMapper.java | 26 - .../thrift/stat/JoinActiveTraceBoMapper.java | 83 - .../thrift/stat/JoinAgentStatBoMapper.java | 79 - .../thrift/stat/JoinCpuLoadBoMapper.java | 59 - .../stat/JoinDataSourceListBoMapper.java | 80 - .../thrift/stat/JoinDirectBufferBoMapper.java | 68 - .../stat/JoinFileDescriptorBoMapper.java | 59 - .../thrift/stat/JoinLoadedClassBoMapper.java | 55 - .../thrift/stat/JoinMemoryBoMapper.java | 60 - .../thrift/stat/JoinResponseTimeBoMapper.java | 57 - .../stat/JoinTotalThreadCountBoMapper.java | 50 - .../thrift/stat/JoinTransactionBoMapper.java | 80 - .../mapper/thrift/stat/ThriftStatMapper.java | 29 - .../flink/process/ApplicationCache.java | 128 -- .../DefaultTBaseFlatMapperInterceptor.java | 41 - .../flink/process/TBaseFlatMapper.java | 151 -- .../process/TBaseFlatMapperInterceptor.java | 34 - .../flink/receiver/AgentStatHandler.java | 53 - .../receiver/FlinkPacketHandlerFactory.java | 57 - .../flink/receiver/SourceContextManager.java | 63 - .../flink/receiver/TcpDispatchHandler.java | 59 - .../flink/receiver/TcpSourceFunction.java | 60 - .../navercorp/pinpoint/flink/vo/RawData.java | 44 - .../io/netty/buffer/PoolArenaCleaner.java | 57 - .../applicationContext-flink-extend.xml | 13 - .../resources/applicationContext-flink.xml | 105 -- .../resources/applicationContext-hbase.xml | 20 - flink/src/main/resources/log4j2.xml | 23 - flink/src/main/resources/profiles/.gitignore | 4 - .../resources/profiles/local/hbase.properties | 30 - .../profiles/local/pinpoint-flink.properties | 43 - .../profiles/release/hbase.properties | 29 - .../release/pinpoint-flink.properties | 43 - flink/src/main/resources/spring.properties | 1 - .../config/DataReceiverPropertiesTest.java | 61 - .../flink/config/FlinkPropertiesTest.java | 41 - .../stat/JoinAgentStatBoMapperTest.java | 442 ----- .../stat/JoinDataSourceListBoMapperTest.java | 99 -- .../stat/JoinDirectBufferBoMapperTest.java | 79 - .../stat/JoinFileDescriptorBoMapperTest.java | 62 - .../stat/JoinLoadedClassBoMapperTest.java | 60 - .../thrift/stat/JoinMemoryBoMapperTest.java | 66 - .../stat/JoinResponseTimeBoMapperTest.java | 65 - .../JoinThriftActiveTraceBoMapperTest.java | 82 - .../stat/JoinThriftCpuLoadBoMapperTest.java | 69 - .../JoinTotalThreadCountBoMapperTest.java | 58 - .../stat/JoinTransactionBoMapperTest.java | 73 - .../flink/process/TBaseFlatMapperTest.java | 519 ------ pom.xml | 2 - spotbugs-exclude.xml | 1 - .../pinpoint/io/request/FlinkRequest.java | 42 - .../pinpoint/web/WebHbaseModule.java | 2 - .../ApplicationDataSourceController.java | 48 - .../DefaultApplicationMetricDao.java | 71 - .../HbaseApplicationStatDaoOperations.java | 99 -- .../ApplicationMetricConfiguration.java | 112 -- .../mapper/stat/ApplicationStatMapper.java | 92 -- .../sampler/JoinActiveTraceSampler.java | 47 - .../sampling/sampler/JoinCpuLoadSampler.java | 64 - .../sampler/JoinDataSourceSampler.java | 56 - .../sampler/JoinDirectBufferSampler.java | 48 - .../sampler/JoinFileDescriptorSampler.java | 46 - .../sampler/JoinLoadedClassSampler.java | 44 - .../sampling/sampler/JoinMemorySampler.java | 46 - .../sampler/JoinResponseTimeSampler.java | 45 - .../sampler/JoinTotalThreadCountSampler.java | 41 - .../sampler/JoinTransactionSampler.java | 45 - .../ApplicationDataSourceService.java | 98 -- ...ApplicationMetricServiceConfiguration.java | 75 - .../view/IntApplicationStatSerializer.java | 42 - .../view/LongApplicationStatSerializer.java | 43 - .../web/vo/stat/AggreJoinActiveTraceBo.java | 42 - .../web/vo/stat/AggreJoinCpuLoadBo.java | 37 - .../web/vo/stat/AggreJoinDataSourceBo.java | 62 - .../vo/stat/AggreJoinDataSourceListBo.java | 56 - .../web/vo/stat/AggreJoinDirectBufferBo.java | 43 - .../vo/stat/AggreJoinFileDescriptorBo.java | 42 - .../web/vo/stat/AggreJoinLoadedClassBo.java | 43 - .../web/vo/stat/AggreJoinMemoryBo.java | 42 - .../web/vo/stat/AggreJoinResponseTimeBo.java | 42 - .../vo/stat/AggreJoinTotalThreadCountBo.java | 40 - .../web/vo/stat/AggreJoinTransactionBo.java | 42 - .../ApplicationActiveTraceChart.java | 61 - .../application/ApplicationCpuLoadChart.java | 66 - .../ApplicationDataSourceChart.java | 114 -- .../ApplicationDirectBufferChart.java | 82 - .../ApplicationFileDescriptorChart.java | 58 - .../ApplicationLoadedClassChart.java | 66 - .../application/ApplicationMemoryChart.java | 68 - .../ApplicationResponseTimeChart.java | 60 - .../ApplicationTotalThreadCountChart.java | 55 - .../ApplicationTransactionChart.java | 58 - .../application/IntApplicationStatPoint.java | 56 - .../application/LongApplicationStatPoint.java | 56 - .../chart/application/StatPointUtils.java | 31 - .../sampler/JoinActiveTraceSamplerTest.java | 58 - .../sampler/JoinCpuLoadSamplerTest.java | 52 - .../sampler/JoinDataSourceSamplerTest.java | 100 -- .../sampler/JoinDirectBufferSamplerTest.java | 57 - .../JoinFileDescriptorSamplerTest.java | 51 - .../sampler/JoinLoadedClassSamplerTest.java | 48 - .../sampler/JoinMemorySamplerTest.java | 55 - .../sampler/JoinResponseTimeSamplerTest.java | 65 - .../sampler/JoinTotalThreadSamplerTest.java | 47 - .../sampler/JoinTransactionSamplerTest.java | 57 - .../ApplicationDataSourceServiceTest.java | 72 - .../ApplicationActiveTraceChartGroupTest.java | 75 - .../ApplicationCpuLoadChartGroupTest.java | 94 -- .../ApplicationDataSourceChartGroupTest.java | 78 - ...ApplicationDirectBufferChartGroupTest.java | 131 -- ...plicationFileDescriptorChartGroupTest.java | 77 - .../ApplicationLoadedClassChartGroupTest.java | 91 - .../ApplicationMemoryChartGroupTest.java | 82 - ...ApplicationResponseTimeChartGroupTest.java | 78 - ...icationTotalThreadCountChartGroupTest.java | 72 - .../ApplicationTransactionChartGroupTest.java | 76 - 267 files changed, 5 insertions(+), 21348 deletions(-) delete mode 100644 batch/src/main/java/com/navercorp/pinpoint/batch/flink/HealthCheckTaskletV2.java delete mode 100644 batch/src/main/resources/job/applicationContext-flinkCheckJob.xml delete mode 100644 batch/src/test/java/com/navercorp/pinpoint/batch/flink/HealthCheckTaskletV2Test.java delete mode 100644 collector/src/main/java/com/navercorp/pinpoint/collector/config/FlinkContextModule.java delete mode 100644 collector/src/main/java/com/navercorp/pinpoint/collector/config/FlinkProperties.java delete mode 100644 collector/src/main/java/com/navercorp/pinpoint/collector/flink/ClusterConnectionManager.java delete mode 100644 collector/src/main/java/com/navercorp/pinpoint/collector/flink/FlinkClusterConnectionManager.java delete mode 100644 collector/src/main/java/com/navercorp/pinpoint/collector/flink/FlinkClusterService.java delete mode 100644 collector/src/main/java/com/navercorp/pinpoint/collector/flink/SenderContext.java delete mode 100644 collector/src/main/java/com/navercorp/pinpoint/collector/flink/TcpDataSenderRepository.java delete mode 100644 collector/src/main/java/com/navercorp/pinpoint/collector/flink/ZookeeperClusterManager.java delete mode 100644 collector/src/main/java/com/navercorp/pinpoint/collector/mapper/flink/FlinkStatMapper.java delete mode 100644 collector/src/main/java/com/navercorp/pinpoint/collector/mapper/flink/TFActiveTraceMapper.java delete mode 100644 collector/src/main/java/com/navercorp/pinpoint/collector/mapper/flink/TFAgentStatBatchMapper.java delete mode 100644 collector/src/main/java/com/navercorp/pinpoint/collector/mapper/flink/TFAgentStatMapper.java delete mode 100644 collector/src/main/java/com/navercorp/pinpoint/collector/mapper/flink/TFCpuLoadMapper.java delete mode 100644 collector/src/main/java/com/navercorp/pinpoint/collector/mapper/flink/TFDataSourceBoMapper.java delete mode 100644 collector/src/main/java/com/navercorp/pinpoint/collector/mapper/flink/TFDataSourceListBoMapper.java delete mode 100644 collector/src/main/java/com/navercorp/pinpoint/collector/mapper/flink/TFDirectBufferMapper.java delete mode 100644 collector/src/main/java/com/navercorp/pinpoint/collector/mapper/flink/TFFileDescriptorMapper.java delete mode 100644 collector/src/main/java/com/navercorp/pinpoint/collector/mapper/flink/TFJvmGcMapper.java delete mode 100644 collector/src/main/java/com/navercorp/pinpoint/collector/mapper/flink/TFLoadedClassMapper.java delete mode 100644 collector/src/main/java/com/navercorp/pinpoint/collector/mapper/flink/TFResponseTimeMapper.java delete mode 100644 collector/src/main/java/com/navercorp/pinpoint/collector/mapper/flink/TFTotalThreadCountMapper.java delete mode 100644 collector/src/main/java/com/navercorp/pinpoint/collector/mapper/flink/TFTransactionMapper.java delete mode 100644 collector/src/main/java/com/navercorp/pinpoint/collector/sender/FlinkRequestFactory.java delete mode 100644 collector/src/main/java/com/navercorp/pinpoint/collector/sender/FlinkTcpDataSender.java delete mode 100644 collector/src/main/java/com/navercorp/pinpoint/collector/service/SendAgentStatService.java delete mode 100644 collector/src/main/java/com/navercorp/pinpoint/collector/service/SendDataToFlinkService.java delete mode 100644 collector/src/main/resources/applicationContext-collector-flink.xml delete mode 100644 collector/src/test/java/com/navercorp/pinpoint/collector/mapper/flink/TFActiveTraceMapperTest.java delete mode 100644 collector/src/test/java/com/navercorp/pinpoint/collector/mapper/flink/TFAgentStatBatchMapperTest.java delete mode 100644 collector/src/test/java/com/navercorp/pinpoint/collector/mapper/flink/TFAgentStatMapperTest.java delete mode 100644 collector/src/test/java/com/navercorp/pinpoint/collector/mapper/flink/TFCpuLoadMapperTest.java delete mode 100644 collector/src/test/java/com/navercorp/pinpoint/collector/mapper/flink/TFDataSourceBoMapperTest.java delete mode 100644 collector/src/test/java/com/navercorp/pinpoint/collector/mapper/flink/TFDataSourceListBoMapperTest.java delete mode 100644 collector/src/test/java/com/navercorp/pinpoint/collector/mapper/flink/TFDirectBufferMapperTest.java delete mode 100644 collector/src/test/java/com/navercorp/pinpoint/collector/mapper/flink/TFFileDescriptorMapperTest.java delete mode 100644 collector/src/test/java/com/navercorp/pinpoint/collector/mapper/flink/TFJvmGcMapperTest.java delete mode 100644 collector/src/test/java/com/navercorp/pinpoint/collector/mapper/flink/TFLoadedClassCountMapperTest.java delete mode 100644 collector/src/test/java/com/navercorp/pinpoint/collector/mapper/flink/TFResponseTimeMapperTest.java delete mode 100644 collector/src/test/java/com/navercorp/pinpoint/collector/mapper/flink/TFTotalThreadCountMapperTest.java delete mode 100644 collector/src/test/java/com/navercorp/pinpoint/collector/mapper/flink/TFTransactionMapperTest.java delete mode 100644 commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/codec/stat/ApplicationStatCodec.java delete mode 100644 commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/codec/stat/ApplicationStatDecoder.java delete mode 100644 commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/codec/stat/ApplicationStatEncoder.java delete mode 100644 commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/codec/stat/join/ActiveTraceCodec.java delete mode 100644 commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/codec/stat/join/ApplicationCoderConfiguration.java delete mode 100644 commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/codec/stat/join/CpuLoadCodec.java delete mode 100644 commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/codec/stat/join/DataSourceCodec.java delete mode 100644 commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/codec/stat/join/DirectBufferCodec.java delete mode 100644 commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/codec/stat/join/FileDescriptorCodec.java delete mode 100644 commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/codec/stat/join/LoadedClassCodec.java delete mode 100644 commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/codec/stat/join/MemoryCodec.java delete mode 100644 commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/codec/stat/join/ResponseTimeCodec.java delete mode 100644 commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/codec/stat/join/TotalThreadCountCodec.java delete mode 100644 commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/codec/stat/join/TransactionCodec.java delete mode 100644 commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/codec/stat/strategy/JoinEncodingStrategy.java delete mode 100644 commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/codec/stat/strategy/JoinFieldStrategyAnalyzer.java delete mode 100644 commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/codec/stat/strategy/JoinIntFieldEncodingStrategy.java delete mode 100644 commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/codec/stat/strategy/JoinIntFieldStrategyAnalyzer.java delete mode 100644 commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/codec/stat/strategy/JoinLongFieldEncodingStrategy.java delete mode 100644 commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/codec/stat/strategy/JoinLongFieldStrategyAnalyzer.java delete mode 100644 commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/serializer/stat/ApplicationStatDecodingContext.java delete mode 100644 commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/serializer/stat/ApplicationStatHbaseOperationFactory.java delete mode 100644 commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/serializer/stat/ApplicationStatRowKeyComponent.java delete mode 100644 commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/serializer/stat/ApplicationStatRowKeyDecoder.java delete mode 100644 commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/serializer/stat/ApplicationStatRowKeyEncoder.java delete mode 100644 commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/serializer/stat/config/ApplicationStatSerializeConfiguration.java delete mode 100644 commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/serializer/stat/join/ApplicationStatSerializer.java delete mode 100644 commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/join/AbstractJoinFieldBo.java delete mode 100644 commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinActiveTraceBo.java delete mode 100644 commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinAgentStatBo.java delete mode 100644 commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinApplicationStatBo.java delete mode 100644 commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinCpuLoadBo.java delete mode 100644 commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinDataSourceBo.java delete mode 100644 commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinDataSourceListBo.java delete mode 100644 commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinDirectBufferBo.java delete mode 100644 commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinDoubleFieldBo.java delete mode 100644 commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinFieldBo.java delete mode 100644 commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinFileDescriptorBo.java delete mode 100644 commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinIntFieldBo.java delete mode 100644 commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinLoadedClassBo.java delete mode 100644 commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinLongFieldBo.java delete mode 100644 commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinMemoryBo.java delete mode 100644 commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinResponseTimeBo.java delete mode 100644 commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinTotalThreadCountBo.java delete mode 100644 commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinTransactionBo.java delete mode 100644 commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/join/StatType.java delete mode 100644 commons-server/src/test/java/com/navercorp/pinpoint/common/server/bo/codec/stat/join/ActiveTraceCodecTest.java delete mode 100644 commons-server/src/test/java/com/navercorp/pinpoint/common/server/bo/codec/stat/join/CpuLoadCodecTest.java delete mode 100644 commons-server/src/test/java/com/navercorp/pinpoint/common/server/bo/codec/stat/join/DataSourceCodecTest.java delete mode 100644 commons-server/src/test/java/com/navercorp/pinpoint/common/server/bo/codec/stat/join/DirectBufferCodecTest.java delete mode 100644 commons-server/src/test/java/com/navercorp/pinpoint/common/server/bo/codec/stat/join/FileDescriptorCodecTest.java delete mode 100644 commons-server/src/test/java/com/navercorp/pinpoint/common/server/bo/codec/stat/join/LoadedClassCountCodecTest.java delete mode 100644 commons-server/src/test/java/com/navercorp/pinpoint/common/server/bo/codec/stat/join/MemoryCodecTest.java delete mode 100644 commons-server/src/test/java/com/navercorp/pinpoint/common/server/bo/codec/stat/join/ResponseTimeCodecTest.java delete mode 100644 commons-server/src/test/java/com/navercorp/pinpoint/common/server/bo/codec/stat/join/TotalThreadCountCodecTest.java delete mode 100644 commons-server/src/test/java/com/navercorp/pinpoint/common/server/bo/codec/stat/join/TransactionCodecTest.java delete mode 100644 commons-server/src/test/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinActiveTraceBoTest.java delete mode 100644 commons-server/src/test/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinApplicationStatBoTest.java delete mode 100644 commons-server/src/test/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinCpuLoadBoTest.java delete mode 100644 commons-server/src/test/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinDataSourceBoTest.java delete mode 100644 commons-server/src/test/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinDataSourceListBoTest.java delete mode 100644 commons-server/src/test/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinDirectBufferBoTest.java delete mode 100644 commons-server/src/test/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinFileDescriptorBoTest.java delete mode 100644 commons-server/src/test/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinLoadedClassBoTest.java delete mode 100644 commons-server/src/test/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinMemoryBoTest.java delete mode 100644 commons-server/src/test/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinResponseTimeBoTest.java delete mode 100644 commons-server/src/test/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinTotalThreadCountBoTest.java delete mode 100644 commons-server/src/test/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinTransactionBoTest.java delete mode 100644 flink/src/main/java/com/navercorp/pinpoint/flink/Bootstrap.java delete mode 100644 flink/src/main/java/com/navercorp/pinpoint/flink/FlinkModule.java delete mode 100644 flink/src/main/java/com/navercorp/pinpoint/flink/StatStreamingVer2Job.java delete mode 100644 flink/src/main/java/com/navercorp/pinpoint/flink/cache/FlinkCacheConfiguration.java delete mode 100644 flink/src/main/java/com/navercorp/pinpoint/flink/cluster/FlinkServerRegister.java delete mode 100644 flink/src/main/java/com/navercorp/pinpoint/flink/cluster/zookeeper/PushZNodeJob.java delete mode 100644 flink/src/main/java/com/navercorp/pinpoint/flink/cluster/zookeeper/ZookeeperClusterDataManagerHelper.java delete mode 100644 flink/src/main/java/com/navercorp/pinpoint/flink/config/DataReceiverProperties.java delete mode 100644 flink/src/main/java/com/navercorp/pinpoint/flink/config/FlinkExecutorConfiguration.java delete mode 100644 flink/src/main/java/com/navercorp/pinpoint/flink/config/FlinkProperties.java delete mode 100644 flink/src/main/java/com/navercorp/pinpoint/flink/dao/hbase/ApplicationDaoConfiguration.java delete mode 100644 flink/src/main/java/com/navercorp/pinpoint/flink/dao/hbase/ApplicationMetricDao.java delete mode 100644 flink/src/main/java/com/navercorp/pinpoint/flink/dao/hbase/DefaultApplicationMetricDao.java delete mode 100644 flink/src/main/java/com/navercorp/pinpoint/flink/dao/hbase/DefaultStatisticsDaoInterceptor.java delete mode 100644 flink/src/main/java/com/navercorp/pinpoint/flink/dao/hbase/StatisticsDao.java delete mode 100644 flink/src/main/java/com/navercorp/pinpoint/flink/dao/hbase/StatisticsDaoInterceptor.java delete mode 100644 flink/src/main/java/com/navercorp/pinpoint/flink/function/AgentStatTimestampAssigner.java delete mode 100644 flink/src/main/java/com/navercorp/pinpoint/flink/function/ApplicationStatBoFilter.java delete mode 100644 flink/src/main/java/com/navercorp/pinpoint/flink/function/ApplicationStatBoWindow.java delete mode 100644 flink/src/main/java/com/navercorp/pinpoint/flink/function/ApplicationStatBoWindowInterceptor.java delete mode 100644 flink/src/main/java/com/navercorp/pinpoint/flink/function/ApplicationStatKeySelector.java delete mode 100644 flink/src/main/java/com/navercorp/pinpoint/flink/function/DefaultApplicationStatBoWindowInterceptor.java delete mode 100644 flink/src/main/java/com/navercorp/pinpoint/flink/function/JoinAgentStatBoFunction.java delete mode 100644 flink/src/main/java/com/navercorp/pinpoint/flink/function/Timestamp.java delete mode 100644 flink/src/main/java/com/navercorp/pinpoint/flink/function/Timestamp2.java delete mode 100644 flink/src/main/java/com/navercorp/pinpoint/flink/hbase/Hbase2HadoopResourceCleanerRegistry.java delete mode 100644 flink/src/main/java/com/navercorp/pinpoint/flink/mapper/thrift/ThriftBoMapper.java delete mode 100644 flink/src/main/java/com/navercorp/pinpoint/flink/mapper/thrift/stat/JoinActiveTraceBoMapper.java delete mode 100644 flink/src/main/java/com/navercorp/pinpoint/flink/mapper/thrift/stat/JoinAgentStatBoMapper.java delete mode 100644 flink/src/main/java/com/navercorp/pinpoint/flink/mapper/thrift/stat/JoinCpuLoadBoMapper.java delete mode 100644 flink/src/main/java/com/navercorp/pinpoint/flink/mapper/thrift/stat/JoinDataSourceListBoMapper.java delete mode 100644 flink/src/main/java/com/navercorp/pinpoint/flink/mapper/thrift/stat/JoinDirectBufferBoMapper.java delete mode 100644 flink/src/main/java/com/navercorp/pinpoint/flink/mapper/thrift/stat/JoinFileDescriptorBoMapper.java delete mode 100644 flink/src/main/java/com/navercorp/pinpoint/flink/mapper/thrift/stat/JoinLoadedClassBoMapper.java delete mode 100644 flink/src/main/java/com/navercorp/pinpoint/flink/mapper/thrift/stat/JoinMemoryBoMapper.java delete mode 100644 flink/src/main/java/com/navercorp/pinpoint/flink/mapper/thrift/stat/JoinResponseTimeBoMapper.java delete mode 100644 flink/src/main/java/com/navercorp/pinpoint/flink/mapper/thrift/stat/JoinTotalThreadCountBoMapper.java delete mode 100644 flink/src/main/java/com/navercorp/pinpoint/flink/mapper/thrift/stat/JoinTransactionBoMapper.java delete mode 100644 flink/src/main/java/com/navercorp/pinpoint/flink/mapper/thrift/stat/ThriftStatMapper.java delete mode 100644 flink/src/main/java/com/navercorp/pinpoint/flink/process/ApplicationCache.java delete mode 100644 flink/src/main/java/com/navercorp/pinpoint/flink/process/DefaultTBaseFlatMapperInterceptor.java delete mode 100644 flink/src/main/java/com/navercorp/pinpoint/flink/process/TBaseFlatMapper.java delete mode 100644 flink/src/main/java/com/navercorp/pinpoint/flink/process/TBaseFlatMapperInterceptor.java delete mode 100644 flink/src/main/java/com/navercorp/pinpoint/flink/receiver/AgentStatHandler.java delete mode 100644 flink/src/main/java/com/navercorp/pinpoint/flink/receiver/FlinkPacketHandlerFactory.java delete mode 100644 flink/src/main/java/com/navercorp/pinpoint/flink/receiver/SourceContextManager.java delete mode 100644 flink/src/main/java/com/navercorp/pinpoint/flink/receiver/TcpDispatchHandler.java delete mode 100644 flink/src/main/java/com/navercorp/pinpoint/flink/receiver/TcpSourceFunction.java delete mode 100644 flink/src/main/java/com/navercorp/pinpoint/flink/vo/RawData.java delete mode 100644 flink/src/main/java/org/apache/hbase/thirdparty/io/netty/buffer/PoolArenaCleaner.java delete mode 100644 flink/src/main/resources/applicationContext-flink-extend.xml delete mode 100644 flink/src/main/resources/applicationContext-flink.xml delete mode 100644 flink/src/main/resources/applicationContext-hbase.xml delete mode 100644 flink/src/main/resources/log4j2.xml delete mode 100644 flink/src/main/resources/profiles/.gitignore delete mode 100644 flink/src/main/resources/profiles/local/hbase.properties delete mode 100644 flink/src/main/resources/profiles/local/pinpoint-flink.properties delete mode 100644 flink/src/main/resources/profiles/release/hbase.properties delete mode 100644 flink/src/main/resources/profiles/release/pinpoint-flink.properties delete mode 100644 flink/src/main/resources/spring.properties delete mode 100644 flink/src/test/java/com/navercorp/pinpoint/flink/config/DataReceiverPropertiesTest.java delete mode 100644 flink/src/test/java/com/navercorp/pinpoint/flink/config/FlinkPropertiesTest.java delete mode 100644 flink/src/test/java/com/navercorp/pinpoint/flink/mapper/thrift/stat/JoinAgentStatBoMapperTest.java delete mode 100644 flink/src/test/java/com/navercorp/pinpoint/flink/mapper/thrift/stat/JoinDataSourceListBoMapperTest.java delete mode 100644 flink/src/test/java/com/navercorp/pinpoint/flink/mapper/thrift/stat/JoinDirectBufferBoMapperTest.java delete mode 100644 flink/src/test/java/com/navercorp/pinpoint/flink/mapper/thrift/stat/JoinFileDescriptorBoMapperTest.java delete mode 100644 flink/src/test/java/com/navercorp/pinpoint/flink/mapper/thrift/stat/JoinLoadedClassBoMapperTest.java delete mode 100644 flink/src/test/java/com/navercorp/pinpoint/flink/mapper/thrift/stat/JoinMemoryBoMapperTest.java delete mode 100644 flink/src/test/java/com/navercorp/pinpoint/flink/mapper/thrift/stat/JoinResponseTimeBoMapperTest.java delete mode 100644 flink/src/test/java/com/navercorp/pinpoint/flink/mapper/thrift/stat/JoinThriftActiveTraceBoMapperTest.java delete mode 100644 flink/src/test/java/com/navercorp/pinpoint/flink/mapper/thrift/stat/JoinThriftCpuLoadBoMapperTest.java delete mode 100644 flink/src/test/java/com/navercorp/pinpoint/flink/mapper/thrift/stat/JoinTotalThreadCountBoMapperTest.java delete mode 100644 flink/src/test/java/com/navercorp/pinpoint/flink/mapper/thrift/stat/JoinTransactionBoMapperTest.java delete mode 100644 flink/src/test/java/com/navercorp/pinpoint/flink/process/TBaseFlatMapperTest.java delete mode 100644 thrift/src/main/java/com/navercorp/pinpoint/io/request/FlinkRequest.java delete mode 100644 web/src/main/java/com/navercorp/pinpoint/web/authorization/controller/ApplicationDataSourceController.java delete mode 100644 web/src/main/java/com/navercorp/pinpoint/web/dao/hbase/appmetric/DefaultApplicationMetricDao.java delete mode 100644 web/src/main/java/com/navercorp/pinpoint/web/dao/hbase/appmetric/HbaseApplicationStatDaoOperations.java delete mode 100644 web/src/main/java/com/navercorp/pinpoint/web/dao/hbase/config/ApplicationMetricConfiguration.java delete mode 100644 web/src/main/java/com/navercorp/pinpoint/web/mapper/stat/ApplicationStatMapper.java delete mode 100644 web/src/main/java/com/navercorp/pinpoint/web/mapper/stat/sampling/sampler/JoinActiveTraceSampler.java delete mode 100644 web/src/main/java/com/navercorp/pinpoint/web/mapper/stat/sampling/sampler/JoinCpuLoadSampler.java delete mode 100644 web/src/main/java/com/navercorp/pinpoint/web/mapper/stat/sampling/sampler/JoinDataSourceSampler.java delete mode 100644 web/src/main/java/com/navercorp/pinpoint/web/mapper/stat/sampling/sampler/JoinDirectBufferSampler.java delete mode 100644 web/src/main/java/com/navercorp/pinpoint/web/mapper/stat/sampling/sampler/JoinFileDescriptorSampler.java delete mode 100644 web/src/main/java/com/navercorp/pinpoint/web/mapper/stat/sampling/sampler/JoinLoadedClassSampler.java delete mode 100644 web/src/main/java/com/navercorp/pinpoint/web/mapper/stat/sampling/sampler/JoinMemorySampler.java delete mode 100644 web/src/main/java/com/navercorp/pinpoint/web/mapper/stat/sampling/sampler/JoinResponseTimeSampler.java delete mode 100644 web/src/main/java/com/navercorp/pinpoint/web/mapper/stat/sampling/sampler/JoinTotalThreadCountSampler.java delete mode 100644 web/src/main/java/com/navercorp/pinpoint/web/mapper/stat/sampling/sampler/JoinTransactionSampler.java delete mode 100644 web/src/main/java/com/navercorp/pinpoint/web/service/appmetric/ApplicationDataSourceService.java delete mode 100644 web/src/main/java/com/navercorp/pinpoint/web/service/appmetric/ApplicationMetricServiceConfiguration.java delete mode 100644 web/src/main/java/com/navercorp/pinpoint/web/view/IntApplicationStatSerializer.java delete mode 100644 web/src/main/java/com/navercorp/pinpoint/web/view/LongApplicationStatSerializer.java delete mode 100644 web/src/main/java/com/navercorp/pinpoint/web/vo/stat/AggreJoinActiveTraceBo.java delete mode 100644 web/src/main/java/com/navercorp/pinpoint/web/vo/stat/AggreJoinCpuLoadBo.java delete mode 100644 web/src/main/java/com/navercorp/pinpoint/web/vo/stat/AggreJoinDataSourceBo.java delete mode 100644 web/src/main/java/com/navercorp/pinpoint/web/vo/stat/AggreJoinDataSourceListBo.java delete mode 100644 web/src/main/java/com/navercorp/pinpoint/web/vo/stat/AggreJoinDirectBufferBo.java delete mode 100644 web/src/main/java/com/navercorp/pinpoint/web/vo/stat/AggreJoinFileDescriptorBo.java delete mode 100644 web/src/main/java/com/navercorp/pinpoint/web/vo/stat/AggreJoinLoadedClassBo.java delete mode 100644 web/src/main/java/com/navercorp/pinpoint/web/vo/stat/AggreJoinMemoryBo.java delete mode 100644 web/src/main/java/com/navercorp/pinpoint/web/vo/stat/AggreJoinResponseTimeBo.java delete mode 100644 web/src/main/java/com/navercorp/pinpoint/web/vo/stat/AggreJoinTotalThreadCountBo.java delete mode 100644 web/src/main/java/com/navercorp/pinpoint/web/vo/stat/AggreJoinTransactionBo.java delete mode 100644 web/src/main/java/com/navercorp/pinpoint/web/vo/stat/chart/application/ApplicationActiveTraceChart.java delete mode 100644 web/src/main/java/com/navercorp/pinpoint/web/vo/stat/chart/application/ApplicationCpuLoadChart.java delete mode 100644 web/src/main/java/com/navercorp/pinpoint/web/vo/stat/chart/application/ApplicationDataSourceChart.java delete mode 100644 web/src/main/java/com/navercorp/pinpoint/web/vo/stat/chart/application/ApplicationDirectBufferChart.java delete mode 100644 web/src/main/java/com/navercorp/pinpoint/web/vo/stat/chart/application/ApplicationFileDescriptorChart.java delete mode 100644 web/src/main/java/com/navercorp/pinpoint/web/vo/stat/chart/application/ApplicationLoadedClassChart.java delete mode 100644 web/src/main/java/com/navercorp/pinpoint/web/vo/stat/chart/application/ApplicationMemoryChart.java delete mode 100644 web/src/main/java/com/navercorp/pinpoint/web/vo/stat/chart/application/ApplicationResponseTimeChart.java delete mode 100644 web/src/main/java/com/navercorp/pinpoint/web/vo/stat/chart/application/ApplicationTotalThreadCountChart.java delete mode 100644 web/src/main/java/com/navercorp/pinpoint/web/vo/stat/chart/application/ApplicationTransactionChart.java delete mode 100644 web/src/main/java/com/navercorp/pinpoint/web/vo/stat/chart/application/IntApplicationStatPoint.java delete mode 100644 web/src/main/java/com/navercorp/pinpoint/web/vo/stat/chart/application/LongApplicationStatPoint.java delete mode 100644 web/src/main/java/com/navercorp/pinpoint/web/vo/stat/chart/application/StatPointUtils.java delete mode 100644 web/src/test/java/com/navercorp/pinpoint/web/mapper/stat/sampling/sampler/JoinActiveTraceSamplerTest.java delete mode 100644 web/src/test/java/com/navercorp/pinpoint/web/mapper/stat/sampling/sampler/JoinCpuLoadSamplerTest.java delete mode 100644 web/src/test/java/com/navercorp/pinpoint/web/mapper/stat/sampling/sampler/JoinDataSourceSamplerTest.java delete mode 100644 web/src/test/java/com/navercorp/pinpoint/web/mapper/stat/sampling/sampler/JoinDirectBufferSamplerTest.java delete mode 100644 web/src/test/java/com/navercorp/pinpoint/web/mapper/stat/sampling/sampler/JoinFileDescriptorSamplerTest.java delete mode 100644 web/src/test/java/com/navercorp/pinpoint/web/mapper/stat/sampling/sampler/JoinLoadedClassSamplerTest.java delete mode 100644 web/src/test/java/com/navercorp/pinpoint/web/mapper/stat/sampling/sampler/JoinMemorySamplerTest.java delete mode 100644 web/src/test/java/com/navercorp/pinpoint/web/mapper/stat/sampling/sampler/JoinResponseTimeSamplerTest.java delete mode 100644 web/src/test/java/com/navercorp/pinpoint/web/mapper/stat/sampling/sampler/JoinTotalThreadSamplerTest.java delete mode 100644 web/src/test/java/com/navercorp/pinpoint/web/mapper/stat/sampling/sampler/JoinTransactionSamplerTest.java delete mode 100644 web/src/test/java/com/navercorp/pinpoint/web/service/appmetric/ApplicationDataSourceServiceTest.java delete mode 100644 web/src/test/java/com/navercorp/pinpoint/web/vo/stat/chart/application/ApplicationActiveTraceChartGroupTest.java delete mode 100644 web/src/test/java/com/navercorp/pinpoint/web/vo/stat/chart/application/ApplicationCpuLoadChartGroupTest.java delete mode 100644 web/src/test/java/com/navercorp/pinpoint/web/vo/stat/chart/application/ApplicationDataSourceChartGroupTest.java delete mode 100644 web/src/test/java/com/navercorp/pinpoint/web/vo/stat/chart/application/ApplicationDirectBufferChartGroupTest.java delete mode 100644 web/src/test/java/com/navercorp/pinpoint/web/vo/stat/chart/application/ApplicationFileDescriptorChartGroupTest.java delete mode 100644 web/src/test/java/com/navercorp/pinpoint/web/vo/stat/chart/application/ApplicationLoadedClassChartGroupTest.java delete mode 100644 web/src/test/java/com/navercorp/pinpoint/web/vo/stat/chart/application/ApplicationMemoryChartGroupTest.java delete mode 100644 web/src/test/java/com/navercorp/pinpoint/web/vo/stat/chart/application/ApplicationResponseTimeChartGroupTest.java delete mode 100644 web/src/test/java/com/navercorp/pinpoint/web/vo/stat/chart/application/ApplicationTotalThreadCountChartGroupTest.java delete mode 100644 web/src/test/java/com/navercorp/pinpoint/web/vo/stat/chart/application/ApplicationTransactionChartGroupTest.java diff --git a/batch/src/main/java/com/navercorp/pinpoint/batch/BatchModule.java b/batch/src/main/java/com/navercorp/pinpoint/batch/BatchModule.java index c5b1c9e3096f..634055be69a2 100644 --- a/batch/src/main/java/com/navercorp/pinpoint/batch/BatchModule.java +++ b/batch/src/main/java/com/navercorp/pinpoint/batch/BatchModule.java @@ -50,7 +50,6 @@ "classpath:applicationContext-batch-web-component.xml", "classpath:job/applicationContext-agentCountJob.xml", - "classpath:job/applicationContext-flinkCheckJob.xml", "classpath:job/applicationContext-cleanupInactiveAgentsJob.xml" }) @Import({ diff --git a/batch/src/main/java/com/navercorp/pinpoint/batch/common/BatchJobLauncher.java b/batch/src/main/java/com/navercorp/pinpoint/batch/common/BatchJobLauncher.java index bac41c462885..4437570ad95c 100644 --- a/batch/src/main/java/com/navercorp/pinpoint/batch/common/BatchJobLauncher.java +++ b/batch/src/main/java/com/navercorp/pinpoint/batch/common/BatchJobLauncher.java @@ -77,14 +77,6 @@ public void agentCountJob() { } } - public void flinkCheckJob() { - if (batchProperties.isFlinkCheckJobEnable()) { - run("flinkCheckJob", createTimeParameter()); - } else { - logger.debug("Skip flinkCheckJob, because 'enableFlinkCheckJob' is disabled."); - } - } - public void cleanupInactiveAgentsJob() { if (batchProperties.isCleanupInactiveAgentsJobEnable()) { run("cleanupInactiveAgentsJob", createTimeParameter()); diff --git a/batch/src/main/java/com/navercorp/pinpoint/batch/common/BatchProperties.java b/batch/src/main/java/com/navercorp/pinpoint/batch/common/BatchProperties.java index e99b15c365bf..f167288964e0 100644 --- a/batch/src/main/java/com/navercorp/pinpoint/batch/common/BatchProperties.java +++ b/batch/src/main/java/com/navercorp/pinpoint/batch/common/BatchProperties.java @@ -37,12 +37,6 @@ public class BatchProperties { @Value("${batch.server.env}") private String batchEnv; - @Value("${batch.flink.server}") - private String[] flinkServerList = new String[0]; - - @Value("${batch.flink.rest.port:8081}") - private int flinkRestPort; - @Value("${job.alarm.enable:true}") private boolean alarmJobEnable; @@ -64,12 +58,6 @@ public class BatchProperties { @Value("${job.agent.count.cron}") private String agentCountJobCron; - @Value("${job.flink.check.enable:true}") - private boolean flinkCheckJobEnable; - - @Value("${job.flink.check.cron}") - private String flinkCheckJobCron; - @Value("${job.cleanup.inactive.agents.enable:true}") private boolean cleanupInactiveAgentsJobEnable; @@ -119,14 +107,6 @@ private void afterLog() { annotationVisitor.visit(this, new LoggingEvent(this.logger)); } - public List getFlinkServerList() { - return Arrays.asList(flinkServerList); - } - - public int getFlinkRestPort() { - return flinkRestPort; - } - public String getBatchEnv() { return batchEnv; } @@ -159,17 +139,10 @@ public String getAgentCountJobCron() { return agentCountJobCron; } - public boolean isFlinkCheckJobEnable() { - return flinkCheckJobEnable; - } - - public String getFlinkCheckJobCron() { - return flinkCheckJobCron; - } - public String getUriStatAlarmJobCron() { return uriStatAlarmJobCron; } + public int getCleanupInactiveAgentsDurationDays() { return cleanupInactiveAgentsDurationDays; } @@ -202,8 +175,6 @@ public int getAgentInspectorStatTablePaddingLength() { public String toString() { return "BatchProperties{" + "batchEnv='" + batchEnv + '\'' + - ", flinkServerList=" + Arrays.toString(flinkServerList) + - ", flinkRestPort=" + flinkRestPort + ", alarmJobEnable=" + alarmJobEnable + ", alarmJobCron='" + alarmJobCron + '\'' + ", alarmAgentInspectorStatTableCount=" + alarmAgentInspectorStatTableCount + @@ -211,8 +182,6 @@ public String toString() { ", agentInspectorStatTablePaddingLength=" + agentInspectorStatTablePaddingLength + ", agentCountJobEnable=" + agentCountJobEnable + ", agentCountJobCron='" + agentCountJobCron + '\'' + - ", flinkCheckJobEnable=" + flinkCheckJobEnable + - ", flinkCheckJobCron='" + flinkCheckJobCron + '\'' + ", cleanupInactiveAgentsJobEnable=" + cleanupInactiveAgentsJobEnable + ", cleanupInactiveAgentsJobCron='" + cleanupInactiveAgentsJobCron + '\'' + ", uriStatAlarmJobEnable=" + uriStatAlarmJobEnable + diff --git a/batch/src/main/java/com/navercorp/pinpoint/batch/flink/HealthCheckTaskletV2.java b/batch/src/main/java/com/navercorp/pinpoint/batch/flink/HealthCheckTaskletV2.java deleted file mode 100644 index d495f8e7d12a..000000000000 --- a/batch/src/main/java/com/navercorp/pinpoint/batch/flink/HealthCheckTaskletV2.java +++ /dev/null @@ -1,145 +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.batch.flink; - -import com.navercorp.pinpoint.batch.common.BatchProperties; -import com.navercorp.pinpoint.common.util.CollectionUtils; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; -import org.springframework.batch.core.StepContribution; -import org.springframework.batch.core.scope.context.ChunkContext; -import org.springframework.batch.core.step.tasklet.Tasklet; -import org.springframework.batch.repeat.RepeatStatus; -import org.springframework.core.ParameterizedTypeReference; -import org.springframework.http.HttpMethod; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.web.client.RestTemplate; - -import jakarta.annotation.Nonnull; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -/** - * @author minwoo.jung - */ -public class HealthCheckTaskletV2 implements Tasklet { - - private final Logger logger = LogManager.getLogger(this.getClass()); - private final static String URL_FORMAT = "http://%s:%d/jobs/overview"; - private final static String NAME = "name"; - private final static String STATE = "state"; - private final static String RUNNING = "RUNNING"; - private final List jobNameList; - - private final RestTemplate restTemplate; - - private final BatchProperties batchProperties; - - public HealthCheckTaskletV2(BatchProperties batchProperties, RestTemplate restTemplate) { - this.jobNameList = new ArrayList<>(1); - jobNameList.add("Aggregation Stat Data"); - - this.batchProperties = Objects.requireNonNull(batchProperties, "batchProperties"); - this.restTemplate = Objects.requireNonNull(restTemplate, "restTemplate"); - } - - @Override - public RepeatStatus execute(@Nonnull StepContribution contribution, @Nonnull ChunkContext chunkContext) throws Exception { - List urlList = generatedFlinkManagerServerApi(); - - if (urlList.isEmpty()) { - return RepeatStatus.FINISHED; - } - - Map jobExecuteStatus = createjobExecuteStatus(); - - for (String url : urlList) { - try { - ParameterizedTypeReference> type = new ParameterizedTypeReference<>() {}; - ResponseEntity> responseEntity = this.restTemplate.exchange(url, HttpMethod.GET, null, type); - - if (responseEntity.getStatusCode() != HttpStatus.OK) { - continue; - } - - checkJobExecuteStatus(responseEntity, jobExecuteStatus); - } catch (Exception e) { - logger.error("fail call api to flink server.", e); - } - } - - List notExecuteJobList = new ArrayList<>(3); - for (Map.Entry entry : jobExecuteStatus.entrySet()) { - if (entry.getValue().equals(Boolean.FALSE)) { - notExecuteJobList.add(entry.getKey()); - } - } - - if (CollectionUtils.hasLength(notExecuteJobList)) { - String exceptionMessage = String.format("job fail : %s", notExecuteJobList); - throw new Exception(exceptionMessage); - } - - return RepeatStatus.FINISHED; - } - - private void checkJobExecuteStatus(ResponseEntity> responseEntity, Map jobExecuteStatus) { - Map responseData = responseEntity.getBody(); - if(responseData != null) { - List jobs = (List)responseData.get("jobs"); - - if (jobs != null) { - for (Object job : jobs) { - Map jobInfo = (Map)job; - final String jobName = (String) jobInfo.get(NAME); - if (jobExecuteStatus.containsKey(jobName)) { - if (RUNNING.equals(jobInfo.get(STATE))) { - jobExecuteStatus.put(jobName, true); - } - } - } - } - } - } - - // @VisibleForTesting - List generatedFlinkManagerServerApi() { - List flinkServerList = batchProperties.getFlinkServerList(); - int flinkRestPort = batchProperties.getFlinkRestPort(); - List urlList = new ArrayList<>(flinkServerList.size()); - - for (String flinkServerIp : flinkServerList) { - urlList.add(String.format(URL_FORMAT, flinkServerIp, flinkRestPort)); - } - - return urlList; - } - - public Map createjobExecuteStatus() { - Map jobExecuteStatus = new HashMap<>(); - - for (String jobName : jobNameList) { - jobExecuteStatus.put(jobName, false); - } - - return jobExecuteStatus; - } - -} diff --git a/batch/src/main/resources/batch-root.properties b/batch/src/main/resources/batch-root.properties index 4ee689e138bd..43f3a61bb4ac 100644 --- a/batch/src/main/resources/batch-root.properties +++ b/batch/src/main/resources/batch-root.properties @@ -20,10 +20,6 @@ spring.mail.properties.mail.smtp.ssl.enable=false # webhook config webhook.enable=false -#flink server list -batch.flink.server= -batch.flink.rest.port=8081 - ########################################################### # batch job config # ########################################################### @@ -35,8 +31,6 @@ job.alarm.agent.inspector.stat.table.padding.length=2 job.agent.count.cron=0 0 2 * * * -job.flink.check.cron=0 0/10 * * * * - job.alarm.uristat.enable=false job.alarm.uristat.cron=0 2/3 * * * * @@ -67,7 +61,6 @@ pinpoint.banner.configs=batch.server.env,\ spring.datasource.hikari.jdbc-url,\ spring.meta-datasource.hikari.jdbc-url,\ spring.pinot-datasource.pinot.jdbc-url,\ - batch.flink.server,\ job.cleanup.inactive.agents,\ job.cleanup.inactive.agents.cron,\ pinpoint.zookeeper.address,\ diff --git a/batch/src/main/resources/job/applicationContext-flinkCheckJob.xml b/batch/src/main/resources/job/applicationContext-flinkCheckJob.xml deleted file mode 100644 index 0459dbeb894c..000000000000 --- a/batch/src/main/resources/job/applicationContext-flinkCheckJob.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - - \ No newline at end of file diff --git a/batch/src/test/java/com/navercorp/pinpoint/batch/BatchPropertiesTest.java b/batch/src/test/java/com/navercorp/pinpoint/batch/BatchPropertiesTest.java index 99f6c02449e6..21fc7d645fb1 100644 --- a/batch/src/test/java/com/navercorp/pinpoint/batch/BatchPropertiesTest.java +++ b/batch/src/test/java/com/navercorp/pinpoint/batch/BatchPropertiesTest.java @@ -31,8 +31,7 @@ /** * @author Woonduk Kang(emeroad) */ -@TestPropertySource(locations = "classpath:batch-root.properties", - properties = {"batch.flink.server=1,2"}) +@TestPropertySource(locations = "classpath:batch-root.properties") @ContextConfiguration(classes = BatchProperties.class) @ExtendWith(SpringExtension.class) public class BatchPropertiesTest { @@ -40,13 +39,6 @@ public class BatchPropertiesTest { @Autowired BatchProperties properties; - @Test - public void test() { - assertThat(properties) - .extracting(BatchProperties::getBatchEnv, BatchProperties::getFlinkServerList) - .containsExactly("release", List.of("1", "2")); - } - @Test public void cleanupInactiveAgentsConfigurationTest() { properties.setup(); diff --git a/batch/src/test/java/com/navercorp/pinpoint/batch/flink/HealthCheckTaskletV2Test.java b/batch/src/test/java/com/navercorp/pinpoint/batch/flink/HealthCheckTaskletV2Test.java deleted file mode 100644 index 012002e252ff..000000000000 --- a/batch/src/test/java/com/navercorp/pinpoint/batch/flink/HealthCheckTaskletV2Test.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2022 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.batch.flink; - -import com.navercorp.pinpoint.batch.common.BatchProperties; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.mockito.Mock; -import org.mockito.junit.jupiter.MockitoExtension; -import org.springframework.web.client.RestTemplate; - -import java.util.List; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Mockito.when; - -/** - * @author youngjin.kim2 - */ -@ExtendWith(MockitoExtension.class) -public class HealthCheckTaskletV2Test { - - @Mock - private BatchProperties batchProperties; - - @Mock - RestTemplate restTemplate; - - @Test - public void testGeneratedFlinkManagerServerApi() { - when(batchProperties.getFlinkServerList()).thenReturn(List.of("123.234.123.234")); - when(batchProperties.getFlinkRestPort()).thenReturn(1919); - - final HealthCheckTaskletV2 tasklet = new HealthCheckTaskletV2(batchProperties, restTemplate); - final List results = tasklet.generatedFlinkManagerServerApi(); - assertThat(results).hasSize(1); - final String result = results.get(0); - assertThat(result.indexOf("123.234.123.234:1919")).isGreaterThanOrEqualTo(0); - assertThat(result.indexOf("DEAD-BEEF")).isLessThan(0); - } - -} diff --git a/collector/src/main/java/com/navercorp/pinpoint/collector/PinpointCollectorModule.java b/collector/src/main/java/com/navercorp/pinpoint/collector/PinpointCollectorModule.java index a82aa642b363..7410ee2878d7 100644 --- a/collector/src/main/java/com/navercorp/pinpoint/collector/PinpointCollectorModule.java +++ b/collector/src/main/java/com/navercorp/pinpoint/collector/PinpointCollectorModule.java @@ -4,7 +4,6 @@ import com.navercorp.pinpoint.collector.config.ClusterModule; import com.navercorp.pinpoint.collector.config.CollectorCommonConfiguration; import com.navercorp.pinpoint.collector.config.CollectorConfiguration; -import com.navercorp.pinpoint.collector.config.FlinkContextModule; import com.navercorp.pinpoint.collector.grpc.CollectorGrpcConfiguration; import com.navercorp.pinpoint.collector.grpc.ssl.GrpcSslModule; import com.navercorp.pinpoint.collector.manage.CollectorAdminConfiguration; @@ -26,7 +25,6 @@ TypeLoaderConfiguration.class, - FlinkContextModule.class, CollectorConfiguration.class, CollectorHbaseModule.class, diff --git a/collector/src/main/java/com/navercorp/pinpoint/collector/config/FlinkContextModule.java b/collector/src/main/java/com/navercorp/pinpoint/collector/config/FlinkContextModule.java deleted file mode 100644 index 7560f1c0ae8b..000000000000 --- a/collector/src/main/java/com/navercorp/pinpoint/collector/config/FlinkContextModule.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2019 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.config; - -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.ImportResource; - -/** - * @author minwoo.jung - */ -@Configuration -@ImportResource(locations = {"classpath:applicationContext-collector-flink.xml"}) -public class FlinkContextModule { - private final Logger logger = LogManager.getLogger(FlinkContextModule.class); - - public FlinkContextModule() { - logger.info("Install {}", FlinkContextModule.class.getSimpleName()); - } -} diff --git a/collector/src/main/java/com/navercorp/pinpoint/collector/config/FlinkProperties.java b/collector/src/main/java/com/navercorp/pinpoint/collector/config/FlinkProperties.java deleted file mode 100644 index 64d59c3451a8..000000000000 --- a/collector/src/main/java/com/navercorp/pinpoint/collector/config/FlinkProperties.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright 2019 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.config; - -import com.navercorp.pinpoint.common.server.cluster.zookeeper.ZookeeperClusterProperties; -import jakarta.annotation.PostConstruct; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; -import org.springframework.beans.factory.BeanNameAware; - -import java.util.Objects; - -/** - * @author minwoo.jung - */ -public class FlinkProperties implements BeanNameAware { - - private final Logger logger = LogManager.getLogger(getClass()); - - private String name; - private final ZookeeperClusterProperties clusterProperties; - - public FlinkProperties(ZookeeperClusterProperties clusterProperties) { - this.clusterProperties = Objects.requireNonNull(clusterProperties, "clusterProperties"); - } - - public boolean isFlinkClusterEnable() { - return clusterProperties.isEnable(); - } - - public String getFlinkClusterZookeeperAddress() { - return clusterProperties.getAddress(); - } - - public String getFlinkZNodePath() { - return clusterProperties.getFlinkZNodePath(); - } - - public int getFlinkClusterSessionTimeout() { - return clusterProperties.getSessionTimeout(); - } - - @Override - public void setBeanName(String name) { - this.name = name; - } - - @PostConstruct - public void log() { - logger.info("{}", this); - } - - @Override - public String toString() { - return "FlinkConfiguration{" + - "name=" + name + - ", flinkClusterEnable=" + isFlinkClusterEnable() + - ", flinkClusterZookeeperAddress='" + getFlinkClusterZookeeperAddress() + '\'' + - ", flinkZNodePath='" + getFlinkZNodePath() + '\'' + - ", flinkClusterSessionTimeout=" + getFlinkClusterSessionTimeout() + - '}'; - } - -} diff --git a/collector/src/main/java/com/navercorp/pinpoint/collector/flink/ClusterConnectionManager.java b/collector/src/main/java/com/navercorp/pinpoint/collector/flink/ClusterConnectionManager.java deleted file mode 100644 index f9770a1170ee..000000000000 --- a/collector/src/main/java/com/navercorp/pinpoint/collector/flink/ClusterConnectionManager.java +++ /dev/null @@ -1,34 +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.flink; - -import com.navercorp.pinpoint.collector.util.Address; - -import java.util.List; - -/** - * @author minwoo.jung - */ -public interface ClusterConnectionManager { - - void stop(); - - void connectPointIfAbsent(Address address); - - void disconnectPoint(Address address); - - List
getConnectedAddressList(); -} diff --git a/collector/src/main/java/com/navercorp/pinpoint/collector/flink/FlinkClusterConnectionManager.java b/collector/src/main/java/com/navercorp/pinpoint/collector/flink/FlinkClusterConnectionManager.java deleted file mode 100644 index 68d7fddcbe15..000000000000 --- a/collector/src/main/java/com/navercorp/pinpoint/collector/flink/FlinkClusterConnectionManager.java +++ /dev/null @@ -1,121 +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.flink; - -import com.navercorp.pinpoint.collector.sender.FlinkRequestFactory; -import com.navercorp.pinpoint.collector.sender.FlinkTcpDataSender; -import com.navercorp.pinpoint.collector.util.Address; -import com.navercorp.pinpoint.rpc.client.DefaultPinpointClientFactory; -import com.navercorp.pinpoint.rpc.client.PinpointClientFactory; -import com.navercorp.pinpoint.thrift.io.HeaderTBaseSerializer; -import com.navercorp.pinpoint.thrift.io.SerializerFactory; -import com.navercorp.pinpoint.thrift.sender.TcpDataSender; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; -import org.apache.thrift.TBase; - -import java.util.List; -import java.util.Objects; - -/** - * @author minwoo.jung - */ -public class FlinkClusterConnectionManager implements ClusterConnectionManager { - private final Logger logger = LogManager.getLogger(this.getClass()); - private final PinpointClientFactory pinpointClientFactory; - private final TcpDataSenderRepository tcpDataSenderRepository; - private final SerializerFactory flinkHeaderTBaseSerializerFactory; - private final FlinkRequestFactory flinkRequestFactory; - - public FlinkClusterConnectionManager(TcpDataSenderRepository tcpDataSenderRepository, - SerializerFactory flinkHeaderTBaseSerializerFactory, - FlinkRequestFactory flinkRequestFactory) { - this.tcpDataSenderRepository = Objects.requireNonNull(tcpDataSenderRepository, "tcpDataSenderRepository"); - this.flinkHeaderTBaseSerializerFactory = Objects.requireNonNull(flinkHeaderTBaseSerializerFactory, "flinkHeaderTBaseSerializerFactory"); - this.flinkRequestFactory = Objects.requireNonNull(flinkRequestFactory, "flinkRequestFactory"); - this.pinpointClientFactory = newPointClientFactory(); - } - - private PinpointClientFactory newPointClientFactory() { - PinpointClientFactory pinpointClientFactory = new DefaultPinpointClientFactory(); - pinpointClientFactory.setWriteTimeoutMillis(1000 * 3); - pinpointClientFactory.setRequestTimeoutMillis(1000 * 5); - return pinpointClientFactory; - } - - @Override - public void stop() { - for (SenderContext senderContext : tcpDataSenderRepository.getClusterSocketList()) { - senderContext.close(); - } - logger.info("{} stop completed.", this.getClass().getSimpleName()); - } - - @Override - public void connectPointIfAbsent(Address address) { - logger.info("localhost -> {} connect started.", address); - - if (tcpDataSenderRepository.containsKey(address)) { - logger.info("localhost -> {} already connected.", address); - return; - } - - final SenderContext senderContext = createTcpDataSender(address); - if (senderContext == null) { - return; - } - - final SenderContext context = tcpDataSenderRepository.putIfAbsent(address, senderContext); - if (context != null) { - logger.info("FlinkTcpDataSender have already been for {}.", address); - senderContext.close(); - } - - logger.info("localhost -> {} connect completed.", address); - } - - @Override - public void disconnectPoint(Address address) { - logger.info("localhost -> {} disconnect started.", address); - - final SenderContext context = tcpDataSenderRepository.remove(address); - if (context != null) { - context.close(); - logger.info("localhost -> {} disconnect completed.", address); - } else { - logger.info("localhost -> {} already disconnected.", address); - } - } - - @Override - public List
getConnectedAddressList() { - return tcpDataSenderRepository.getAddressList(); - } - - private SenderContext createTcpDataSender(Address address) { - try { - final String host = address.getHost(); - final int port = address.getPort(); - HeaderTBaseSerializer serializer = flinkHeaderTBaseSerializerFactory.createSerializer(); - TcpDataSender> tcpDataSender = new FlinkTcpDataSender("flink", host, port, pinpointClientFactory, serializer, flinkRequestFactory); - return new SenderContext(tcpDataSender); - } catch (Exception e) { - logger.error("not create tcpDataSender for {}.", address, e); - } - - return null; - } -} diff --git a/collector/src/main/java/com/navercorp/pinpoint/collector/flink/FlinkClusterService.java b/collector/src/main/java/com/navercorp/pinpoint/collector/flink/FlinkClusterService.java deleted file mode 100644 index 448eddc978bb..000000000000 --- a/collector/src/main/java/com/navercorp/pinpoint/collector/flink/FlinkClusterService.java +++ /dev/null @@ -1,165 +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.flink; - -import com.navercorp.pinpoint.collector.config.FlinkProperties; -import com.navercorp.pinpoint.common.server.cluster.zookeeper.CuratorZookeeperClient; -import com.navercorp.pinpoint.common.server.cluster.zookeeper.ZookeeperClient; -import com.navercorp.pinpoint.common.server.cluster.zookeeper.ZookeeperEventWatcher; -import com.navercorp.pinpoint.common.server.cluster.zookeeper.exception.PinpointZookeeperException; -import com.navercorp.pinpoint.common.server.cluster.zookeeper.util.CommonState; -import com.navercorp.pinpoint.common.server.cluster.zookeeper.util.CommonStateContext; -import jakarta.annotation.PostConstruct; -import jakarta.annotation.PreDestroy; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; -import org.apache.zookeeper.WatchedEvent; -import org.apache.zookeeper.Watcher.Event.EventType; - -import java.util.Objects; - -/** - * @author minwoo.jung - */ -public class FlinkClusterService { - - private final Logger logger = LogManager.getLogger(this.getClass()); - - private final CommonStateContext serviceState; - private final FlinkProperties properties; - private final FlinkClusterConnectionManager clusterConnectionManager; - private final String pinpointFlinkClusterPath; - - private ZookeeperClient client; - private ZookeeperClusterManager zookeeperClusterManager; - - public FlinkClusterService(FlinkProperties properties, FlinkClusterConnectionManager clusterConnectionManager) { - this.properties = Objects.requireNonNull(properties, "properties"); - this.serviceState = new CommonStateContext(); - this.clusterConnectionManager = Objects.requireNonNull(clusterConnectionManager, "clusterConnectionManager"); - this.pinpointFlinkClusterPath = properties.getFlinkZNodePath(); - } - - @PostConstruct - public void setup() { - if (!properties.isFlinkClusterEnable()) { - logger.info("flink cluster disable."); - return; - } - - switch (this.serviceState.getCurrentState()) { - case NEW -> { - if (this.serviceState.changeStateInitializing()) { - logger.info("{} initialization started.", this.getClass().getSimpleName()); - - ClusterManagerWatcher watcher = new ClusterManagerWatcher(pinpointFlinkClusterPath); - this.client = new CuratorZookeeperClient(properties.getFlinkClusterZookeeperAddress(), properties.getFlinkClusterSessionTimeout(), watcher); - try { - this.client.connect(); - } catch (PinpointZookeeperException e) { - throw new RuntimeException("ZookeeperClient connect failed", e); - } - - this.zookeeperClusterManager = new ZookeeperClusterManager(client, pinpointFlinkClusterPath, clusterConnectionManager); - this.zookeeperClusterManager.start(); - - this.serviceState.changeStateStarted(); - logger.info("{} initialization completed.", this.getClass().getSimpleName()); - - if (client.isConnected()) { - watcher.handleConnected(); - } - } - } - case INITIALIZING -> logger.info("{} already initializing.", this.getClass().getSimpleName()); - case STARTED -> logger.info("{} already started.", this.getClass().getSimpleName()); - case DESTROYING -> throw new IllegalStateException("Already destroying."); - case STOPPED -> throw new IllegalStateException("Already stopped."); - case ILLEGAL_STATE -> throw new IllegalStateException("Invalid State."); - } - } - - @PreDestroy - public void tearDown() { - if (!properties.isFlinkClusterEnable()) { - logger.info("flink cluster disable."); - return; - } - if (!(this.serviceState.changeStateDestroying())) { - CommonState state = this.serviceState.getCurrentState(); - logger.info("{} already {}.", this.getClass().getSimpleName(), state.toString()); - return; - } - - logger.info("{} destroying started.", this.getClass().getSimpleName()); - - if (this.zookeeperClusterManager != null) { - zookeeperClusterManager.stop(); - } - if (client != null) { - client.close(); - } - - this.serviceState.changeStateStopped(); - logger.info("{} destroying completed.", this.getClass().getSimpleName()); - } - - private class ClusterManagerWatcher implements ZookeeperEventWatcher { - - private final String pinpointFlinkClusterPath; - - public ClusterManagerWatcher(String pinpointFlinkClusterPath) { - this.pinpointFlinkClusterPath = pinpointFlinkClusterPath; - } - - @Override - public void process(WatchedEvent event) { - logger.debug("Process Zookeeper Event({})", event); - - EventType eventType = event.getType(); - - if (serviceState.isStarted() && client.isConnected()) { - // duplicate event possible - but the logic does not change - if (eventType == EventType.NodeChildrenChanged) { - String eventPath = event.getPath(); - - if (pinpointFlinkClusterPath.equals(eventPath)) { - zookeeperClusterManager.handleAndRegisterWatcher(eventPath); - } else { - logger.warn("Unknown Path ChildrenChanged {}.", eventPath); - } - } - } - } - - @Override - public boolean handleConnected() { - if (serviceState.isStarted()) { - zookeeperClusterManager.handleAndRegisterWatcher(pinpointFlinkClusterPath); - return true; - } else { - return false; - } - } - - @Override - public boolean handleDisconnected() { - return true; - } - - } - -} diff --git a/collector/src/main/java/com/navercorp/pinpoint/collector/flink/SenderContext.java b/collector/src/main/java/com/navercorp/pinpoint/collector/flink/SenderContext.java deleted file mode 100644 index aa2b41a0d253..000000000000 --- a/collector/src/main/java/com/navercorp/pinpoint/collector/flink/SenderContext.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.flink; - -import com.navercorp.pinpoint.thrift.sender.TcpDataSender; -import org.apache.thrift.TBase; - -import java.util.Objects; - -/** - * @author minwoo.jung - */ -public class SenderContext { - private final TcpDataSender> flinkTcpDataSender; - - public SenderContext(TcpDataSender> tcpDataSender) { - this.flinkTcpDataSender = Objects.requireNonNull(tcpDataSender, "flinkTcpDataSender"); - } - - public TcpDataSender> getFlinkTcpDataSender() { - return flinkTcpDataSender; - } - - public void close() { - flinkTcpDataSender.stop(); - } - -} diff --git a/collector/src/main/java/com/navercorp/pinpoint/collector/flink/TcpDataSenderRepository.java b/collector/src/main/java/com/navercorp/pinpoint/collector/flink/TcpDataSenderRepository.java deleted file mode 100644 index 6778b94dda7d..000000000000 --- a/collector/src/main/java/com/navercorp/pinpoint/collector/flink/TcpDataSenderRepository.java +++ /dev/null @@ -1,77 +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.flink; - -import com.navercorp.pinpoint.collector.service.SendDataToFlinkService; -import com.navercorp.pinpoint.collector.util.Address; -import com.navercorp.pinpoint.thrift.sender.TcpDataSender; -import org.apache.thrift.TBase; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.Objects; -import java.util.Set; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentMap; - -/** - * @author minwoo.jung - */ -public class TcpDataSenderRepository { - private final ConcurrentMap clusterConnectionRepository = new ConcurrentHashMap<>(); - private final SendDataToFlinkService flinkService; - - public TcpDataSenderRepository(SendDataToFlinkService flinkService) { - this.flinkService = Objects.requireNonNull(flinkService, "flinkService"); - } - - public SenderContext putIfAbsent(Address address, SenderContext senderContext) { - SenderContext context = clusterConnectionRepository.putIfAbsent(address, senderContext); - replaceDataInSendDataToFlinkService(); - return context; - } - - public SenderContext remove(Address address) { - SenderContext senderContext = clusterConnectionRepository.remove(address); - replaceDataInSendDataToFlinkService(); - return senderContext; - } - - private void replaceDataInSendDataToFlinkService() { - Collection values = clusterConnectionRepository.values(); - - List>> tcpDataSenderList = new ArrayList<>(values.size()); - for (SenderContext senderContext : values) { - tcpDataSenderList.add(senderContext.getFlinkTcpDataSender()); - } - - flinkService.replaceFlinkTcpDataSenderList(tcpDataSenderList); - } - - public boolean containsKey(Address address) { - return clusterConnectionRepository.containsKey(address); - } - - public List
getAddressList() { - Set
socketAddresses = clusterConnectionRepository.keySet(); - return new ArrayList<>(socketAddresses); - } - - public List getClusterSocketList() { - return new ArrayList<>(clusterConnectionRepository.values()); - } -} diff --git a/collector/src/main/java/com/navercorp/pinpoint/collector/flink/ZookeeperClusterManager.java b/collector/src/main/java/com/navercorp/pinpoint/collector/flink/ZookeeperClusterManager.java deleted file mode 100644 index fbeb5ec80a07..000000000000 --- a/collector/src/main/java/com/navercorp/pinpoint/collector/flink/ZookeeperClusterManager.java +++ /dev/null @@ -1,291 +0,0 @@ -/* - * Copyright 2019 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.flink; - -import com.navercorp.pinpoint.collector.util.Address; -import com.navercorp.pinpoint.collector.util.AddressParser; -import com.navercorp.pinpoint.collector.util.MultipleAddress; -import com.navercorp.pinpoint.common.profiler.concurrent.PinpointThreadFactory; -import com.navercorp.pinpoint.common.server.cluster.zookeeper.ZookeeperClient; -import com.navercorp.pinpoint.common.server.cluster.zookeeper.ZookeeperConstants; -import com.navercorp.pinpoint.common.server.cluster.zookeeper.exception.ConnectionException; -import com.navercorp.pinpoint.common.server.cluster.zookeeper.exception.PinpointZookeeperException; -import com.navercorp.pinpoint.common.server.cluster.zookeeper.util.CommonState; -import com.navercorp.pinpoint.common.server.cluster.zookeeper.util.CommonStateContext; -import com.navercorp.pinpoint.common.util.BytesUtils; -import org.apache.curator.utils.ZKPaths; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; -import java.util.concurrent.BlockingQueue; -import java.util.concurrent.LinkedBlockingQueue; -import java.util.concurrent.ThreadFactory; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicBoolean; - -/** - * @author koo.taejin - * @author minwoo.jung - */ -public class ZookeeperClusterManager { - - // it is okay for the collector to retry indefinitely, as long as RETRY_INTERVAL is set reasonably - private static final int DEFAULT_RETRY_INTERVAL = 60000; - - private final Logger logger = LogManager.getLogger(this.getClass()); - - private final GetAndRegisterTask getAndRegisterTask = new GetAndRegisterTask(); - private final StopTask stopTask = new StopTask(); - - private final CommonStateContext workerState = new CommonStateContext(); - - private final ZookeeperClient client; - private final ClusterConnectionManager clusterConnectionManager; - private final String parentPath; - - private final AtomicBoolean retryMode = new AtomicBoolean(false); - - private final BlockingQueue queue = new LinkedBlockingQueue<>(1); - - private final Thread workerThread; - - // private final Timer timer; - - // Register Worker + Job - // synchronize current status with Zookeeper when an event(job) is triggered. - // (the number of events does not matter as long as a single event is triggered - subsequent events may be ignored) - public ZookeeperClusterManager(ZookeeperClient client, String zookeeperClusterPath, ClusterConnectionManager clusterConnectionManager) { - this.client = Objects.requireNonNull(client, "client"); - Objects.requireNonNull(zookeeperClusterPath, "zookeeperClusterPath"); - this.clusterConnectionManager = Objects.requireNonNull(clusterConnectionManager, "clusterConnectionManager"); - - if (!zookeeperClusterPath.endsWith("/")) { - this.parentPath = zookeeperClusterPath + ZookeeperConstants.PATH_SEPARATOR; - } else { - this.parentPath = zookeeperClusterPath; - } - - final ThreadFactory threadFactory = new PinpointThreadFactory(this.getClass().getSimpleName(), true); - this.workerThread = threadFactory.newThread(new Worker()); - } - - public void start() { - switch (this.workerState.getCurrentState()) { - case NEW -> { - if (this.workerState.changeStateInitializing()) { - logger.info("{} initialization started.", this.getClass().getSimpleName()); - this.workerThread.start(); - - workerState.changeStateStarted(); - logger.info("{} initialization completed.", this.getClass().getSimpleName()); - } - } - case INITIALIZING -> - logger.info("{} already initializing.", this.getClass().getSimpleName()); - case STARTED -> - logger.info("{} already started.", this.getClass().getSimpleName()); - case DESTROYING -> - throw new IllegalStateException("Already destroying."); - case STOPPED -> - throw new IllegalStateException("Already stopped."); - case ILLEGAL_STATE -> - throw new IllegalStateException("Invalid State."); - } - } - - public void stop() { - if (!(this.workerState.changeStateDestroying())) { - CommonState state = this.workerState.getCurrentState(); - - logger.info("{} already {}.", this.getClass().getSimpleName(), state); - return; - } - - logger.info("{} destroying started.", this.getClass().getSimpleName()); - - if (clusterConnectionManager != null) { - clusterConnectionManager.stop(); - } - - final boolean stopOffer = queue.offer(stopTask); - if (!stopOffer) { - logger.warn("Insert stopTask failed."); - } - - while (this.workerThread.isAlive()) { - this.workerThread.interrupt(); - try { - this.workerThread.join(3000L); - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); - } - } - - this.workerState.changeStateStopped(); - logger.info("{} destroying completed.", this.getClass().getSimpleName()); - } - - public void handleAndRegisterWatcher(String path) { - if (workerState.isStarted()) { - if (parentPath.equals(path) || parentPath.equals(path + ZookeeperConstants.PATH_SEPARATOR)) { - final boolean offerSuccess = queue.offer(getAndRegisterTask); - if (!offerSuccess) { - logger.info("Message Queue is Full."); - } - } else { - logger.info("Invalid Path {}.", path); - } - } else { - CommonState state = this.workerState.getCurrentState(); - logger.info("{} invalid state {}.", this.getClass().getSimpleName(), state); - } - } - - private class Worker implements Runnable { - - @Override - public void run() { - // if the node does not exist, create a node and retry. - // retry on timeout as well. - while (workerState.isStarted()) { - Task task = null; - - try { - task = queue.poll(DEFAULT_RETRY_INTERVAL, TimeUnit.MILLISECONDS); - } catch (InterruptedException e) { - logger.debug(e.getMessage(), e); - } - - if (!workerState.isStarted()) { - break; - } - - if (task == null) { - if (retryMode.get()) { - boolean success = getAndRegisterTask.handleAndRegisterWatcher0(); - if (success) { - retryMode.compareAndSet(true, false); - } - } - } else if (task instanceof GetAndRegisterTask registerTask) { - boolean success = registerTask.handleAndRegisterWatcher0(); - if (!success) { - retryMode.compareAndSet(false, true); - } - } else if (task instanceof StopTask) { - break; - } - } - - logger.info("{} stopped", this.getClass().getSimpleName()); - } - - } - - - interface Task { - - } - - class GetAndRegisterTask implements Task { - - private boolean handleAndRegisterWatcher0() { - boolean needNotRetry = false; - try { - client.createPath(parentPath); - - List
targetAddressList = getTargetAddressList(parentPath); - List
connectedAddressList = clusterConnectionManager.getConnectedAddressList(); - - logger.info("Handle register and remove Task. Current Address List = {}, Cluster Address List = {}", connectedAddressList, targetAddressList); - - for (Address targetAddress : targetAddressList) { - if (!connectedAddressList.contains(targetAddress)) { - clusterConnectionManager.connectPointIfAbsent(targetAddress); - } - } - - for (Address connectedAddress : connectedAddressList) { - if (!targetAddressList.contains(connectedAddress)) { - clusterConnectionManager.disconnectPoint(connectedAddress); - } - } - - needNotRetry = true; - return true; - } catch (Exception e) { - if (!(e instanceof ConnectionException)) { - needNotRetry = true; - } - } - - return needNotRetry; - } - - private List
getTargetAddressList(String parentPath) throws PinpointZookeeperException { - List
result = new ArrayList<>(); - - List childNodeList = client.getChildNodeList(parentPath, true); - - try { - for (String childNodeName : childNodeList) { - String fullPath = ZKPaths.makePath(parentPath, childNodeName); - byte[] data = client.getData(fullPath); - String nodeContents = BytesUtils.toString(data); - - String[] nodeAddresses = nodeContents.split("\r\n"); - - Address address = AddressParser.parseAddress(childNodeName); - if (nodeAddresses.length > 1) { - List hostList = createHostList(nodeAddresses, address.getHost()); - result.add(new MultipleAddress(hostList, address.getPort())); - } else { - result.add(address); - } - } - return result; - } catch (Exception e) { - logger.warn("Failed to process getting detail address. message:{}", e.getMessage(), e); - } - - return AddressParser.parseAddressList(childNodeList); - } - - private List createHostList(String[] hostAddresses, String representativeHostAddress) { - List hostAddressList = new ArrayList<>(hostAddresses.length); - - hostAddressList.add(representativeHostAddress); - for (String hostAddress : hostAddresses) { - if (hostAddressList.contains(hostAddress)) { - continue; - } - hostAddressList.add(hostAddress); - } - - return hostAddressList; - } - - } - - static class StopTask implements Task { - - } - -} diff --git a/collector/src/main/java/com/navercorp/pinpoint/collector/mapper/flink/FlinkStatMapper.java b/collector/src/main/java/com/navercorp/pinpoint/collector/mapper/flink/FlinkStatMapper.java deleted file mode 100644 index cac124fecfd1..000000000000 --- a/collector/src/main/java/com/navercorp/pinpoint/collector/mapper/flink/FlinkStatMapper.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.navercorp.pinpoint.collector.mapper.flink; - -import com.navercorp.pinpoint.common.server.bo.stat.AgentStatDataPoint; -import com.navercorp.pinpoint.thrift.dto.flink.TFAgentStat; - - -public interface FlinkStatMapper { - void map(T t, U u); - - void build(TFAgentStatMapper.TFAgentStatBuilder builder); -} diff --git a/collector/src/main/java/com/navercorp/pinpoint/collector/mapper/flink/TFActiveTraceMapper.java b/collector/src/main/java/com/navercorp/pinpoint/collector/mapper/flink/TFActiveTraceMapper.java deleted file mode 100644 index dca5f9cd1ace..000000000000 --- a/collector/src/main/java/com/navercorp/pinpoint/collector/mapper/flink/TFActiveTraceMapper.java +++ /dev/null @@ -1,68 +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.mapper.flink; - -import com.navercorp.pinpoint.common.server.bo.stat.ActiveTraceBo; -import com.navercorp.pinpoint.common.server.bo.stat.ActiveTraceHistogram; -import com.navercorp.pinpoint.common.server.bo.stat.AgentStatBo; -import com.navercorp.pinpoint.thrift.dto.flink.TFActiveTrace; -import com.navercorp.pinpoint.thrift.dto.flink.TFActiveTraceHistogram; -import com.navercorp.pinpoint.thrift.dto.flink.TFAgentStat; -import org.springframework.stereotype.Component; - -import java.util.Collections; -import java.util.List; - -/** - * @author minwoo.jung - */ -@Component -public class TFActiveTraceMapper implements FlinkStatMapper { - - public TFActiveTrace map(ActiveTraceBo activeTraceBo) { - TFActiveTraceHistogram tFActiveTraceHistogram = new TFActiveTraceHistogram(); - tFActiveTraceHistogram.setVersion(activeTraceBo.getVersion()); - tFActiveTraceHistogram.setHistogramSchemaType(activeTraceBo.getHistogramSchemaType()); - tFActiveTraceHistogram.setActiveTraceCount(createActiveTraceCount(activeTraceBo.getActiveTraceHistogram())); - - TFActiveTrace tFActiveTrace = new TFActiveTrace(); - tFActiveTrace.setHistogram(tFActiveTraceHistogram); - return tFActiveTrace; - } - - private List createActiveTraceCount(ActiveTraceHistogram activeTraceCountMap) { - if (activeTraceCountMap == null) { - return Collections.emptyList(); - } - - return List.of(activeTraceCountMap.getFastCount(), - activeTraceCountMap.getNormalCount(), - activeTraceCountMap.getSlowCount(), - activeTraceCountMap.getVerySlowCount()); - } - - @Override - public void map(ActiveTraceBo activeTraceBo, TFAgentStat tfAgentStat) { - tfAgentStat.setActiveTrace(map(activeTraceBo)); - } - - @Override - public void build(TFAgentStatMapper.TFAgentStatBuilder builder) { - AgentStatBo agentStat = builder.getAgentStat(); - List activeTraceBoList = agentStat.getActiveTraceBos(); - builder.build(activeTraceBoList, this); - } -} diff --git a/collector/src/main/java/com/navercorp/pinpoint/collector/mapper/flink/TFAgentStatBatchMapper.java b/collector/src/main/java/com/navercorp/pinpoint/collector/mapper/flink/TFAgentStatBatchMapper.java deleted file mode 100644 index 0ba6378df532..000000000000 --- a/collector/src/main/java/com/navercorp/pinpoint/collector/mapper/flink/TFAgentStatBatchMapper.java +++ /dev/null @@ -1,51 +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.mapper.flink; - -import com.navercorp.pinpoint.common.server.bo.stat.AgentStatBo; -import com.navercorp.pinpoint.thrift.dto.flink.TFAgentStat; -import com.navercorp.pinpoint.thrift.dto.flink.TFAgentStatBatch; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; -import org.springframework.stereotype.Component; - -import java.util.List; -import java.util.Objects; - -/** - * @author minwoo.jung - */ -@Component -public class TFAgentStatBatchMapper { - private final Logger logger = LogManager.getLogger(this.getClass()); - public final TFAgentStatMapper tFAgentStatMapper; - - public TFAgentStatBatchMapper(TFAgentStatMapper tFAgentStatMapper) { - this.tFAgentStatMapper = Objects.requireNonNull(tFAgentStatMapper, "tFAgentStatMapper"); - } - - public TFAgentStatBatch map(AgentStatBo agentStatBo) { - try { - List tFAgentStatList = tFAgentStatMapper.map(agentStatBo); - long startTimestamp = agentStatBo.getStartTimestamp(); - return new TFAgentStatBatch(agentStatBo.getAgentId(), startTimestamp, tFAgentStatList); - } catch (Exception e) { - logger.error("not create thrift object to send flink server. : " + agentStatBo, e); - } - - return null; - } -} diff --git a/collector/src/main/java/com/navercorp/pinpoint/collector/mapper/flink/TFAgentStatMapper.java b/collector/src/main/java/com/navercorp/pinpoint/collector/mapper/flink/TFAgentStatMapper.java deleted file mode 100644 index 9f361019a384..000000000000 --- a/collector/src/main/java/com/navercorp/pinpoint/collector/mapper/flink/TFAgentStatMapper.java +++ /dev/null @@ -1,89 +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.mapper.flink; - -import com.navercorp.pinpoint.common.server.bo.stat.AgentStatBo; -import com.navercorp.pinpoint.common.server.bo.stat.AgentStatDataPoint; -import com.navercorp.pinpoint.thrift.dto.flink.TFAgentStat; -import org.springframework.stereotype.Component; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.TreeMap; - -/** - * @author minwoo.jung - */ -@Component -public class TFAgentStatMapper { - private final FlinkStatMapper[] mappers; - - public TFAgentStatMapper(FlinkStatMapper[] mappers) { - this.mappers = Objects.requireNonNull(mappers, "mappers"); - } - - public List map(AgentStatBo agentStatBo) { - - TFAgentStatBuilder agentStat = new TFAgentStatBuilder(agentStatBo); - return agentStat.build(); - } - - public class TFAgentStatBuilder { - - private final Map tFAgentStatMap = new TreeMap<>(); - private final AgentStatBo agentStat; - - public TFAgentStatBuilder(AgentStatBo agentStat) { - this.agentStat = Objects.requireNonNull(agentStat, "agentStat"); - } - - public AgentStatBo getAgentStat() { - return agentStat; - } - - public void build(List dataPointList, FlinkStatMapper mapper) { - if (dataPointList == null) { - return; - } - for (T point : dataPointList) { - TFAgentStat tFAgentStat = getOrCreateTFAgentStat(point.getTimestamp()); - mapper.map(point, tFAgentStat); - } - } - - private TFAgentStat getOrCreateTFAgentStat(long timestamp) { - TFAgentStat tFAgentStat = tFAgentStatMap.get(timestamp); - if (tFAgentStat == null) { - tFAgentStat = new TFAgentStat(); - tFAgentStat.setAgentId(this.agentStat.getAgentId()); - tFAgentStat.setStartTimestamp(this.agentStat.getStartTimestamp()); - tFAgentStat.setTimestamp(timestamp); - tFAgentStatMap.put(timestamp, tFAgentStat); - } - - return tFAgentStat; - } - - public List build() { - for (FlinkStatMapper mapper : mappers) { - mapper.build(this); - } - return new ArrayList<>(tFAgentStatMap.values()); - } - } -} diff --git a/collector/src/main/java/com/navercorp/pinpoint/collector/mapper/flink/TFCpuLoadMapper.java b/collector/src/main/java/com/navercorp/pinpoint/collector/mapper/flink/TFCpuLoadMapper.java deleted file mode 100644 index 8c869b9aeee0..000000000000 --- a/collector/src/main/java/com/navercorp/pinpoint/collector/mapper/flink/TFCpuLoadMapper.java +++ /dev/null @@ -1,50 +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.mapper.flink; - -import com.navercorp.pinpoint.common.server.bo.stat.AgentStatBo; -import com.navercorp.pinpoint.common.server.bo.stat.CpuLoadBo; -import com.navercorp.pinpoint.thrift.dto.flink.TFAgentStat; -import com.navercorp.pinpoint.thrift.dto.flink.TFCpuLoad; -import org.springframework.stereotype.Component; - -import java.util.List; - -/** - * @author minwoo.jung - */ -@Component -public class TFCpuLoadMapper implements FlinkStatMapper { - - public TFCpuLoad map(CpuLoadBo cpuLoadBo) { - TFCpuLoad tFCpuLoad = new TFCpuLoad(); - tFCpuLoad.setJvmCpuLoad(cpuLoadBo.getJvmCpuLoad()); - tFCpuLoad.setSystemCpuLoad(cpuLoadBo.getSystemCpuLoad()); - return tFCpuLoad; - } - - @Override - public void map(CpuLoadBo cpuLoadBo, TFAgentStat tfAgentStat) { - tfAgentStat.setCpuLoad(map(cpuLoadBo)); - } - - @Override - public void build(TFAgentStatMapper.TFAgentStatBuilder builder) { - AgentStatBo agentStat = builder.getAgentStat(); - List cpuLoadList = agentStat.getCpuLoadBos(); - builder.build(cpuLoadList, this); - } -} diff --git a/collector/src/main/java/com/navercorp/pinpoint/collector/mapper/flink/TFDataSourceBoMapper.java b/collector/src/main/java/com/navercorp/pinpoint/collector/mapper/flink/TFDataSourceBoMapper.java deleted file mode 100644 index 70a4d2b14a5a..000000000000 --- a/collector/src/main/java/com/navercorp/pinpoint/collector/mapper/flink/TFDataSourceBoMapper.java +++ /dev/null @@ -1,37 +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.mapper.flink; - -import com.navercorp.pinpoint.common.server.bo.stat.DataSourceBo; -import com.navercorp.pinpoint.thrift.dto.flink.TFDataSource; - - -/** - * @author minwoo.jung - */ -public class TFDataSourceBoMapper { - - public TFDataSource map(DataSourceBo dataSourceBo) { - TFDataSource tFDataSource = new TFDataSource(); - tFDataSource.setId(dataSourceBo.getId()); - tFDataSource.setServiceTypeCode(dataSourceBo.getServiceTypeCode()); - tFDataSource.setDatabaseName(dataSourceBo.getDatabaseName()); - tFDataSource.setUrl(dataSourceBo.getJdbcUrl()); - tFDataSource.setActiveConnectionSize(dataSourceBo.getActiveConnectionSize()); - tFDataSource.setMaxConnectionSize(dataSourceBo.getMaxConnectionSize()); - return tFDataSource; - } -} diff --git a/collector/src/main/java/com/navercorp/pinpoint/collector/mapper/flink/TFDataSourceListBoMapper.java b/collector/src/main/java/com/navercorp/pinpoint/collector/mapper/flink/TFDataSourceListBoMapper.java deleted file mode 100644 index 2aeb1838c342..000000000000 --- a/collector/src/main/java/com/navercorp/pinpoint/collector/mapper/flink/TFDataSourceListBoMapper.java +++ /dev/null @@ -1,62 +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.mapper.flink; - -import com.navercorp.pinpoint.common.server.bo.stat.AgentStatBo; -import com.navercorp.pinpoint.common.server.bo.stat.DataSourceBo; -import com.navercorp.pinpoint.common.server.bo.stat.DataSourceListBo; -import com.navercorp.pinpoint.thrift.dto.flink.TFAgentStat; -import com.navercorp.pinpoint.thrift.dto.flink.TFDataSource; -import com.navercorp.pinpoint.thrift.dto.flink.TFDataSourceList; -import org.springframework.stereotype.Component; - -import java.util.ArrayList; -import java.util.List; - -/** - * @author minwoo.jung - */ -@Component -public class TFDataSourceListBoMapper implements FlinkStatMapper { - - private static final TFDataSourceBoMapper tFDataSourceBoMapper = new TFDataSourceBoMapper(); - - public TFDataSourceList map(DataSourceListBo dataSourceListBo) { - List dataSourceBoList = dataSourceListBo.getList(); - List dataSourceList = new ArrayList<>(dataSourceBoList.size()); - - for (DataSourceBo dataSourceBo : dataSourceBoList) { - dataSourceList.add(tFDataSourceBoMapper.map(dataSourceBo)); - } - - TFDataSourceList tFDataSourceList = new TFDataSourceList(); - tFDataSourceList.setDataSourceList(dataSourceList); - - return tFDataSourceList; - } - - @Override - public void map(DataSourceListBo dataSourceListBo, TFAgentStat tfAgentStat) { - tfAgentStat.setDataSourceList(map(dataSourceListBo)); - } - - @Override - public void build(TFAgentStatMapper.TFAgentStatBuilder builder) { - AgentStatBo agentStat = builder.getAgentStat(); - List dataSourceList = agentStat.getDataSourceListBos(); - builder.build(dataSourceList, this); - } -} diff --git a/collector/src/main/java/com/navercorp/pinpoint/collector/mapper/flink/TFDirectBufferMapper.java b/collector/src/main/java/com/navercorp/pinpoint/collector/mapper/flink/TFDirectBufferMapper.java deleted file mode 100644 index cb33e238d7cd..000000000000 --- a/collector/src/main/java/com/navercorp/pinpoint/collector/mapper/flink/TFDirectBufferMapper.java +++ /dev/null @@ -1,52 +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.mapper.flink; - -import com.navercorp.pinpoint.common.server.bo.stat.AgentStatBo; -import com.navercorp.pinpoint.common.server.bo.stat.DirectBufferBo; -import com.navercorp.pinpoint.thrift.dto.flink.TFAgentStat; -import com.navercorp.pinpoint.thrift.dto.flink.TFDirectBuffer; -import org.springframework.stereotype.Component; - -import java.util.List; - -/** - * @author Roy Kim - */ -@Component -public class TFDirectBufferMapper implements FlinkStatMapper { - - public TFDirectBuffer map(DirectBufferBo directBufferBo) { - TFDirectBuffer tfFDirectBuffer = new TFDirectBuffer(); - tfFDirectBuffer.setDirectCount(directBufferBo.getDirectCount()); - tfFDirectBuffer.setDirectMemoryUsed(directBufferBo.getDirectMemoryUsed()); - tfFDirectBuffer.setMappedCount(directBufferBo.getMappedCount()); - tfFDirectBuffer.setMappedMemoryUsed(directBufferBo.getMappedMemoryUsed()); - return tfFDirectBuffer; - } - - @Override - public void map(DirectBufferBo directBufferBo, TFAgentStat tfAgentStat) { - tfAgentStat.setDirectBuffer(map(directBufferBo)); - } - - @Override - public void build(TFAgentStatMapper.TFAgentStatBuilder builder) { - AgentStatBo agentStat = builder.getAgentStat(); - List directBufferList = agentStat.getDirectBufferBos(); - builder.build(directBufferList, this); - } -} diff --git a/collector/src/main/java/com/navercorp/pinpoint/collector/mapper/flink/TFFileDescriptorMapper.java b/collector/src/main/java/com/navercorp/pinpoint/collector/mapper/flink/TFFileDescriptorMapper.java deleted file mode 100644 index 70e88467884b..000000000000 --- a/collector/src/main/java/com/navercorp/pinpoint/collector/mapper/flink/TFFileDescriptorMapper.java +++ /dev/null @@ -1,49 +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.mapper.flink; - -import com.navercorp.pinpoint.common.server.bo.stat.AgentStatBo; -import com.navercorp.pinpoint.common.server.bo.stat.FileDescriptorBo; -import com.navercorp.pinpoint.thrift.dto.flink.TFAgentStat; -import com.navercorp.pinpoint.thrift.dto.flink.TFFileDescriptor; -import org.springframework.stereotype.Component; - -import java.util.List; - -/** - * @author Roy Kim - */ -@Component -public class TFFileDescriptorMapper implements FlinkStatMapper { - - public TFFileDescriptor map(FileDescriptorBo fileDescriptorBo) { - TFFileDescriptor tfFFileDescriptor = new TFFileDescriptor(); - tfFFileDescriptor.setOpenFileDescriptorCount(fileDescriptorBo.getOpenFileDescriptorCount()); - return tfFFileDescriptor; - } - - @Override - public void map(FileDescriptorBo fileDescriptorBo, TFAgentStat tfAgentStat) { - tfAgentStat.setFileDescriptor(map(fileDescriptorBo)); - } - - @Override - public void build(TFAgentStatMapper.TFAgentStatBuilder builder) { - AgentStatBo agentStat = builder.getAgentStat(); - List fileDescriptorList = agentStat.getFileDescriptorBos(); - builder.build(fileDescriptorList, this); - } -} diff --git a/collector/src/main/java/com/navercorp/pinpoint/collector/mapper/flink/TFJvmGcMapper.java b/collector/src/main/java/com/navercorp/pinpoint/collector/mapper/flink/TFJvmGcMapper.java deleted file mode 100644 index 9a464275accb..000000000000 --- a/collector/src/main/java/com/navercorp/pinpoint/collector/mapper/flink/TFJvmGcMapper.java +++ /dev/null @@ -1,50 +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.mapper.flink; - -import com.navercorp.pinpoint.common.server.bo.stat.AgentStatBo; -import com.navercorp.pinpoint.common.server.bo.stat.JvmGcBo; -import com.navercorp.pinpoint.thrift.dto.flink.TFAgentStat; -import com.navercorp.pinpoint.thrift.dto.flink.TFJvmGc; -import org.springframework.stereotype.Component; - -import java.util.List; - -/** - * @author minwoo.jung - */ -@Component -public class TFJvmGcMapper implements FlinkStatMapper { - - public TFJvmGc map(JvmGcBo jvmGcBo) { - TFJvmGc tFJvmGc = new TFJvmGc(); - tFJvmGc.setJvmMemoryHeapUsed(jvmGcBo.getHeapUsed()); - tFJvmGc.setJvmMemoryNonHeapUsed(jvmGcBo.getNonHeapUsed()); - return tFJvmGc; - } - - @Override - public void map(JvmGcBo jvmGcBo, TFAgentStat tfAgentStat) { - tfAgentStat.setGc(map(jvmGcBo)); - } - - @Override - public void build(TFAgentStatMapper.TFAgentStatBuilder builder) { - AgentStatBo agentStat = builder.getAgentStat(); - List jvmGcList = agentStat.getJvmGcBos(); - builder.build(jvmGcList, this); - } -} diff --git a/collector/src/main/java/com/navercorp/pinpoint/collector/mapper/flink/TFLoadedClassMapper.java b/collector/src/main/java/com/navercorp/pinpoint/collector/mapper/flink/TFLoadedClassMapper.java deleted file mode 100644 index 27aa824efdc8..000000000000 --- a/collector/src/main/java/com/navercorp/pinpoint/collector/mapper/flink/TFLoadedClassMapper.java +++ /dev/null @@ -1,48 +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.mapper.flink; - -import com.navercorp.pinpoint.common.server.bo.stat.AgentStatBo; -import com.navercorp.pinpoint.common.server.bo.stat.LoadedClassBo; -import com.navercorp.pinpoint.thrift.dto.flink.TFAgentStat; -import com.navercorp.pinpoint.thrift.dto.flink.TFLoadedClass; -import org.springframework.stereotype.Component; - -import java.util.List; - -@Component -public class TFLoadedClassMapper implements FlinkStatMapper { - - public TFLoadedClass map(LoadedClassBo loadedClassBo) { - TFLoadedClass tFLoadedClass = new TFLoadedClass(); - tFLoadedClass.setLoadedClassCount(loadedClassBo.getLoadedClassCount()); - tFLoadedClass.setUnloadedClassCount(loadedClassBo.getUnloadedClassCount()); - return tFLoadedClass; - } - - @Override - public void map(LoadedClassBo loadedClassBo, TFAgentStat tfAgentStat) { - tfAgentStat.setLoadedClass(map(loadedClassBo)); - } - - @Override - public void build(TFAgentStatMapper.TFAgentStatBuilder builder) { - AgentStatBo agentStat = builder.getAgentStat(); - List loadedClassList = agentStat.getLoadedClassBos(); - builder.build(loadedClassList, this); - } -} diff --git a/collector/src/main/java/com/navercorp/pinpoint/collector/mapper/flink/TFResponseTimeMapper.java b/collector/src/main/java/com/navercorp/pinpoint/collector/mapper/flink/TFResponseTimeMapper.java deleted file mode 100644 index 291667f94388..000000000000 --- a/collector/src/main/java/com/navercorp/pinpoint/collector/mapper/flink/TFResponseTimeMapper.java +++ /dev/null @@ -1,49 +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.mapper.flink; - -import com.navercorp.pinpoint.common.server.bo.stat.AgentStatBo; -import com.navercorp.pinpoint.common.server.bo.stat.ResponseTimeBo; -import com.navercorp.pinpoint.thrift.dto.flink.TFAgentStat; -import com.navercorp.pinpoint.thrift.dto.flink.TFResponseTime; -import org.springframework.stereotype.Component; - -import java.util.List; - -/** - * @author minwoo.jung - */ -@Component -public class TFResponseTimeMapper implements FlinkStatMapper { - - public TFResponseTime map(ResponseTimeBo responseTimeBo) { - TFResponseTime tFResponseTime = new TFResponseTime(); - tFResponseTime.setAvg(responseTimeBo.getAvg()); - return tFResponseTime; - } - - @Override - public void map(ResponseTimeBo responseTimeBo, TFAgentStat tfAgentStat) { - tfAgentStat.setResponseTime(map(responseTimeBo)); - } - - @Override - public void build(TFAgentStatMapper.TFAgentStatBuilder builder) { - AgentStatBo agentStat = builder.getAgentStat(); - List responseTimeList = agentStat.getResponseTimeBos(); - builder.build(responseTimeList, this); - } -} diff --git a/collector/src/main/java/com/navercorp/pinpoint/collector/mapper/flink/TFTotalThreadCountMapper.java b/collector/src/main/java/com/navercorp/pinpoint/collector/mapper/flink/TFTotalThreadCountMapper.java deleted file mode 100644 index 9667ed74d0d2..000000000000 --- a/collector/src/main/java/com/navercorp/pinpoint/collector/mapper/flink/TFTotalThreadCountMapper.java +++ /dev/null @@ -1,46 +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.mapper.flink; - -import com.navercorp.pinpoint.common.server.bo.stat.AgentStatBo; -import com.navercorp.pinpoint.common.server.bo.stat.TotalThreadCountBo; -import com.navercorp.pinpoint.thrift.dto.flink.TFAgentStat; -import com.navercorp.pinpoint.thrift.dto.flink.TFTotalThreadCount; -import org.springframework.stereotype.Component; - -import java.util.List; - -@Component -public class TFTotalThreadCountMapper implements FlinkStatMapper { - public TFTotalThreadCount map(TotalThreadCountBo totalThreadCountBo) { - TFTotalThreadCount tFTotalThreadCount = new TFTotalThreadCount(); - tFTotalThreadCount.setTotalThreadCount(totalThreadCountBo.getTotalThreadCount()); - return tFTotalThreadCount; - } - - @Override - public void map(TotalThreadCountBo totalThreadCountBo, TFAgentStat tfAgentStat) { - tfAgentStat.setTotalThreadCount(map(totalThreadCountBo)); - } - - @Override - public void build(TFAgentStatMapper.TFAgentStatBuilder builder) { - AgentStatBo agentStat = builder.getAgentStat(); - List totalThreadCountList = agentStat.getTotalThreadCountBos(); - builder.build(totalThreadCountList, this); - } -} diff --git a/collector/src/main/java/com/navercorp/pinpoint/collector/mapper/flink/TFTransactionMapper.java b/collector/src/main/java/com/navercorp/pinpoint/collector/mapper/flink/TFTransactionMapper.java deleted file mode 100644 index cda8d3c72063..000000000000 --- a/collector/src/main/java/com/navercorp/pinpoint/collector/mapper/flink/TFTransactionMapper.java +++ /dev/null @@ -1,54 +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.mapper.flink; - -import com.navercorp.pinpoint.common.server.bo.stat.AgentStatBo; -import com.navercorp.pinpoint.common.server.bo.stat.TransactionBo; -import com.navercorp.pinpoint.thrift.dto.flink.TFAgentStat; -import com.navercorp.pinpoint.thrift.dto.flink.TFTransaction; -import org.springframework.stereotype.Component; - -import java.util.List; - -/** - * @author minwoo.jung - */ -@Component -public class TFTransactionMapper implements FlinkStatMapper { - public TFTransaction map(TransactionBo transactionBo) { - TFTransaction tFTransaction = new TFTransaction(); - tFTransaction.setSampledNewCount(transactionBo.getSampledNewCount()); - tFTransaction.setSampledContinuationCount(transactionBo.getSampledContinuationCount()); - tFTransaction.setUnsampledNewCount(transactionBo.getUnsampledNewCount()); - tFTransaction.setUnsampledContinuationCount(transactionBo.getUnsampledContinuationCount()); - tFTransaction.setSkippedNewCount(transactionBo.getSkippedNewSkipCount()); - tFTransaction.setSkippedContinuationCount(transactionBo.getSkippedContinuationCount()); - return tFTransaction; - } - - @Override - public void map(TransactionBo transactionBo, TFAgentStat tfAgentStat) { - tfAgentStat.setCollectInterval(transactionBo.getCollectInterval()); - tfAgentStat.setTransaction(map(transactionBo)); - } - - @Override - public void build(TFAgentStatMapper.TFAgentStatBuilder builder) { - AgentStatBo agentStat = builder.getAgentStat(); - List transactionList = agentStat.getTransactionBos(); - builder.build(transactionList, this); - } -} diff --git a/collector/src/main/java/com/navercorp/pinpoint/collector/sender/FlinkRequestFactory.java b/collector/src/main/java/com/navercorp/pinpoint/collector/sender/FlinkRequestFactory.java deleted file mode 100644 index b9fbf9fb22f4..000000000000 --- a/collector/src/main/java/com/navercorp/pinpoint/collector/sender/FlinkRequestFactory.java +++ /dev/null @@ -1,32 +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.sender; - -import com.navercorp.pinpoint.io.header.HeaderEntity; -import com.navercorp.pinpoint.io.request.FlinkRequest; -import org.apache.thrift.TBase; - -import java.util.Map; - -/** - * @author minwoo.jung - */ -public class FlinkRequestFactory { - - public FlinkRequest createFlinkRequest(TBase data, Map headerEntity) { - return new FlinkRequest(new HeaderEntity(headerEntity), data); - } -} diff --git a/collector/src/main/java/com/navercorp/pinpoint/collector/sender/FlinkTcpDataSender.java b/collector/src/main/java/com/navercorp/pinpoint/collector/sender/FlinkTcpDataSender.java deleted file mode 100644 index 7e10c645a975..000000000000 --- a/collector/src/main/java/com/navercorp/pinpoint/collector/sender/FlinkTcpDataSender.java +++ /dev/null @@ -1,73 +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.sender; - -import com.navercorp.pinpoint.io.request.FlinkRequest; -import com.navercorp.pinpoint.rpc.client.PinpointClientFactory; -import com.navercorp.pinpoint.thrift.io.TBaseSerializer; -import com.navercorp.pinpoint.thrift.sender.TcpDataSender; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; -import org.apache.thrift.TBase; -import org.springframework.util.Assert; - -import java.util.HashMap; -import java.util.Objects; - -/** - * @author minwoo.jung - */ -public class FlinkTcpDataSender extends TcpDataSender> { - - private final Logger logger = LogManager.getLogger(this.getClass()); - - private final TBaseSerializer flinkHeaderTBaseSerializer; - private final FlinkRequestFactory flinkRequestFactory; - - public FlinkTcpDataSender(String name, String host, int port, PinpointClientFactory clientFactory, TBaseSerializer serializer, FlinkRequestFactory flinkRequestFactory) { - super(name, host, port, clientFactory); - - Assert.hasLength(name, "name"); - Assert.hasLength(host, "host"); - Objects.requireNonNull(clientFactory, "clientFactory"); - - this.flinkHeaderTBaseSerializer = Objects.requireNonNull(serializer, "serializer"); - this.flinkRequestFactory = Objects.requireNonNull(flinkRequestFactory, "clientFactory"); - } - - @Override - public boolean send(TBase data) { - FlinkRequest flinkRequest = flinkRequestFactory.createFlinkRequest(data, new HashMap<>(0)); - return executor.execute(flinkRequest); - } - - @Override - protected void sendPacket(Object request) { - try { - if (request instanceof FlinkRequest flinkRequest) { - byte[] copy = flinkHeaderTBaseSerializer.serialize(flinkRequest.getData(), flinkRequest.getHeaderEntity()); - if (copy == null) { - return; - } - doSend(copy); - } else { - logger.error("sendPacket fail. invalid dto type:{}", request.getClass()); - } - } catch (Exception e) { - logger.warn("tcp send fail. Caused:{}", e.getMessage(), e); - } - } -} diff --git a/collector/src/main/java/com/navercorp/pinpoint/collector/service/SendAgentStatService.java b/collector/src/main/java/com/navercorp/pinpoint/collector/service/SendAgentStatService.java deleted file mode 100644 index b4397b8386bf..000000000000 --- a/collector/src/main/java/com/navercorp/pinpoint/collector/service/SendAgentStatService.java +++ /dev/null @@ -1,56 +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.service; - -import com.navercorp.pinpoint.collector.config.FlinkProperties; -import com.navercorp.pinpoint.collector.mapper.flink.TFAgentStatBatchMapper; -import com.navercorp.pinpoint.common.server.bo.stat.AgentStatBo; -import com.navercorp.pinpoint.thrift.dto.flink.TFAgentStatBatch; -import jakarta.validation.Valid; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; -import org.springframework.stereotype.Service; -import org.springframework.validation.annotation.Validated; - -import java.util.Objects; - -/** - * @author minwoo.jung - */ -@Service("sendAgentStatService") -@Validated -@ConditionalOnProperty(value = "pinpoint.modules.collector.inspector.hbase.enabled", havingValue = "true") -public class SendAgentStatService implements AgentStatService { - private final boolean flinkClusterEnable; - private final SendDataToFlinkService flinkService; - private final TFAgentStatBatchMapper tFAgentStatBatchMapper; - - public SendAgentStatService(FlinkProperties properties, @Qualifier("sendDataToFlinkService") SendDataToFlinkService flinkService, TFAgentStatBatchMapper tFAgentStatBatchMapper) { - this.flinkClusterEnable = properties.isFlinkClusterEnable(); - this.flinkService = Objects.requireNonNull(flinkService, "flinkService"); - this.tFAgentStatBatchMapper = Objects.requireNonNull(tFAgentStatBatchMapper, "tFAgentStatBatchMapper"); - } - - @Override - public void save(@Valid AgentStatBo agentStatBo) { - if (!flinkClusterEnable) { - return; - } - - TFAgentStatBatch tFAgentStatBatch = tFAgentStatBatchMapper.map(agentStatBo); - flinkService.sendData(tFAgentStatBatch); - } -} diff --git a/collector/src/main/java/com/navercorp/pinpoint/collector/service/SendDataToFlinkService.java b/collector/src/main/java/com/navercorp/pinpoint/collector/service/SendDataToFlinkService.java deleted file mode 100644 index 9b9ef1b69588..000000000000 --- a/collector/src/main/java/com/navercorp/pinpoint/collector/service/SendDataToFlinkService.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright 2019 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.service; - -import com.navercorp.pinpoint.thrift.sender.TcpDataSender; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; -import org.apache.thrift.TBase; - -import java.util.ArrayList; -import java.util.List; -import java.util.concurrent.atomic.AtomicInteger; - -/** - * @author minwoo.jung - */ -public class SendDataToFlinkService { - private final Logger logger = LogManager.getLogger(this.getClass()); - - private volatile List>> dataSenderList = new ArrayList<>(); - private final AtomicInteger callCount = new AtomicInteger(1); - - protected void sendData(TBase data) { - TcpDataSender> tcpDataSender = roundRobinTcpDataSender(); - if (tcpDataSender == null) { - logger.warn("not send flink server. Because FlinkTcpDataSender is null."); - return; - } - - try { - tcpDataSender.send(data); - if (logger.isDebugEnabled()) { - logger.debug("send to flinkserver : {}", data); - } - } catch (Exception e) { - logger.error("Error sending to flink server. Caused:{}", e.getMessage(), e); - } - } - - private TcpDataSender> roundRobinTcpDataSender() { - final List>> copyList = this.dataSenderList; - if (copyList.isEmpty()) { - return null; - } - - int count = Math.abs(callCount.getAndIncrement()); - int tcpDataSenderIndex = count % copyList.size(); - - try { - return copyList.get(tcpDataSenderIndex); - } catch (Exception e) { - logger.warn("not get FlinkTcpDataSender", e); - } - - return null; - } - - public void replaceFlinkTcpDataSenderList(List>> flinkTcpDataSenderList) { - this.dataSenderList = new ArrayList<>(flinkTcpDataSenderList); - } -} diff --git a/collector/src/main/resources/applicationContext-collector-flink.xml b/collector/src/main/resources/applicationContext-collector-flink.xml deleted file mode 100644 index b9366a800587..000000000000 --- a/collector/src/main/resources/applicationContext-collector-flink.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/collector/src/main/resources/pinpoint-collector-root.properties b/collector/src/main/resources/pinpoint-collector-root.properties index 4eafff5b926d..df057d0b580a 100644 --- a/collector/src/main/resources/pinpoint-collector-root.properties +++ b/collector/src/main/resources/pinpoint-collector-root.properties @@ -56,12 +56,6 @@ collector.map-link.avg.flush-interval=5000 collector.map-link.max.enable=true collector.map-link.max.flush-interval=5000 -# Flink configuration -flink.cluster.enable=false -flink.cluster.zookeeper.address=${pinpoint.zookeeper.address} -flink.cluster.zookeeper.znode_root=/pinpoint-cluster -flink.cluster.zookeeper.sessiontimeout=3000 - # Active Thread Count pinpoint.collector.realtime.atc.demand.duration=12500 pinpoint.collector.realtime.atc.supply.throttle.termMillis=100 @@ -75,9 +69,6 @@ pinpoint.collector.realtime.atc.enable-count-metric=false pinpoint.banner.mode=console pinpoint.banner.configs=spring.active.profile,\ pinpoint.zookeeper.address,\ - flink.cluster.enable,\ - flink.cluster.zookeeper.address,\ - flink.cluster.zookeeper.znode_root,\ collector.receiver.grpc.agent.enable,\ collector.receiver.grpc.agent.bindaddress.ip,\ collector.receiver.grpc.agent.bindaddress.port,\ diff --git a/collector/src/test/java/com/navercorp/pinpoint/collector/mapper/flink/TFActiveTraceMapperTest.java b/collector/src/test/java/com/navercorp/pinpoint/collector/mapper/flink/TFActiveTraceMapperTest.java deleted file mode 100644 index 617d95e345bc..000000000000 --- a/collector/src/test/java/com/navercorp/pinpoint/collector/mapper/flink/TFActiveTraceMapperTest.java +++ /dev/null @@ -1,64 +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.mapper.flink; - -import com.navercorp.pinpoint.common.server.bo.stat.ActiveTraceBo; -import com.navercorp.pinpoint.common.server.bo.stat.ActiveTraceHistogram; -import com.navercorp.pinpoint.thrift.dto.flink.TFActiveTrace; -import com.navercorp.pinpoint.thrift.dto.flink.TFActiveTraceHistogram; -import org.junit.jupiter.api.Test; - -import java.util.List; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * @author minwoo.jung - */ -public class TFActiveTraceMapperTest { - - public static final String TEST_AGENT = "test_agent"; - public static final long startTimestamp = 1496370596375L; - public static final long timestamp = 1496470596375L; - - - @Test - public void mapTest() { - ActiveTraceBo activeTraceBo = new ActiveTraceBo(); - activeTraceBo.setAgentId(TEST_AGENT); - activeTraceBo.setVersion((short) 1); - activeTraceBo.setStartTimestamp(startTimestamp); - activeTraceBo.setTimestamp(timestamp); - activeTraceBo.setHistogramSchemaType(1); - - ActiveTraceHistogram activeTraceHistogram = new ActiveTraceHistogram(30, 40, 10, 50); - activeTraceBo.setActiveTraceHistogram(activeTraceHistogram); - - TFActiveTraceMapper mapper = new TFActiveTraceMapper(); - TFActiveTrace tFActiveTrace = mapper.map(activeTraceBo); - - TFActiveTraceHistogram histogram = tFActiveTrace.getHistogram(); - assertEquals(1, histogram.getVersion()); - assertEquals(1, histogram.getHistogramSchemaType()); - - List activeTraceCountList = histogram.getActiveTraceCount(); - assertThat(activeTraceCountList) - .containsExactly(30, 40, 10, 50); - } - -} \ No newline at end of file diff --git a/collector/src/test/java/com/navercorp/pinpoint/collector/mapper/flink/TFAgentStatBatchMapperTest.java b/collector/src/test/java/com/navercorp/pinpoint/collector/mapper/flink/TFAgentStatBatchMapperTest.java deleted file mode 100644 index e7bd776598ac..000000000000 --- a/collector/src/test/java/com/navercorp/pinpoint/collector/mapper/flink/TFAgentStatBatchMapperTest.java +++ /dev/null @@ -1,84 +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.mapper.flink; - -import com.navercorp.pinpoint.common.server.bo.stat.AgentStatBo; -import com.navercorp.pinpoint.common.server.bo.stat.CpuLoadBo; -import com.navercorp.pinpoint.thrift.dto.flink.TFAgentStat; -import com.navercorp.pinpoint.thrift.dto.flink.TFAgentStatBatch; -import org.junit.jupiter.api.Test; - -import java.util.List; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * @author minwoo.jung - */ -public class TFAgentStatBatchMapperTest { - - public static final String TEST_APPLICATION = "test_application"; - public static final String TEST_AGENT = "test_agent"; - public static final long startTimestamp = 1496370596375L; - public static final long collectTime1st = startTimestamp + 5000; - public static final long collectTime2nd = collectTime1st + 5000; - public static final long collectTime3rd = collectTime2nd + 5000; - - @Test - public void mapTest() { - AgentStatBo agentStatBo = createCpuLoadBoList(); - - TFAgentStatMapper tFAgentStatMapper = new TFAgentStatMapper(new TFCpuLoadMapper[]{new TFCpuLoadMapper()}); - TFAgentStatBatchMapper mapper = new TFAgentStatBatchMapper(tFAgentStatMapper); - TFAgentStatBatch tFAgentStatBatch = mapper.map(agentStatBo); - - assertEquals(TEST_AGENT, tFAgentStatBatch.getAgentId()); - assertEquals(startTimestamp, tFAgentStatBatch.getStartTimestamp()); - - List agentStatList = tFAgentStatBatch.getAgentStats(); - assertThat(agentStatList).hasSize(3); - } - - private AgentStatBo createCpuLoadBoList() { - - AgentStatBo.Builder builder = AgentStatBo.newBuilder(TEST_APPLICATION, TEST_AGENT, startTimestamp); - CpuLoadBo cpuLoadBo1 = new CpuLoadBo(); - cpuLoadBo1.setJvmCpuLoad(4); - cpuLoadBo1.setSystemCpuLoad(3); - AgentStatBo.Builder.StatBuilder statBuilder1 = builder.newStatBuilder(collectTime1st); - statBuilder1.addCpuLoad(cpuLoadBo1); - - CpuLoadBo cpuLoadBo3 = new CpuLoadBo(); - cpuLoadBo3.setJvmCpuLoad(8); - cpuLoadBo3.setSystemCpuLoad(9); - AgentStatBo.Builder.StatBuilder statBuilder3 = builder.newStatBuilder(collectTime3rd); - statBuilder3.addCpuLoad(cpuLoadBo3); - - CpuLoadBo cpuLoadBo2 = new CpuLoadBo(); - cpuLoadBo2.setAgentId(TEST_AGENT); - cpuLoadBo2.setTimestamp(collectTime2nd); - cpuLoadBo2.setStartTimestamp(startTimestamp); - cpuLoadBo2.setJvmCpuLoad(5); - cpuLoadBo2.setSystemCpuLoad(6); - AgentStatBo.Builder.StatBuilder statBuilder2 = builder.newStatBuilder(collectTime2nd); - statBuilder2.addCpuLoad(cpuLoadBo2); - - return builder.build(); - } - -} \ No newline at end of file diff --git a/collector/src/test/java/com/navercorp/pinpoint/collector/mapper/flink/TFAgentStatMapperTest.java b/collector/src/test/java/com/navercorp/pinpoint/collector/mapper/flink/TFAgentStatMapperTest.java deleted file mode 100644 index a34920f31822..000000000000 --- a/collector/src/test/java/com/navercorp/pinpoint/collector/mapper/flink/TFAgentStatMapperTest.java +++ /dev/null @@ -1,523 +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.mapper.flink; - -import com.navercorp.pinpoint.common.server.bo.JvmGcType; -import com.navercorp.pinpoint.common.server.bo.stat.ActiveTraceBo; -import com.navercorp.pinpoint.common.server.bo.stat.ActiveTraceHistogram; -import com.navercorp.pinpoint.common.server.bo.stat.AgentStatBo; -import com.navercorp.pinpoint.common.server.bo.stat.CpuLoadBo; -import com.navercorp.pinpoint.common.server.bo.stat.DataSourceBo; -import com.navercorp.pinpoint.common.server.bo.stat.DataSourceListBo; -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.LoadedClassBo; -import com.navercorp.pinpoint.common.server.bo.stat.ResponseTimeBo; -import com.navercorp.pinpoint.common.server.bo.stat.TotalThreadCountBo; -import com.navercorp.pinpoint.thrift.dto.flink.TFActiveTrace; -import com.navercorp.pinpoint.thrift.dto.flink.TFActiveTraceHistogram; -import com.navercorp.pinpoint.thrift.dto.flink.TFAgentStat; -import com.navercorp.pinpoint.thrift.dto.flink.TFDataSource; -import com.navercorp.pinpoint.thrift.dto.flink.TFJvmGc; -import com.navercorp.pinpoint.thrift.dto.flink.TFResponseTime; -import org.junit.jupiter.api.Test; - -import java.util.List; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertTrue; - -/** - * @author minwoo.jung - */ -public class TFAgentStatMapperTest { - - public static final String TEST_APPLICATION = "test_application"; - public static final String TEST_AGENT = "test_agent"; - public static final long startTimestamp = 1496370596375L; - public static final long collectTime1st = startTimestamp + 5000; - public static final long collectTime2nd = collectTime1st + 5000; - public static final long collectTime3rd = collectTime2nd + 5000; - - private final FlinkStatMapper[] statMappers = { - new TFActiveTraceMapper(), - new TFCpuLoadMapper(), - new TFDataSourceListBoMapper(), - new TFDirectBufferMapper(), - new TFFileDescriptorMapper(), - new TFJvmGcMapper(), - new TFLoadedClassMapper(), - new TFResponseTimeMapper(), - new TFTotalThreadCountMapper(), - new TFTransactionMapper(), - }; - - private TFAgentStatMapper newAgentStatMapper() { - return new TFAgentStatMapper(statMappers); - } - - @Test - public void mapTest() { - AgentStatBo agentStatBo = createCpuLoadBoList(); - - List tFAgentStatList = newAgentStatMapper().map(agentStatBo); - assertThat(tFAgentStatList).hasSize(3); - - TFAgentStat tFAgentStat1 = tFAgentStatList.get(0); - assertCpu(tFAgentStat1, collectTime1st, 4, 3); - - TFAgentStat tFAgentStat2 = tFAgentStatList.get(1); - assertCpu(tFAgentStat2, collectTime2nd, 5, 6); - - TFAgentStat tFAgentStat3 = tFAgentStatList.get(2); - assertCpu(tFAgentStat3, collectTime3rd, 8, 9); - } - - private void assertCpu(TFAgentStat agentStat, long collectTime1st, int jvmCpu, int systemCpu) { - assertEquals(TEST_AGENT, agentStat.getAgentId()); - assertEquals(startTimestamp, agentStat.getStartTimestamp()); - assertEquals(collectTime1st, agentStat.getTimestamp()); - assertEquals(jvmCpu, agentStat.getCpuLoad().getJvmCpuLoad(), 0); - assertEquals(systemCpu, agentStat.getCpuLoad().getSystemCpuLoad(), 0); - } - - - private AgentStatBo createCpuLoadBoList() { - AgentStatBo.Builder builder = newBuilder(); - - CpuLoadBo cpuLoadBo1 = new CpuLoadBo(); - cpuLoadBo1.setJvmCpuLoad(4); - cpuLoadBo1.setSystemCpuLoad(3); - AgentStatBo.Builder.StatBuilder statBuilder1 = builder.newStatBuilder(collectTime1st); - statBuilder1.addCpuLoad(cpuLoadBo1); - - CpuLoadBo cpuLoadBo3 = new CpuLoadBo(); - cpuLoadBo3.setJvmCpuLoad(8); - cpuLoadBo3.setSystemCpuLoad(9); - AgentStatBo.Builder.StatBuilder statBuilder3 = builder.newStatBuilder(collectTime3rd); - statBuilder3.addCpuLoad(cpuLoadBo3); - - CpuLoadBo cpuLoadBo2 = new CpuLoadBo(); - cpuLoadBo2.setJvmCpuLoad(5); - cpuLoadBo2.setSystemCpuLoad(6); - - AgentStatBo.Builder.StatBuilder statBuilder2 = builder.newStatBuilder(collectTime2nd); - statBuilder2.addCpuLoad(cpuLoadBo2); - - return builder.build(); - } - - @Test - public void map2Test() { - AgentStatBo agentStatBo = createDataSourceListBoList(); - - List tFAgentStatList = newAgentStatMapper().map(agentStatBo); - assertThat(tFAgentStatList).hasSize(2); - - TFAgentStat tFAgentStat1 = tFAgentStatList.get(0); - assertEquals(tFAgentStat1.getAgentId(), TEST_AGENT); - assertEquals(tFAgentStat1.getStartTimestamp(), startTimestamp); - assertEquals(tFAgentStat1.getTimestamp(), collectTime1st); - assertTrue(tFAgentStat1.isSetDataSourceList()); - - List dataSourceList1 = tFAgentStat1.getDataSourceList().getDataSourceList(); - assertThat(dataSourceList1).hasSize(2); - TFDataSource tfDataSource1_1 = dataSourceList1.get(0); - TFDataSource tfDataSource1_2 = dataSourceList1.get(1); - - assertDataSource(tfDataSource1_1, 1, "jdbc:mysql", 1000, 15, 30, "pinpoint1"); - assertDataSource(tfDataSource1_2, 2, "jdbc:mssql", 2000, 25, 40, "pinpoint2"); - - TFAgentStat tFAgentStat2 = tFAgentStatList.get(1); - assertEquals(tFAgentStat2.getAgentId(), TEST_AGENT); - assertEquals(tFAgentStat2.getStartTimestamp(), startTimestamp); - assertEquals(tFAgentStat2.getTimestamp(), collectTime2nd); - assertTrue(tFAgentStat2.isSetDataSourceList()); - - List dataSourceList2 = tFAgentStat2.getDataSourceList().getDataSourceList(); - assertThat(dataSourceList2).hasSize(2); - TFDataSource tfDataSource2_1 = dataSourceList2.get(0); - TFDataSource tfDataSource2_2 = dataSourceList2.get(1); - - assertDataSource(tfDataSource2_1, 1, "jdbc:mysql", 1000, 16, 31, "pinpoint1"); - assertDataSource(tfDataSource2_2, 2, "jdbc:mssql", 2000, 26, 41, "pinpoint2"); - } - - private void assertDataSource(TFDataSource dataSource, int id, String url, int serviceTypeCode, int activeConnectionSize, int maxConnectionSize, String databaseName) { - assertEquals(dataSource.getId(), id); - assertEquals(dataSource.getUrl(), url); - assertEquals(dataSource.getServiceTypeCode(), serviceTypeCode); - assertEquals(dataSource.getActiveConnectionSize(), activeConnectionSize); - assertEquals(dataSource.getMaxConnectionSize(), maxConnectionSize); - assertEquals(dataSource.getDatabaseName(), databaseName); - } - - private AgentStatBo createDataSourceListBoList() { - AgentStatBo.Builder builder = AgentStatBo.newBuilder(TEST_APPLICATION, TEST_AGENT, startTimestamp); - - - DataSourceBo dataSourceBo1_1 = new DataSourceBo(); - dataSourceBo1_1.setServiceTypeCode((short) 1000); - dataSourceBo1_1.setJdbcUrl("jdbc:mysql"); - dataSourceBo1_1.setActiveConnectionSize(15); - dataSourceBo1_1.setMaxConnectionSize(30); - dataSourceBo1_1.setId(1); - dataSourceBo1_1.setDatabaseName("pinpoint1"); - - DataSourceBo dataSourceBo1_2 = new DataSourceBo(); - dataSourceBo1_2.setServiceTypeCode((short) 2000); - dataSourceBo1_2.setJdbcUrl("jdbc:mssql"); - dataSourceBo1_2.setActiveConnectionSize(25); - dataSourceBo1_2.setMaxConnectionSize(40); - dataSourceBo1_2.setId(2); - dataSourceBo1_2.setDatabaseName("pinpoint2"); - - DataSourceListBo dataSourceListBo1 = new DataSourceListBo(); - dataSourceListBo1.add(dataSourceBo1_1); - dataSourceListBo1.add(dataSourceBo1_2); - - DataSourceBo dataSourceBo2_1 = new DataSourceBo(); - dataSourceBo2_1.setServiceTypeCode((short) 1000); - dataSourceBo2_1.setJdbcUrl("jdbc:mysql"); - dataSourceBo2_1.setActiveConnectionSize(16); - dataSourceBo2_1.setMaxConnectionSize(31); - dataSourceBo2_1.setId(1); - dataSourceBo2_1.setDatabaseName("pinpoint1"); - - DataSourceBo dataSourceBo2_2 = new DataSourceBo(); - dataSourceBo2_2.setServiceTypeCode((short) 2000); - dataSourceBo2_2.setJdbcUrl("jdbc:mssql"); - dataSourceBo2_2.setActiveConnectionSize(26); - dataSourceBo2_2.setMaxConnectionSize(41); - dataSourceBo2_2.setId(2); - dataSourceBo2_2.setDatabaseName("pinpoint2"); - - DataSourceListBo dataSourceListBo2 = new DataSourceListBo(); - dataSourceListBo2.add(dataSourceBo2_1); - dataSourceListBo2.add(dataSourceBo2_2); - - AgentStatBo.Builder.StatBuilder statBuilder1 = builder.newStatBuilder(collectTime1st); - statBuilder1.addDataSourceList(dataSourceListBo1); - AgentStatBo.Builder.StatBuilder statBuilder2 = builder.newStatBuilder(collectTime2nd); - statBuilder2.addDataSourceList(dataSourceListBo2); - - return builder.build(); - } - - @Test - public void map3Test() { - AgentStatBo agentStatBo = createJvmGcBoList(); - - List tFAgentStatList = newAgentStatMapper().map(agentStatBo); - assertThat(tFAgentStatList).hasSize(2); - - TFAgentStat tFAgentStat1 = tFAgentStatList.get(0); - assertEquals(tFAgentStat1.getAgentId(), TEST_AGENT); - assertEquals(tFAgentStat1.getStartTimestamp(), startTimestamp); - assertEquals(tFAgentStat1.getTimestamp(), collectTime1st); - TFJvmGc tFJvmGc1 = tFAgentStat1.getGc(); - assertEquals(tFJvmGc1.getJvmMemoryHeapUsed(), 3000); - assertEquals(tFJvmGc1.getJvmMemoryNonHeapUsed(), 300); - - TFAgentStat tFAgentStat2 = tFAgentStatList.get(1); - assertEquals(tFAgentStat2.getAgentId(), TEST_AGENT); - assertEquals(tFAgentStat2.getStartTimestamp(), startTimestamp); - assertEquals(tFAgentStat2.getTimestamp(), collectTime2nd); - TFJvmGc tFJvmGc2 = tFAgentStat2.getGc(); - assertEquals(tFJvmGc2.getJvmMemoryHeapUsed(), 3100); - assertEquals(tFJvmGc2.getJvmMemoryNonHeapUsed(), 310); - } - - private AgentStatBo createJvmGcBoList() { - AgentStatBo.Builder builder = newBuilder(); - - JvmGcBo jvmGcBo1 = new JvmGcBo(); - jvmGcBo1.setGcType(JvmGcType.G1); - jvmGcBo1.setHeapUsed(3000); - jvmGcBo1.setHeapMax(5000); - jvmGcBo1.setNonHeapUsed(300); - jvmGcBo1.setNonHeapMax(500); - jvmGcBo1.setGcOldCount(5); - jvmGcBo1.setGcOldTime(10); - AgentStatBo.Builder.StatBuilder statBuilder1 = builder.newStatBuilder(collectTime1st); - statBuilder1.addJvmGc(jvmGcBo1); - - JvmGcBo jvmGcBo2 = new JvmGcBo(); - jvmGcBo2.setGcType(JvmGcType.G1); - jvmGcBo2.setHeapUsed(3100); - jvmGcBo2.setHeapMax(5100); - jvmGcBo2.setNonHeapUsed(310); - jvmGcBo2.setNonHeapMax(510); - jvmGcBo2.setGcOldCount(15); - jvmGcBo2.setGcOldTime(20); - AgentStatBo.Builder.StatBuilder statBuilder2 = builder.newStatBuilder(collectTime2nd); - statBuilder2.addJvmGc(jvmGcBo2); - - return builder.build(); - } - - @Test - public void map4Test() { - AgentStatBo agentStatBo = createActiveTraceBoList(); - - - List tFAgentStatList = newAgentStatMapper().map(agentStatBo); - assertThat(tFAgentStatList).hasSize(2); - - TFAgentStat tFAgentStat1 = tFAgentStatList.get(0); - assertEquals(tFAgentStat1.getAgentId(), TEST_AGENT); - assertEquals(tFAgentStat1.getStartTimestamp(), startTimestamp); - assertEquals(tFAgentStat1.getTimestamp(), collectTime1st); - TFActiveTrace activeTrace1 = tFAgentStat1.getActiveTrace(); - TFActiveTraceHistogram histogram1 = activeTrace1.getHistogram(); - List activeTraceCount1 = histogram1.getActiveTraceCount(); - - assertThat(activeTraceCount1).containsExactly(30, 40, 10, 50); - - TFAgentStat tFAgentStat2 = tFAgentStatList.get(1); - assertEquals(tFAgentStat2.getAgentId(), TEST_AGENT); - assertEquals(tFAgentStat2.getStartTimestamp(), startTimestamp); - assertEquals(tFAgentStat2.getTimestamp(), collectTime2nd); - TFActiveTrace activeTrace2 = tFAgentStat2.getActiveTrace(); - TFActiveTraceHistogram histogram2 = activeTrace2.getHistogram(); - List activeTraceCount2 = histogram2.getActiveTraceCount(); - - assertThat(activeTraceCount2).containsExactly(31, 41, 11, 51); - - } - - private AgentStatBo createActiveTraceBoList() { - AgentStatBo.Builder builder = newBuilder(); - - ActiveTraceBo activeTraceBo1 = new ActiveTraceBo(); - - activeTraceBo1.setVersion((short) 1); - activeTraceBo1.setHistogramSchemaType(2); - ActiveTraceHistogram activeTraceHistogram1 = new ActiveTraceHistogram(30, 40, 10, 50); - activeTraceBo1.setActiveTraceHistogram(activeTraceHistogram1); - AgentStatBo.Builder.StatBuilder statBuilder1 = builder.newStatBuilder(collectTime1st); - statBuilder1.addActiveTrace(activeTraceBo1); - - ActiveTraceBo activeTraceBo2 = new ActiveTraceBo(); - activeTraceBo2.setTimestamp(collectTime2nd); - activeTraceBo2.setVersion((short) 1); - activeTraceBo2.setHistogramSchemaType(2); - - ActiveTraceHistogram activeTraceHistogram2 = new ActiveTraceHistogram(31, 41, 11, 51); - activeTraceBo2.setActiveTraceHistogram(activeTraceHistogram2); - - AgentStatBo.Builder.StatBuilder statBuilder2 = builder.newStatBuilder(collectTime2nd); - statBuilder2.addActiveTrace(activeTraceBo2); - - return builder.build(); - } - - @Test - public void map5Test() { - - AgentStatBo agentStatBo = createResponseTimeBoList(); - - List tFAgentStatList = newAgentStatMapper().map(agentStatBo); - assertThat(tFAgentStatList).hasSize(2); - - TFAgentStat tFAgentStat1 = tFAgentStatList.get(0); - assertEquals(tFAgentStat1.getAgentId(), TEST_AGENT); - assertEquals(tFAgentStat1.getStartTimestamp(), startTimestamp); - assertEquals(tFAgentStat1.getTimestamp(), collectTime1st); - TFResponseTime responseTime1 = tFAgentStat1.getResponseTime(); - assertEquals(responseTime1.getAvg(), 1000); - - TFAgentStat tFAgentStat2 = tFAgentStatList.get(1); - assertEquals(tFAgentStat2.getAgentId(), TEST_AGENT); - assertEquals(tFAgentStat2.getStartTimestamp(), startTimestamp); - assertEquals(tFAgentStat2.getTimestamp(), collectTime2nd); - TFResponseTime responseTime2 = tFAgentStat2.getResponseTime(); - assertEquals(responseTime2.getAvg(), 2000); - } - - private AgentStatBo createResponseTimeBoList() { - AgentStatBo.Builder builder = newBuilder(); - - ResponseTimeBo responseTimeBo1 = new ResponseTimeBo(); - responseTimeBo1.setAvg(1000); - AgentStatBo.Builder.StatBuilder statBuilder1 = builder.newStatBuilder(collectTime1st); - statBuilder1.addResponseTime(responseTimeBo1); - - ResponseTimeBo responseTimeBo2 = new ResponseTimeBo(); - responseTimeBo2.setAvg(2000); - AgentStatBo.Builder.StatBuilder statBuilder2 = builder.newStatBuilder(collectTime2nd); - statBuilder2.addResponseTime(responseTimeBo2); - - return builder.build(); - } - - @Test - public void map6Test() { - - AgentStatBo agentStatBo = createFileDescriptorBoList(); - - List tFAgentStatList = newAgentStatMapper().map(agentStatBo); - assertThat(tFAgentStatList).hasSize(3); - - TFAgentStat tFAgentStat1 = tFAgentStatList.get(0); - assertEquals(TEST_AGENT, tFAgentStat1.getAgentId()); - assertEquals(startTimestamp, tFAgentStat1.getStartTimestamp()); - assertEquals(collectTime1st, tFAgentStat1.getTimestamp()); - assertEquals(4, tFAgentStat1.getFileDescriptor().getOpenFileDescriptorCount(), 0); - - TFAgentStat tFAgentStat2 = tFAgentStatList.get(1); - assertEquals(TEST_AGENT, tFAgentStat2.getAgentId()); - assertEquals(startTimestamp, tFAgentStat2.getStartTimestamp()); - assertEquals(collectTime2nd, tFAgentStat2.getTimestamp()); - assertEquals(5, tFAgentStat2.getFileDescriptor().getOpenFileDescriptorCount(), 0); - - TFAgentStat tFAgentStat3 = tFAgentStatList.get(2); - assertEquals(TEST_AGENT, tFAgentStat3.getAgentId()); - assertEquals(startTimestamp, tFAgentStat3.getStartTimestamp()); - assertEquals(collectTime3rd, tFAgentStat3.getTimestamp()); - assertEquals(8, tFAgentStat3.getFileDescriptor().getOpenFileDescriptorCount(), 0); - } - - private AgentStatBo createFileDescriptorBoList() { - final AgentStatBo.Builder builder = newBuilder(); - - FileDescriptorBo fileDescriptorBo1 = new FileDescriptorBo(); - fileDescriptorBo1.setOpenFileDescriptorCount(4); - AgentStatBo.Builder.StatBuilder statBuilder1 = builder.newStatBuilder(collectTime1st); - statBuilder1.addFileDescriptor(fileDescriptorBo1); - - - FileDescriptorBo fileDescriptorBo2 = new FileDescriptorBo(); - fileDescriptorBo2.setOpenFileDescriptorCount(5); - AgentStatBo.Builder.StatBuilder statBuilder2 = builder.newStatBuilder(collectTime2nd); - statBuilder2.addFileDescriptor(fileDescriptorBo2); - - FileDescriptorBo fileDescriptorBo3 = new FileDescriptorBo(); - fileDescriptorBo3.setOpenFileDescriptorCount(8); - AgentStatBo.Builder.StatBuilder statBuilder3 = builder.newStatBuilder(collectTime3rd); - statBuilder3.addFileDescriptor(fileDescriptorBo3); - - return builder.build(); - } - - private AgentStatBo.Builder newBuilder() { - return AgentStatBo.newBuilder(TEST_APPLICATION, TEST_AGENT, startTimestamp); - } - - @Test - public void map7Test() { - AgentStatBo agentStatBo = createTotalThreadCountBoList(); - - List tFAgentStatList = newAgentStatMapper().map(agentStatBo); - assertThat(tFAgentStatList).hasSize(3); - - TFAgentStat tFAgentStat1 = tFAgentStatList.get(0); - assertEquals(TEST_AGENT, tFAgentStat1.getAgentId()); - assertEquals(startTimestamp, tFAgentStat1.getStartTimestamp()); - assertEquals(collectTime1st, tFAgentStat1.getTimestamp()); - assertEquals(4, tFAgentStat1.getTotalThreadCount().getTotalThreadCount(), 0); - - TFAgentStat tFAgentStat2 = tFAgentStatList.get(1); - assertEquals(TEST_AGENT, tFAgentStat2.getAgentId()); - assertEquals(startTimestamp, tFAgentStat2.getStartTimestamp()); - assertEquals(collectTime2nd, tFAgentStat2.getTimestamp()); - assertEquals(5, tFAgentStat2.getTotalThreadCount().getTotalThreadCount(), 0); - - TFAgentStat tFAgentStat3 = tFAgentStatList.get(2); - assertEquals(TEST_AGENT, tFAgentStat3.getAgentId()); - assertEquals(startTimestamp, tFAgentStat3.getStartTimestamp()); - assertEquals(collectTime3rd, tFAgentStat3.getTimestamp()); - assertEquals(8, tFAgentStat3.getTotalThreadCount().getTotalThreadCount(), 0); - } - - private AgentStatBo createTotalThreadCountBoList() { - AgentStatBo.Builder builder = newBuilder(); - - TotalThreadCountBo totalThreadCountBo1 = new TotalThreadCountBo(); - totalThreadCountBo1.setAgentId(TEST_AGENT); - totalThreadCountBo1.setTimestamp(collectTime1st); - totalThreadCountBo1.setStartTimestamp(startTimestamp); - totalThreadCountBo1.setTotalThreadCount(4); - AgentStatBo.Builder.StatBuilder statBuilder1 = builder.newStatBuilder(collectTime1st); - statBuilder1.addTotalThreadCount(totalThreadCountBo1); - - TotalThreadCountBo totalThreadCountBo2 = new TotalThreadCountBo(); - totalThreadCountBo2.setTotalThreadCount(5); - AgentStatBo.Builder.StatBuilder statBuilder2 = builder.newStatBuilder(collectTime2nd); - statBuilder2.addTotalThreadCount(totalThreadCountBo2); - - TotalThreadCountBo totalThreadCountBo3 = new TotalThreadCountBo(); - totalThreadCountBo3.setTotalThreadCount(8); - AgentStatBo.Builder.StatBuilder statBuilder3 = builder.newStatBuilder(collectTime3rd); - statBuilder3.addTotalThreadCount(totalThreadCountBo3); - return builder.build(); - } - - @Test - public void map8Test() { - AgentStatBo agentStatBo = createLoadedClassCountBoList(); - - List tFAgentStatList = newAgentStatMapper().map(agentStatBo); - assertThat(tFAgentStatList).hasSize(3); - - TFAgentStat tFAgentStat1 = tFAgentStatList.get(0); - assertEquals(TEST_AGENT, tFAgentStat1.getAgentId()); - assertEquals(startTimestamp, tFAgentStat1.getStartTimestamp()); - assertEquals(collectTime1st, tFAgentStat1.getTimestamp()); - assertEquals(4, tFAgentStat1.getLoadedClass().getLoadedClassCount(), 0); - assertEquals(4, tFAgentStat1.getLoadedClass().getUnloadedClassCount(), 0); - - TFAgentStat tFAgentStat2 = tFAgentStatList.get(1); - assertEquals(TEST_AGENT, tFAgentStat2.getAgentId()); - assertEquals(startTimestamp, tFAgentStat2.getStartTimestamp()); - assertEquals(collectTime2nd, tFAgentStat2.getTimestamp()); - assertEquals(5, tFAgentStat2.getLoadedClass().getLoadedClassCount(), 0); - assertEquals(5, tFAgentStat2.getLoadedClass().getUnloadedClassCount(), 0); - - TFAgentStat tFAgentStat3 = tFAgentStatList.get(2); - assertEquals(TEST_AGENT, tFAgentStat3.getAgentId()); - assertEquals(startTimestamp, tFAgentStat3.getStartTimestamp()); - assertEquals(collectTime3rd, tFAgentStat3.getTimestamp()); - assertEquals(6, tFAgentStat3.getLoadedClass().getLoadedClassCount(), 0); - assertEquals(6, tFAgentStat3.getLoadedClass().getUnloadedClassCount(), 0); - } - - private AgentStatBo createLoadedClassCountBoList() { - AgentStatBo.Builder builder = newBuilder(); - - LoadedClassBo loadedClassBo1 = new LoadedClassBo(); - loadedClassBo1.setLoadedClassCount(4); - loadedClassBo1.setUnloadedClassCount(4); - AgentStatBo.Builder.StatBuilder statBuilder1 = builder.newStatBuilder(collectTime1st); - statBuilder1.addLoadedClass(loadedClassBo1); - - LoadedClassBo loadedClassBo2 = new LoadedClassBo(); - loadedClassBo2.setLoadedClassCount(5); - loadedClassBo2.setUnloadedClassCount(5); - AgentStatBo.Builder.StatBuilder statBuilder2 = builder.newStatBuilder(collectTime2nd); - statBuilder2.addLoadedClass(loadedClassBo2); - - LoadedClassBo loadedClassBo3 = new LoadedClassBo(); - loadedClassBo3.setLoadedClassCount(6); - loadedClassBo3.setUnloadedClassCount(6); - AgentStatBo.Builder.StatBuilder statBuilder3 = builder.newStatBuilder(collectTime3rd); - statBuilder3.addLoadedClass(loadedClassBo3); - - return builder.build(); - } -} \ No newline at end of file diff --git a/collector/src/test/java/com/navercorp/pinpoint/collector/mapper/flink/TFCpuLoadMapperTest.java b/collector/src/test/java/com/navercorp/pinpoint/collector/mapper/flink/TFCpuLoadMapperTest.java deleted file mode 100644 index e401bceab565..000000000000 --- a/collector/src/test/java/com/navercorp/pinpoint/collector/mapper/flink/TFCpuLoadMapperTest.java +++ /dev/null @@ -1,40 +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.mapper.flink; - -import com.navercorp.pinpoint.common.server.bo.stat.CpuLoadBo; -import com.navercorp.pinpoint.thrift.dto.flink.TFCpuLoad; -import org.junit.jupiter.api.Test; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * @author minwoo.jung - */ -public class TFCpuLoadMapperTest { - @Test - public void mapTest() { - TFCpuLoadMapper tFCpuLoadMapper = new TFCpuLoadMapper(); - CpuLoadBo cpuLoadBo = new CpuLoadBo(); - cpuLoadBo.setJvmCpuLoad(30); - cpuLoadBo.setSystemCpuLoad(50); - TFCpuLoad tFCpuLoad = tFCpuLoadMapper.map(cpuLoadBo); - assertEquals(tFCpuLoad.getJvmCpuLoad(), 30, 0); - assertEquals(tFCpuLoad.getSystemCpuLoad(), 50, 0); - } - -} \ No newline at end of file diff --git a/collector/src/test/java/com/navercorp/pinpoint/collector/mapper/flink/TFDataSourceBoMapperTest.java b/collector/src/test/java/com/navercorp/pinpoint/collector/mapper/flink/TFDataSourceBoMapperTest.java deleted file mode 100644 index 0e1c3fe33eb2..000000000000 --- a/collector/src/test/java/com/navercorp/pinpoint/collector/mapper/flink/TFDataSourceBoMapperTest.java +++ /dev/null @@ -1,53 +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.mapper.flink; - -import com.navercorp.pinpoint.common.server.bo.stat.DataSourceBo; -import com.navercorp.pinpoint.thrift.dto.flink.TFDataSource; -import org.junit.jupiter.api.Test; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * @author minwoo.jung - */ -public class TFDataSourceBoMapperTest { - - public static final long timestamp = 1496370596375L; - - @Test - public void mapTest() { - DataSourceBo dataSourceBo = new DataSourceBo(); - dataSourceBo.setId(1); - dataSourceBo.setJdbcUrl("jdbc:mysql"); - dataSourceBo.setDatabaseName("pinpoint"); - dataSourceBo.setServiceTypeCode((short) 1000); - dataSourceBo.setTimestamp(timestamp); - dataSourceBo.setActiveConnectionSize(15); - dataSourceBo.setMaxConnectionSize(30); - - TFDataSourceBoMapper mapper = new TFDataSourceBoMapper(); - TFDataSource tFdataSource = mapper.map(dataSourceBo); - assertEquals(tFdataSource.getId(), 1); - assertEquals(tFdataSource.getServiceTypeCode(), 1000); - assertEquals(tFdataSource.getDatabaseName(), "pinpoint"); - assertEquals(tFdataSource.getUrl(), "jdbc:mysql"); - assertEquals(tFdataSource.getActiveConnectionSize(), 15); - assertEquals(tFdataSource.getMaxConnectionSize(), 30); - } - -} \ No newline at end of file diff --git a/collector/src/test/java/com/navercorp/pinpoint/collector/mapper/flink/TFDataSourceListBoMapperTest.java b/collector/src/test/java/com/navercorp/pinpoint/collector/mapper/flink/TFDataSourceListBoMapperTest.java deleted file mode 100644 index 3cf2473c98ac..000000000000 --- a/collector/src/test/java/com/navercorp/pinpoint/collector/mapper/flink/TFDataSourceListBoMapperTest.java +++ /dev/null @@ -1,88 +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.mapper.flink; - -import com.navercorp.pinpoint.common.server.bo.stat.DataSourceBo; -import com.navercorp.pinpoint.common.server.bo.stat.DataSourceListBo; -import com.navercorp.pinpoint.thrift.dto.flink.TFDataSource; -import com.navercorp.pinpoint.thrift.dto.flink.TFDataSourceList; -import org.junit.jupiter.api.Test; - -import java.util.List; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * @author minwoo.jung - */ -public class TFDataSourceListBoMapperTest { - - public static final long startTimestamp = 1496370596375L; - public static final long collectTime1st = startTimestamp + 5000; - - @Test - public void mapTest() { - DataSourceListBo dataSourceListBo = new DataSourceListBo(); - dataSourceListBo.setAgentId("test_agent1"); - dataSourceListBo.setStartTimestamp(startTimestamp); - dataSourceListBo.setTimestamp(collectTime1st); - - DataSourceBo dataSourceBo1 = new DataSourceBo(); - dataSourceBo1.setAgentId("test_agent1"); - dataSourceBo1.setTimestamp(collectTime1st); - dataSourceBo1.setServiceTypeCode((short) 1000); - dataSourceBo1.setJdbcUrl("jdbc:mysql"); - dataSourceBo1.setActiveConnectionSize(15); - dataSourceBo1.setMaxConnectionSize(30); - dataSourceBo1.setId(1); - dataSourceBo1.setDatabaseName("pinpoint1"); - DataSourceBo dataSourceBo2 = new DataSourceBo(); - dataSourceBo2.setAgentId("test_agent1"); - dataSourceBo2.setTimestamp(collectTime1st); - dataSourceBo2.setServiceTypeCode((short) 2000); - dataSourceBo2.setJdbcUrl("jdbc:mssql"); - dataSourceBo2.setActiveConnectionSize(25); - dataSourceBo2.setMaxConnectionSize(40); - dataSourceBo2.setId(2); - dataSourceBo2.setDatabaseName("pinpoint2"); - dataSourceListBo.add(dataSourceBo1); - dataSourceListBo.add(dataSourceBo2); - - TFDataSourceListBoMapper tFDataSourceListBoMapper = new TFDataSourceListBoMapper(); - TFDataSourceList tfDataSourceList = tFDataSourceListBoMapper.map(dataSourceListBo); - - List dataSourceList = tfDataSourceList.getDataSourceList(); - assertThat(dataSourceList).hasSize(2); - - TFDataSource tfDataSource1 = dataSourceList.get(0); - assertEquals(tfDataSource1.getId(), 1); - assertEquals(tfDataSource1.getUrl(), "jdbc:mysql"); - assertEquals(tfDataSource1.getDatabaseName(), "pinpoint1"); - assertEquals(tfDataSource1.getActiveConnectionSize(), 15); - assertEquals(tfDataSource1.getMaxConnectionSize(), 30); - assertEquals(tfDataSource1.getServiceTypeCode(), 1000); - - TFDataSource tfDataSource2 = dataSourceList.get(1); - assertEquals(tfDataSource2.getId(), 2); - assertEquals(tfDataSource2.getUrl(), "jdbc:mssql"); - assertEquals(tfDataSource2.getDatabaseName(), "pinpoint2"); - assertEquals(tfDataSource2.getActiveConnectionSize(), 25); - assertEquals(tfDataSource2.getMaxConnectionSize(), 40); - assertEquals(tfDataSource2.getServiceTypeCode(), 2000); - } -} \ No newline at end of file diff --git a/collector/src/test/java/com/navercorp/pinpoint/collector/mapper/flink/TFDirectBufferMapperTest.java b/collector/src/test/java/com/navercorp/pinpoint/collector/mapper/flink/TFDirectBufferMapperTest.java deleted file mode 100644 index 0a51886a3703..000000000000 --- a/collector/src/test/java/com/navercorp/pinpoint/collector/mapper/flink/TFDirectBufferMapperTest.java +++ /dev/null @@ -1,44 +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.mapper.flink; - -import com.navercorp.pinpoint.common.server.bo.stat.DirectBufferBo; -import com.navercorp.pinpoint.thrift.dto.flink.TFDirectBuffer; -import org.junit.jupiter.api.Test; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * @author Roy Kim - */ -public class TFDirectBufferMapperTest { - @Test - public void mapTest() { - TFDirectBufferMapper tFDirectBufferMapper = new TFDirectBufferMapper(); - DirectBufferBo directBufferBo = new DirectBufferBo(); - directBufferBo.setDirectCount(30); - directBufferBo.setDirectMemoryUsed(30); - directBufferBo.setMappedCount(30); - directBufferBo.setMappedMemoryUsed(30); - TFDirectBuffer tFDirectBuffer = tFDirectBufferMapper.map(directBufferBo); - assertEquals(tFDirectBuffer.getDirectCount(), 30, 0); - assertEquals(tFDirectBuffer.getDirectMemoryUsed(), 30, 0); - assertEquals(tFDirectBuffer.getMappedCount(), 30, 0); - assertEquals(tFDirectBuffer.getMappedMemoryUsed(), 30, 0); - } - -} \ No newline at end of file diff --git a/collector/src/test/java/com/navercorp/pinpoint/collector/mapper/flink/TFFileDescriptorMapperTest.java b/collector/src/test/java/com/navercorp/pinpoint/collector/mapper/flink/TFFileDescriptorMapperTest.java deleted file mode 100644 index c35cec29ab48..000000000000 --- a/collector/src/test/java/com/navercorp/pinpoint/collector/mapper/flink/TFFileDescriptorMapperTest.java +++ /dev/null @@ -1,38 +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.mapper.flink; - -import com.navercorp.pinpoint.common.server.bo.stat.FileDescriptorBo; -import com.navercorp.pinpoint.thrift.dto.flink.TFFileDescriptor; -import org.junit.jupiter.api.Test; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * @author Roy Kim - */ -public class TFFileDescriptorMapperTest { - @Test - public void mapTest() { - TFFileDescriptorMapper tFFileDescriptorMapper = new TFFileDescriptorMapper(); - FileDescriptorBo fileDescriptorBo = new FileDescriptorBo(); - fileDescriptorBo.setOpenFileDescriptorCount(30); - TFFileDescriptor tFFileDescriptor = tFFileDescriptorMapper.map(fileDescriptorBo); - assertEquals(tFFileDescriptor.getOpenFileDescriptorCount(), 30, 0); - } - -} \ No newline at end of file diff --git a/collector/src/test/java/com/navercorp/pinpoint/collector/mapper/flink/TFJvmGcMapperTest.java b/collector/src/test/java/com/navercorp/pinpoint/collector/mapper/flink/TFJvmGcMapperTest.java deleted file mode 100644 index a22954c9482f..000000000000 --- a/collector/src/test/java/com/navercorp/pinpoint/collector/mapper/flink/TFJvmGcMapperTest.java +++ /dev/null @@ -1,42 +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.mapper.flink; - -import com.navercorp.pinpoint.common.server.bo.stat.JvmGcBo; -import com.navercorp.pinpoint.thrift.dto.flink.TFJvmGc; -import org.junit.jupiter.api.Test; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * @author minwoo.jung - */ -public class TFJvmGcMapperTest { - - @Test - public void mapTest() { - TFJvmGcMapper tFJvmGcMapper = new TFJvmGcMapper(); - JvmGcBo jvmGcBo = new JvmGcBo(); - jvmGcBo.setHeapUsed(3000); - jvmGcBo.setNonHeapUsed(500); - TFJvmGc tFJvmGc = tFJvmGcMapper.map(jvmGcBo); - - assertEquals(3000, tFJvmGc.getJvmMemoryHeapUsed()); - assertEquals(500, tFJvmGc.getJvmMemoryNonHeapUsed()); - } - -} \ No newline at end of file diff --git a/collector/src/test/java/com/navercorp/pinpoint/collector/mapper/flink/TFLoadedClassCountMapperTest.java b/collector/src/test/java/com/navercorp/pinpoint/collector/mapper/flink/TFLoadedClassCountMapperTest.java deleted file mode 100644 index d4807e9ad49f..000000000000 --- a/collector/src/test/java/com/navercorp/pinpoint/collector/mapper/flink/TFLoadedClassCountMapperTest.java +++ /dev/null @@ -1,36 +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.mapper.flink; - -import com.navercorp.pinpoint.common.server.bo.stat.LoadedClassBo; -import com.navercorp.pinpoint.thrift.dto.flink.TFLoadedClass; -import org.junit.jupiter.api.Test; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -public class TFLoadedClassCountMapperTest { - @Test - public void mapTest() { - TFLoadedClassMapper mapper = new TFLoadedClassMapper(); - LoadedClassBo loadedClassBo = new LoadedClassBo(); - loadedClassBo.setLoadedClassCount(50); - loadedClassBo.setUnloadedClassCount(50); - TFLoadedClass tfLoadedClass = mapper.map(loadedClassBo); - assertEquals(tfLoadedClass.getLoadedClassCount(), 50); - assertEquals(tfLoadedClass.getUnloadedClassCount(), 50); - } -} diff --git a/collector/src/test/java/com/navercorp/pinpoint/collector/mapper/flink/TFResponseTimeMapperTest.java b/collector/src/test/java/com/navercorp/pinpoint/collector/mapper/flink/TFResponseTimeMapperTest.java deleted file mode 100644 index 92f35b4bf0ac..000000000000 --- a/collector/src/test/java/com/navercorp/pinpoint/collector/mapper/flink/TFResponseTimeMapperTest.java +++ /dev/null @@ -1,38 +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.mapper.flink; - -import com.navercorp.pinpoint.common.server.bo.stat.ResponseTimeBo; -import com.navercorp.pinpoint.thrift.dto.flink.TFResponseTime; -import org.junit.jupiter.api.Test; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * @author minwoo.jung - */ -public class TFResponseTimeMapperTest { - - @Test - public void mapTest() { - TFResponseTimeMapper mapper = new TFResponseTimeMapper(); - ResponseTimeBo responseTimeBo = new ResponseTimeBo(); - responseTimeBo.setAvg(50); - TFResponseTime tFResponseTime = mapper.map(responseTimeBo); - assertEquals(tFResponseTime.getAvg(), 50); - } -} \ No newline at end of file diff --git a/collector/src/test/java/com/navercorp/pinpoint/collector/mapper/flink/TFTotalThreadCountMapperTest.java b/collector/src/test/java/com/navercorp/pinpoint/collector/mapper/flink/TFTotalThreadCountMapperTest.java deleted file mode 100644 index be124f0a3bc2..000000000000 --- a/collector/src/test/java/com/navercorp/pinpoint/collector/mapper/flink/TFTotalThreadCountMapperTest.java +++ /dev/null @@ -1,34 +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.mapper.flink; - -import com.navercorp.pinpoint.common.server.bo.stat.TotalThreadCountBo; -import com.navercorp.pinpoint.thrift.dto.flink.TFTotalThreadCount; -import org.junit.jupiter.api.Test; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -public class TFTotalThreadCountMapperTest { - @Test - public void mapTest() { - TFTotalThreadCountMapper mapper = new TFTotalThreadCountMapper(); - TotalThreadCountBo totalThreadCountBo = new TotalThreadCountBo(); - totalThreadCountBo.setTotalThreadCount(50); - TFTotalThreadCount tfTotalThreadCount = mapper.map(totalThreadCountBo); - assertEquals(tfTotalThreadCount.getTotalThreadCount(), 50); - } -} diff --git a/collector/src/test/java/com/navercorp/pinpoint/collector/mapper/flink/TFTransactionMapperTest.java b/collector/src/test/java/com/navercorp/pinpoint/collector/mapper/flink/TFTransactionMapperTest.java deleted file mode 100644 index bdbdebc0d0e9..000000000000 --- a/collector/src/test/java/com/navercorp/pinpoint/collector/mapper/flink/TFTransactionMapperTest.java +++ /dev/null @@ -1,49 +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.mapper.flink; - -import com.navercorp.pinpoint.common.server.bo.stat.TransactionBo; -import com.navercorp.pinpoint.thrift.dto.flink.TFTransaction; -import org.junit.jupiter.api.Test; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * @author minwoo.jung - */ -public class TFTransactionMapperTest { - - @Test - public void mapTest() { - TFTransactionMapper tFTransactionMapper = new TFTransactionMapper(); - TransactionBo transactionBo = new TransactionBo(); - transactionBo.setSampledContinuationCount(5); - transactionBo.setUnsampledContinuationCount(6); - transactionBo.setSampledNewCount(11); - transactionBo.setUnsampledNewCount(10); - transactionBo.setSkippedNewSkipCount(11); - transactionBo.setSkippedContinuationCount(5); - TFTransaction tFtransaction = tFTransactionMapper.map(transactionBo); - - assertEquals(5, tFtransaction.getSampledContinuationCount()); - assertEquals(6, tFtransaction.getUnsampledContinuationCount()); - assertEquals(11, tFtransaction.getSampledNewCount()); - assertEquals(10, tFtransaction.getUnsampledNewCount()); - assertEquals(11, tFtransaction.getSkippedNewCount()); - assertEquals(5, tFtransaction.getSkippedContinuationCount()); - } -} \ No newline at end of file diff --git a/commons-server-cluster/src/main/java/com/navercorp/pinpoint/common/server/cluster/zookeeper/ZookeeperClusterProperties.java b/commons-server-cluster/src/main/java/com/navercorp/pinpoint/common/server/cluster/zookeeper/ZookeeperClusterProperties.java index 78d94b753ce3..6c79a58325ec 100644 --- a/commons-server-cluster/src/main/java/com/navercorp/pinpoint/common/server/cluster/zookeeper/ZookeeperClusterProperties.java +++ b/commons-server-cluster/src/main/java/com/navercorp/pinpoint/common/server/cluster/zookeeper/ZookeeperClusterProperties.java @@ -34,7 +34,6 @@ public class ZookeeperClusterProperties { private final String webZNodePath; private final String collectorZNodePath; - private final String flinkZNodePath; private ZookeeperClusterProperties(Builder builder) { this.enable = builder.enable; @@ -44,7 +43,6 @@ private ZookeeperClusterProperties(Builder builder) { String zNodeRootPath = builder.zNodeRoot; this.webZNodePath = ZKPaths.makePath(zNodeRootPath, builder.webLeafPath); this.collectorZNodePath = ZKPaths.makePath(zNodeRootPath, builder.collectorLeafPath); - this.flinkZNodePath = ZKPaths.makePath(zNodeRootPath, builder.flinkLeafPath); } public boolean isEnable() { @@ -63,10 +61,6 @@ public String getCollectorZNodePath() { return collectorZNodePath; } - public String getFlinkZNodePath() { - return flinkZNodePath; - } - public int getSessionTimeout() { return sessionTimeout; } @@ -82,7 +76,6 @@ public static class Builder { private String zNodeRoot = ZookeeperConstants.DEFAULT_CLUSTER_ZNODE_ROOT_PATH; private String webLeafPath = ZookeeperConstants.WEB_LEAF_PATH; private String collectorLeafPath = ZookeeperConstants.COLLECTOR_LEAF_PATH; - private String flinkLeafPath = ZookeeperConstants.FLINK_LEAF_PATH; private int sessionTimeout = 3000; @@ -129,14 +122,6 @@ public void setCollectorLeafPath(String collectorLeafPath) { this.collectorLeafPath = collectorLeafPath; } - public String getFlinkLeafPath() { - return flinkLeafPath; - } - - public void setFlinkLeafPath(String flinkLeafPath) { - this.flinkLeafPath = flinkLeafPath; - } - public int getSessionTimeout() { return sessionTimeout; } @@ -162,7 +147,6 @@ public String toString() { sb.append(", sessionTimeout=").append(sessionTimeout); sb.append(", webZNodePath='").append(webZNodePath).append('\''); sb.append(", collectorZNodePath='").append(collectorZNodePath).append('\''); - sb.append(", flinkZNodePath='").append(flinkZNodePath).append('\''); sb.append('}'); return sb.toString(); } diff --git a/commons-server-cluster/src/main/java/com/navercorp/pinpoint/common/server/cluster/zookeeper/ZookeeperConstants.java b/commons-server-cluster/src/main/java/com/navercorp/pinpoint/common/server/cluster/zookeeper/ZookeeperConstants.java index 34cf3098097d..771f03cf2e27 100644 --- a/commons-server-cluster/src/main/java/com/navercorp/pinpoint/common/server/cluster/zookeeper/ZookeeperConstants.java +++ b/commons-server-cluster/src/main/java/com/navercorp/pinpoint/common/server/cluster/zookeeper/ZookeeperConstants.java @@ -28,6 +28,5 @@ public class ZookeeperConstants { public static final String WEB_LEAF_PATH = "web"; public static final String COLLECTOR_LEAF_PATH = "collector"; - public static final String FLINK_LEAF_PATH = "flink"; } diff --git a/commons-server-cluster/src/main/java/com/navercorp/pinpoint/common/server/cluster/zookeeper/config/ClusterConfigurationFactory.java b/commons-server-cluster/src/main/java/com/navercorp/pinpoint/common/server/cluster/zookeeper/config/ClusterConfigurationFactory.java index 993b08d0ee4e..75a9a639b12d 100644 --- a/commons-server-cluster/src/main/java/com/navercorp/pinpoint/common/server/cluster/zookeeper/config/ClusterConfigurationFactory.java +++ b/commons-server-cluster/src/main/java/com/navercorp/pinpoint/common/server/cluster/zookeeper/config/ClusterConfigurationFactory.java @@ -32,49 +32,18 @@ public class ClusterConfigurationFactory { private static final String DEFAULT_CLUSTER = "cluster"; private static final String DEFAULT_CLUSTER_ZOOKEEPER = "cluster.zookeeper"; - private static final String FLINK_CLUSTER = "flink.cluster"; - private static final String FLINK_CLUSTER_ZOOKEEPER = "flink.cluster.zookeeper"; - - private static final String FLINK_SPAN_STAT_CLUSTER = "span.stat.flink.cluster"; - private static final String SPAN_STAT_FLINK_CLUSTER_ZOOKEEPER = "span.stat.flink.cluster.zookeeper"; - @Bean(DEFAULT_CLUSTER) @ConfigurationProperties(prefix = DEFAULT_CLUSTER) public ClusterEnable newDefaultConfigurationEnable() { return new ClusterEnable(); } - @Bean(FLINK_CLUSTER) - @ConfigurationProperties(prefix = FLINK_CLUSTER) - public ClusterEnable newFlinkClusterEnable() { - return new ClusterEnable(); - } - - @Bean(FLINK_SPAN_STAT_CLUSTER) - @ConfigurationProperties(prefix = FLINK_SPAN_STAT_CLUSTER) - public ClusterEnable newFlinkSpanStatClusterEnable() { - return new ClusterEnable(); - } - - @Bean(DEFAULT_CLUSTER_ZOOKEEPER) @ConfigurationProperties(prefix = DEFAULT_CLUSTER_ZOOKEEPER) public ZookeeperClusterProperties.Builder newDefaultPropertiesBuilder() { return ZookeeperClusterProperties.newBuilder(); } - @Bean(FLINK_CLUSTER_ZOOKEEPER) - @ConfigurationProperties(prefix = FLINK_CLUSTER_ZOOKEEPER) - public ZookeeperClusterProperties.Builder newFlinkPropertiesBuilder() { - return ZookeeperClusterProperties.newBuilder(); - } - - @Bean(SPAN_STAT_FLINK_CLUSTER_ZOOKEEPER) - @ConfigurationProperties(prefix = SPAN_STAT_FLINK_CLUSTER_ZOOKEEPER) - public ZookeeperClusterProperties.Builder newFlinkSpanStatPropertiesBuilder() { - return ZookeeperClusterProperties.newBuilder(); - } - @Bean public ZookeeperClusterProperties clusterProperties() { ClusterEnable clusterEnable = newDefaultConfigurationEnable(); @@ -82,20 +51,6 @@ public ZookeeperClusterProperties clusterProperties() { return createProperties(clusterEnable, builder); } - @Bean - public ZookeeperClusterProperties flinkClusterProperties() { - ClusterEnable clusterEnable = newFlinkClusterEnable(); - ZookeeperClusterProperties.Builder builder = newFlinkPropertiesBuilder(); - return createProperties(clusterEnable, builder); - } - - @Bean - public ZookeeperClusterProperties flinkSpanStatClusterProperties() { - ClusterEnable clusterEnable = newFlinkSpanStatClusterEnable(); - ZookeeperClusterProperties.Builder builder = newFlinkSpanStatPropertiesBuilder(); - return createProperties(clusterEnable, builder); - } - private ZookeeperClusterProperties createProperties(ClusterEnable clusterEnable, ZookeeperClusterProperties.Builder builder) { builder.setEnable(clusterEnable.isEnable()); diff --git a/commons-server-cluster/src/test/java/com/navercorp/pinpoint/common/server/cluster/zookeeper/config/ClusterConfigurationTest.java b/commons-server-cluster/src/test/java/com/navercorp/pinpoint/common/server/cluster/zookeeper/config/ClusterConfigurationTest.java index 9c4e645065b1..9a5ee42197da 100644 --- a/commons-server-cluster/src/test/java/com/navercorp/pinpoint/common/server/cluster/zookeeper/config/ClusterConfigurationTest.java +++ b/commons-server-cluster/src/test/java/com/navercorp/pinpoint/common/server/cluster/zookeeper/config/ClusterConfigurationTest.java @@ -44,14 +44,6 @@ public class ClusterConfigurationTest { @Qualifier("clusterProperties") ZookeeperClusterProperties defaultClusterProperties; - @Autowired - @Qualifier("flinkClusterProperties") - ZookeeperClusterProperties flinkClusterProperties; - - @Autowired - @Qualifier("flinkSpanStatClusterProperties") - ZookeeperClusterProperties spanStatFlinkClusterProperties; - @Test public void clusterConfigurationTest() { ZNodePathFactory zNodePathFactory = new ZNodePathFactory("/cluster"); @@ -60,34 +52,9 @@ public void clusterConfigurationTest() { Assertions.assertEquals("localhost", defaultClusterProperties.getAddress()); Assertions.assertEquals(zNodePathFactory.create("webs"), defaultClusterProperties.getWebZNodePath()); Assertions.assertEquals(zNodePathFactory.createCollectorPath(), defaultClusterProperties.getCollectorZNodePath()); - Assertions.assertEquals(zNodePathFactory.createFlinkPath(), defaultClusterProperties.getFlinkZNodePath()); Assertions.assertEquals(1000, defaultClusterProperties.getSessionTimeout()); } - @Test - public void flinkClusterConfigurationTest() { - ZNodePathFactory zNodePathFactory = new ZNodePathFactory("/flink-cluster"); - - Assertions.assertFalse(flinkClusterProperties.isEnable()); - Assertions.assertEquals("127.0.0.1", flinkClusterProperties.getAddress()); - Assertions.assertEquals(zNodePathFactory.createWebPath(), flinkClusterProperties.getWebZNodePath()); - Assertions.assertEquals(zNodePathFactory.create("collectors"), flinkClusterProperties.getCollectorZNodePath()); - Assertions.assertEquals(zNodePathFactory.createFlinkPath(), flinkClusterProperties.getFlinkZNodePath()); - Assertions.assertEquals(2000, flinkClusterProperties.getSessionTimeout()); - } - - @Test - public void spanStatFlinkClusterConfigurationTest() { - ZNodePathFactory zNodePathFactory = new ZNodePathFactory("/span-stat-flink-cluster"); - - Assertions.assertTrue(defaultClusterProperties.isEnable()); - Assertions.assertEquals("0.0.0.0", spanStatFlinkClusterProperties.getAddress()); - Assertions.assertEquals(zNodePathFactory.createWebPath(), spanStatFlinkClusterProperties.getWebZNodePath()); - Assertions.assertEquals(zNodePathFactory.createCollectorPath(), spanStatFlinkClusterProperties.getCollectorZNodePath()); - Assertions.assertEquals(zNodePathFactory.create("flinks"), spanStatFlinkClusterProperties.getFlinkZNodePath()); - Assertions.assertEquals(3000, spanStatFlinkClusterProperties.getSessionTimeout()); - } - private static class ZNodePathFactory { private final String zNodeRoot; @@ -108,10 +75,6 @@ private String createCollectorPath() { return ZKPaths.makePath(zNodeRoot, ZookeeperConstants.COLLECTOR_LEAF_PATH); } - private String createFlinkPath() { - return ZKPaths.makePath(zNodeRoot, ZookeeperConstants.FLINK_LEAF_PATH); - } - } diff --git a/commons-server-cluster/src/test/resources/test-cluster.properties b/commons-server-cluster/src/test/resources/test-cluster.properties index 461a620082ee..86367a1496a2 100644 --- a/commons-server-cluster/src/test/resources/test-cluster.properties +++ b/commons-server-cluster/src/test/resources/test-cluster.properties @@ -2,16 +2,4 @@ cluster.enable=true cluster.zookeeper.address=localhost cluster.zookeeper.znode_root=/cluster cluster.zookeeper.web_leaf_path=webs -cluster.zookeeper.sessiontimeout=1000 - -flink.cluster.enable=false -flink.cluster.zookeeper.address=127.0.0.1 -flink.cluster.zookeeper.znode_root=/flink-cluster -flink.cluster.zookeeper.collector_leaf_path=collectors -flink.cluster.zookeeper.sessiontimeout=2000 - -span.stat.flink.cluster.enable=true -span.stat.flink.cluster.zookeeper.address=0.0.0.0 -span.stat.flink.cluster.zookeeper.znode_root=/span-stat-flink-cluster -span.stat.flink.cluster.zookeeper.flink_leaf_path=flinks -span.stat.flink.cluster.zookeeper.sessiontimeout=3000 +cluster.zookeeper.sessiontimeout=1000 \ No newline at end of file diff --git a/commons-server/src/main/java/com/navercorp/pinpoint/common/server/CommonsHbaseConfiguration.java b/commons-server/src/main/java/com/navercorp/pinpoint/common/server/CommonsHbaseConfiguration.java index 0afb6eb21613..3b875a85d306 100644 --- a/commons-server/src/main/java/com/navercorp/pinpoint/common/server/CommonsHbaseConfiguration.java +++ b/commons-server/src/main/java/com/navercorp/pinpoint/common/server/CommonsHbaseConfiguration.java @@ -1,7 +1,6 @@ package com.navercorp.pinpoint.common.server; import com.navercorp.pinpoint.common.server.bo.serializer.stat.config.AgentStatSerializeConfiguration; -import com.navercorp.pinpoint.common.server.bo.serializer.stat.config.ApplicationStatSerializeConfiguration; import com.navercorp.pinpoint.common.server.bo.serializer.trace.v2.config.SpanSerializeConfiguration; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; @@ -10,10 +9,7 @@ @Configuration @Import({ SpanSerializeConfiguration.class, - AgentStatSerializeConfiguration.class, - ApplicationStatSerializeConfiguration.class, - }) @ComponentScan(basePackages = { "com.navercorp.pinpoint.common.server.bo.codec", diff --git a/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/codec/stat/ApplicationStatCodec.java b/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/codec/stat/ApplicationStatCodec.java deleted file mode 100644 index 78f6b45dd821..000000000000 --- a/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/codec/stat/ApplicationStatCodec.java +++ /dev/null @@ -1,35 +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.common.server.bo.codec.stat; - -import com.navercorp.pinpoint.common.buffer.Buffer; -import com.navercorp.pinpoint.common.server.bo.serializer.stat.ApplicationStatDecodingContext; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinStatBo; - -import java.util.List; - -/** - * @author minwoo.jung - */ -public interface ApplicationStatCodec { - - byte getVersion(); - - void encodeValues(Buffer valueBuffer, List joinStatBoList); - - List decodeValues(Buffer valueBuffer, ApplicationStatDecodingContext decodingContext); -} - diff --git a/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/codec/stat/ApplicationStatDecoder.java b/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/codec/stat/ApplicationStatDecoder.java deleted file mode 100644 index 838db5be8ce6..000000000000 --- a/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/codec/stat/ApplicationStatDecoder.java +++ /dev/null @@ -1,51 +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.common.server.bo.codec.stat; - -import com.navercorp.pinpoint.common.buffer.Buffer; -import com.navercorp.pinpoint.common.server.bo.serializer.stat.ApplicationStatDecodingContext; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinStatBo; - -import java.util.List; -import java.util.Objects; - -/** - * @author minwoo.jung - */ -public class ApplicationStatDecoder { - - private final ApplicationStatCodec[] codecs; - - @SuppressWarnings("unchecked") - public ApplicationStatDecoder(List> codecs) { - Objects.requireNonNull(codecs, "codecs"); - this.codecs = codecs.toArray(new ApplicationStatCodec[0]); - } - - public long decodeQualifier(Buffer qualifierBuffer) { - return qualifierBuffer.readVLong(); - } - - public List decodeValue(Buffer valueBuffer, ApplicationStatDecodingContext decodingContext) { - byte version = valueBuffer.readByte(); - for (ApplicationStatCodec codec : this.codecs) { - if (version == codec.getVersion()) { - return codec.decodeValues(valueBuffer, decodingContext); - } - } - throw new IllegalArgumentException("Unknown version : " + version); - } -} diff --git a/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/codec/stat/ApplicationStatEncoder.java b/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/codec/stat/ApplicationStatEncoder.java deleted file mode 100644 index b720f1baaf29..000000000000 --- a/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/codec/stat/ApplicationStatEncoder.java +++ /dev/null @@ -1,50 +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.common.server.bo.codec.stat; - -import com.navercorp.pinpoint.common.buffer.AutomaticBuffer; -import com.navercorp.pinpoint.common.buffer.Buffer; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinStatBo; - -import java.nio.ByteBuffer; -import java.util.List; -import java.util.Objects; - -/** - * @author minwoo.jung - */ -public class ApplicationStatEncoder { - - private final ApplicationStatCodec codec; - - public ApplicationStatEncoder(ApplicationStatCodec codec) { - this.codec = Objects.requireNonNull(codec, "codec"); - } - - public ByteBuffer encodeQualifier(long timestampDelta) { - // Variable-length encoding of 5 minutes (300000 ms) takes up max 3 bytes - Buffer qualifierBuffer = new AutomaticBuffer(3); - qualifierBuffer.putVLong(timestampDelta); - return qualifierBuffer.wrapByteBuffer(); - } - - public ByteBuffer encodeValue(List JoinStatBoList) { - Buffer valueBuffer = new AutomaticBuffer(); - valueBuffer.putByte(this.codec.getVersion()); - codec.encodeValues(valueBuffer, JoinStatBoList); - return valueBuffer.wrapByteBuffer(); - } -} diff --git a/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/codec/stat/join/ActiveTraceCodec.java b/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/codec/stat/join/ActiveTraceCodec.java deleted file mode 100644 index d94b4620c255..000000000000 --- a/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/codec/stat/join/ActiveTraceCodec.java +++ /dev/null @@ -1,134 +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.common.server.bo.codec.stat.join; - -import com.navercorp.pinpoint.common.buffer.Buffer; -import com.navercorp.pinpoint.common.server.bo.codec.stat.AgentStatDataPointCodec; -import com.navercorp.pinpoint.common.server.bo.codec.stat.ApplicationStatCodec; -import com.navercorp.pinpoint.common.server.bo.codec.stat.header.AgentStatHeaderDecoder; -import com.navercorp.pinpoint.common.server.bo.codec.stat.header.AgentStatHeaderEncoder; -import com.navercorp.pinpoint.common.server.bo.codec.stat.header.BitCountingHeaderDecoder; -import com.navercorp.pinpoint.common.server.bo.codec.stat.header.BitCountingHeaderEncoder; -import com.navercorp.pinpoint.common.server.bo.codec.stat.strategy.JoinIntFieldEncodingStrategy; -import com.navercorp.pinpoint.common.server.bo.codec.stat.strategy.JoinIntFieldStrategyAnalyzer; -import com.navercorp.pinpoint.common.server.bo.codec.stat.strategy.StrategyAnalyzer; -import com.navercorp.pinpoint.common.server.bo.codec.stat.strategy.UnsignedIntegerEncodingStrategy; -import com.navercorp.pinpoint.common.server.bo.codec.stat.strategy.UnsignedShortEncodingStrategy; -import com.navercorp.pinpoint.common.server.bo.codec.strategy.EncodingStrategy; -import com.navercorp.pinpoint.common.server.bo.serializer.stat.ApplicationStatDecodingContext; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinActiveTraceBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinIntFieldBo; -import org.springframework.stereotype.Component; -import org.springframework.util.Assert; - -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -/** - * @author minwoo.jung - */ -@Component -public class ActiveTraceCodec implements ApplicationStatCodec { - private static final byte VERSION = 1; - - private final AgentStatDataPointCodec codec; - - public ActiveTraceCodec(AgentStatDataPointCodec codec) { - this.codec = Objects.requireNonNull(codec, "codec"); - } - - @Override - public byte getVersion() { - return VERSION; - } - - @Override - public void encodeValues(Buffer valueBuffer, List joinActiveTraceBoList) { - Assert.notEmpty(joinActiveTraceBoList, "joinActiveTraceBoList"); - - final int numValues = joinActiveTraceBoList.size(); - valueBuffer.putVInt(numValues); - List timestamps = new ArrayList<>(numValues); - UnsignedShortEncodingStrategy.Analyzer.Builder versionAnalyzerBuilder = new UnsignedShortEncodingStrategy.Analyzer.Builder(); - UnsignedIntegerEncodingStrategy.Analyzer.Builder schemaTypeAnalyzerBuilder = new UnsignedIntegerEncodingStrategy.Analyzer.Builder(); - JoinIntFieldStrategyAnalyzer.Builder totalCountAnalyzerBuilder = new JoinIntFieldStrategyAnalyzer.Builder(); - - for (JoinActiveTraceBo joinActiveTraceBo : joinActiveTraceBoList) { - timestamps.add(joinActiveTraceBo.getTimestamp()); - versionAnalyzerBuilder.addValue(joinActiveTraceBo.getVersion()); - schemaTypeAnalyzerBuilder.addValue(joinActiveTraceBo.getHistogramSchemaType()); - totalCountAnalyzerBuilder.addValue(joinActiveTraceBo.getTotalCountJoinValue()); - } - - codec.encodeTimestamps(valueBuffer, timestamps); - encodeDataPoints(valueBuffer, versionAnalyzerBuilder.build(), schemaTypeAnalyzerBuilder.build(), totalCountAnalyzerBuilder.build()); - - } - - private void encodeDataPoints(Buffer valueBuffer, StrategyAnalyzer versionAnalyzer, StrategyAnalyzer schemaTypeAnalyzer, JoinIntFieldStrategyAnalyzer totalCountAnalyzer) { - AgentStatHeaderEncoder headerEncoder = new BitCountingHeaderEncoder(); - headerEncoder.addCode(versionAnalyzer.getBestStrategy().getCode()); - headerEncoder.addCode(schemaTypeAnalyzer.getBestStrategy().getCode()); - - final byte[] codes = totalCountAnalyzer.getBestStrategy().getCodes(); - for (byte code : codes) { - headerEncoder.addCode(code); - } - - final byte[] header = headerEncoder.getHeader(); - valueBuffer.putPrefixedBytes(header); - - this.codec.encodeValues(valueBuffer, versionAnalyzer.getBestStrategy(), versionAnalyzer.getValues()); - this.codec.encodeValues(valueBuffer, schemaTypeAnalyzer.getBestStrategy(), schemaTypeAnalyzer.getValues()); - this.codec.encodeValues(valueBuffer, totalCountAnalyzer.getBestStrategy(), totalCountAnalyzer.getValues()); - } - - @Override - public List decodeValues(Buffer valueBuffer, ApplicationStatDecodingContext decodingContext) { - final String id = decodingContext.getApplicationId(); - final long baseTimestamp = decodingContext.getBaseTimestamp(); - final long timestampDelta = decodingContext.getTimestampDelta(); - final long initialTimestamp = baseTimestamp + timestampDelta; - - int numValues = valueBuffer.readVInt(); - List timestampList = this.codec.decodeTimestamps(initialTimestamp, valueBuffer, numValues); - - final byte[] header = valueBuffer.readPrefixedBytes(); - AgentStatHeaderDecoder headerDecoder = new BitCountingHeaderDecoder(header); - EncodingStrategy versionEncodingStrategy = UnsignedShortEncodingStrategy.getFromCode(headerDecoder.getCode()); - EncodingStrategy schemaTypeEncodingStrategy = UnsignedIntegerEncodingStrategy.getFromCode(headerDecoder.getCode()); - JoinIntFieldEncodingStrategy totalCountJoinIntValueEncodingStrategy = JoinIntFieldEncodingStrategy.getFromCode(headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode()); - - List versionList = this.codec.decodeValues(valueBuffer, versionEncodingStrategy, numValues); - List schemaTypeList = this.codec.decodeValues(valueBuffer, schemaTypeEncodingStrategy, numValues); - List totalCountJoinIntValueList = this.codec.decodeValues(valueBuffer, totalCountJoinIntValueEncodingStrategy, numValues); - - List joinActiveTraceBoList = new ArrayList<>(); - for (int i = 0; i < numValues; i++) { - JoinActiveTraceBo joinActiveTraceBo = new JoinActiveTraceBo(); - joinActiveTraceBo.setId(id); - joinActiveTraceBo.setVersion(versionList.get(i)); - joinActiveTraceBo.setTimestamp(timestampList.get(i)); - joinActiveTraceBo.setHistogramSchemaType(schemaTypeList.get(i)); - joinActiveTraceBo.setTotalCountJoinValue(totalCountJoinIntValueList.get(i)); - joinActiveTraceBoList.add(joinActiveTraceBo); - } - - return joinActiveTraceBoList; - } - -} diff --git a/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/codec/stat/join/ApplicationCoderConfiguration.java b/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/codec/stat/join/ApplicationCoderConfiguration.java deleted file mode 100644 index 82de2b1b7676..000000000000 --- a/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/codec/stat/join/ApplicationCoderConfiguration.java +++ /dev/null @@ -1,142 +0,0 @@ -package com.navercorp.pinpoint.common.server.bo.codec.stat.join; - -import com.navercorp.pinpoint.common.server.bo.codec.stat.ApplicationStatCodec; -import com.navercorp.pinpoint.common.server.bo.codec.stat.ApplicationStatDecoder; -import com.navercorp.pinpoint.common.server.bo.codec.stat.ApplicationStatEncoder; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinActiveTraceBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinCpuLoadBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinDataSourceListBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinDirectBufferBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinFileDescriptorBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinLoadedClassBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinMemoryBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinResponseTimeBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinTotalThreadCountBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinTransactionBo; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -import java.util.List; - -@Configuration -public class ApplicationCoderConfiguration { - - @Bean - public ApplicationStatDecoder getActiveTraceDecoder(List> codecs) { - return new ApplicationStatDecoder<>(codecs); - } - - @Bean - public ApplicationStatEncoder getActiveTraceEncoder(ApplicationStatCodec codec) { - return new ApplicationStatEncoder<>(codec); - } - - //----------------- - - @Bean - public ApplicationStatDecoder getCpuLoadDecoder(List> codecs) { - return new ApplicationStatDecoder<>(codecs); - } - - @Bean - public ApplicationStatEncoder getCpuLoadEncoder(ApplicationStatCodec codec) { - return new ApplicationStatEncoder<>(codec); - } - - //----------------- - - @Bean - public ApplicationStatDecoder getDataSourceDecoder(List> codecs) { - return new ApplicationStatDecoder<>(codecs); - } - - @Bean - public ApplicationStatEncoder getDataSourceEncoder(ApplicationStatCodec codec) { - return new ApplicationStatEncoder<>(codec); - } - - //----------------- - - @Bean - public ApplicationStatDecoder getDirectBufferDecoder(List> codecs) { - return new ApplicationStatDecoder<>(codecs); - } - - @Bean - public ApplicationStatEncoder getDirectBufferEncoder(ApplicationStatCodec codec) { - return new ApplicationStatEncoder<>(codec); - } - - - //----------------- - - @Bean - public ApplicationStatDecoder getFileDescriptorDecoder(List> codecs) { - return new ApplicationStatDecoder<>(codecs); - } - - @Bean - public ApplicationStatEncoder getFileDescriptorEncoder(ApplicationStatCodec codec) { - return new ApplicationStatEncoder<>(codec); - } - - //----------------- - - @Bean - public ApplicationStatDecoder getLoadedClassDecoder(List> codecs) { - return new ApplicationStatDecoder<>(codecs); - } - - @Bean - public ApplicationStatEncoder getLoadedClassEncoder(ApplicationStatCodec codec) { - return new ApplicationStatEncoder<>(codec); - } - - //----------------- - - @Bean - public ApplicationStatDecoder getMemoryDecoder(List> codecs) { - return new ApplicationStatDecoder<>(codecs); - } - - @Bean - public ApplicationStatEncoder getMemoryEncoder(ApplicationStatCodec codec) { - return new ApplicationStatEncoder<>(codec); - } - - //----------------- - - @Bean - public ApplicationStatDecoder getResponseTimeDecoder(List> codecs) { - return new ApplicationStatDecoder<>(codecs); - } - - @Bean - public ApplicationStatEncoder getResponseTimeEncoder(ApplicationStatCodec codec) { - return new ApplicationStatEncoder<>(codec); - } - - //----------------- - - @Bean - public ApplicationStatDecoder getTotalThreadCountDecoder(List> codecs) { - return new ApplicationStatDecoder<>(codecs); - } - - @Bean - public ApplicationStatEncoder getTotalThreadCountEncoder(ApplicationStatCodec codec) { - return new ApplicationStatEncoder<>(codec); - } - - //----------------- - - @Bean - public ApplicationStatDecoder getTransactionDecoder(List> codecs) { - return new ApplicationStatDecoder<>(codecs); - } - - @Bean - public ApplicationStatEncoder getTransactionEncoder(ApplicationStatCodec codec) { - return new ApplicationStatEncoder<>(codec); - } -} diff --git a/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/codec/stat/join/CpuLoadCodec.java b/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/codec/stat/join/CpuLoadCodec.java deleted file mode 100644 index b47a7ed5485c..000000000000 --- a/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/codec/stat/join/CpuLoadCodec.java +++ /dev/null @@ -1,124 +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.common.server.bo.codec.stat.join; - -import com.navercorp.pinpoint.common.buffer.Buffer; -import com.navercorp.pinpoint.common.server.bo.codec.stat.AgentStatDataPointCodec; -import com.navercorp.pinpoint.common.server.bo.codec.stat.ApplicationStatCodec; -import com.navercorp.pinpoint.common.server.bo.codec.stat.header.AgentStatHeaderDecoder; -import com.navercorp.pinpoint.common.server.bo.codec.stat.header.AgentStatHeaderEncoder; -import com.navercorp.pinpoint.common.server.bo.codec.stat.header.BitCountingHeaderDecoder; -import com.navercorp.pinpoint.common.server.bo.codec.stat.header.BitCountingHeaderEncoder; -import com.navercorp.pinpoint.common.server.bo.codec.stat.strategy.JoinLongFieldEncodingStrategy; -import com.navercorp.pinpoint.common.server.bo.codec.stat.strategy.JoinLongFieldStrategyAnalyzer; -import com.navercorp.pinpoint.common.server.bo.serializer.stat.ApplicationStatDecodingContext; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinCpuLoadBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinLongFieldBo; -import org.springframework.stereotype.Component; -import org.springframework.util.Assert; - -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -/** - * @author minwoo.jung - */ -@Component -public class CpuLoadCodec implements ApplicationStatCodec { - - private static final byte VERSION = 1; - - private final AgentStatDataPointCodec codec; - - public CpuLoadCodec(AgentStatDataPointCodec codec) { - this.codec = Objects.requireNonNull(codec, "codec"); - } - - @Override - public byte getVersion() { - return VERSION; - } - - @Override - public void encodeValues(Buffer valueBuffer, List joinCpuLoadBoList) { - Assert.notEmpty(joinCpuLoadBoList, "joinCpuLoadBoList"); - - final int numValues = joinCpuLoadBoList.size(); - valueBuffer.putVInt(numValues); - List timestamps = new ArrayList<>(numValues); - JoinLongFieldStrategyAnalyzer.Builder jvmCpuLoadAnalyzerBuilder = new JoinLongFieldStrategyAnalyzer.Builder(); - JoinLongFieldStrategyAnalyzer.Builder systemCpuLoadAnalyzerBuilder = new JoinLongFieldStrategyAnalyzer.Builder(); - for (JoinCpuLoadBo joinCpuLoadBo : joinCpuLoadBoList) { - timestamps.add(joinCpuLoadBo.getTimestamp()); - jvmCpuLoadAnalyzerBuilder.addValue(joinCpuLoadBo.getJvmCpuLoadJoinValue().toLongFieldBo()); - systemCpuLoadAnalyzerBuilder.addValue(joinCpuLoadBo.getSystemCpuLoadJoinValue().toLongFieldBo()); - } - codec.encodeTimestamps(valueBuffer, timestamps); - encodeDataPoints(valueBuffer, jvmCpuLoadAnalyzerBuilder.build(), systemCpuLoadAnalyzerBuilder.build()); - } - - private void encodeDataPoints(Buffer valueBuffer, JoinLongFieldStrategyAnalyzer jvmCpuLoadAnalyzer, JoinLongFieldStrategyAnalyzer systemCpuLoadAnalyzer) { - // encode header - AgentStatHeaderEncoder headerEncoder = new BitCountingHeaderEncoder(); - byte[] codes = jvmCpuLoadAnalyzer.getBestStrategy().getCodes(); - for (byte code : codes) { - headerEncoder.addCode(code); - } - codes = systemCpuLoadAnalyzer.getBestStrategy().getCodes(); - for (byte code : codes) { - headerEncoder.addCode(code); - } - - final byte[] header = headerEncoder.getHeader(); - valueBuffer.putPrefixedBytes(header); - // encode values - this.codec.encodeValues(valueBuffer, jvmCpuLoadAnalyzer.getBestStrategy(), jvmCpuLoadAnalyzer.getValues()); - this.codec.encodeValues(valueBuffer, systemCpuLoadAnalyzer.getBestStrategy(), systemCpuLoadAnalyzer.getValues()); - } - - @Override - public List decodeValues(Buffer valueBuffer, ApplicationStatDecodingContext decodingContext) { - final String id = decodingContext.getApplicationId(); - final long baseTimestamp = decodingContext.getBaseTimestamp(); - final long timestampDelta = decodingContext.getTimestampDelta(); - final long initialTimestamp = baseTimestamp + timestampDelta; - - int numValues = valueBuffer.readVInt(); - List timestamps = this.codec.decodeTimestamps(initialTimestamp, valueBuffer, numValues); - - // decode headers - final byte[] header = valueBuffer.readPrefixedBytes(); - AgentStatHeaderDecoder headerDecoder = new BitCountingHeaderDecoder(header); - JoinLongFieldEncodingStrategy jvmCpuLoadEncodingStrategy = JoinLongFieldEncodingStrategy.getFromCode(headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode()); - JoinLongFieldEncodingStrategy systemCpuLoadEncodingStrategy = JoinLongFieldEncodingStrategy.getFromCode(headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode()); - - // decode values - final List jvmCpuLoadList = this.codec.decodeValues(valueBuffer, jvmCpuLoadEncodingStrategy, numValues); - final List systemCpuLoadList = this.codec.decodeValues(valueBuffer, systemCpuLoadEncodingStrategy, numValues); - - List joinCpuLoadBoList = new ArrayList<>(numValues); - for (int i = 0; i < numValues; i++) { - JoinCpuLoadBo joinCpuLoadBo = new JoinCpuLoadBo(); - joinCpuLoadBo.setId(id); - joinCpuLoadBo.setTimestamp(timestamps.get(i)); - joinCpuLoadBo.setJvmCpuLoadJoinValue(jvmCpuLoadList.get(i).toLongFieldBo()); - joinCpuLoadBo.setSystemCpuLoadJoinValue(systemCpuLoadList.get(i).toLongFieldBo()); - joinCpuLoadBoList.add(joinCpuLoadBo); - } - return joinCpuLoadBoList; - } -} diff --git a/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/codec/stat/join/DataSourceCodec.java b/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/codec/stat/join/DataSourceCodec.java deleted file mode 100644 index c55289b3b4f1..000000000000 --- a/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/codec/stat/join/DataSourceCodec.java +++ /dev/null @@ -1,182 +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.common.server.bo.codec.stat.join; - -import com.navercorp.pinpoint.common.buffer.Buffer; -import com.navercorp.pinpoint.common.server.bo.codec.stat.AgentStatDataPointCodec; -import com.navercorp.pinpoint.common.server.bo.codec.stat.ApplicationStatCodec; -import com.navercorp.pinpoint.common.server.bo.codec.stat.header.AgentStatHeaderDecoder; -import com.navercorp.pinpoint.common.server.bo.codec.stat.header.AgentStatHeaderEncoder; -import com.navercorp.pinpoint.common.server.bo.codec.stat.header.BitCountingHeaderDecoder; -import com.navercorp.pinpoint.common.server.bo.codec.stat.header.BitCountingHeaderEncoder; -import com.navercorp.pinpoint.common.server.bo.codec.stat.strategy.JoinIntFieldEncodingStrategy; -import com.navercorp.pinpoint.common.server.bo.codec.stat.strategy.JoinIntFieldStrategyAnalyzer; -import com.navercorp.pinpoint.common.server.bo.codec.stat.strategy.StrategyAnalyzer; -import com.navercorp.pinpoint.common.server.bo.codec.stat.strategy.StringEncodingStrategy; -import com.navercorp.pinpoint.common.server.bo.codec.stat.strategy.UnsignedShortEncodingStrategy; -import com.navercorp.pinpoint.common.server.bo.codec.strategy.EncodingStrategy; -import com.navercorp.pinpoint.common.server.bo.serializer.stat.ApplicationStatDecodingContext; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinDataSourceBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinDataSourceListBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinIntFieldBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinStatBo; -import org.springframework.stereotype.Component; -import org.springframework.util.Assert; - -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -/** - * @author minwoo.jung - */ -@Component -public class DataSourceCodec implements ApplicationStatCodec { - - private static final byte VERSION = 1; - - private final AgentStatDataPointCodec codec; - - public DataSourceCodec(AgentStatDataPointCodec codec) { - this.codec = Objects.requireNonNull(codec, "codec"); - } - - @Override - public byte getVersion() { - return VERSION; - } - - @Override - public void encodeValues(Buffer valueBuffer, List joinStatBoList) { - Assert.notEmpty(joinStatBoList, "joinStatBoList"); - - final List joinDataSourceListBoList = castJoinDataSourceListBoList(joinStatBoList); - valueBuffer.putVInt(joinDataSourceListBoList.size()); - encodeTimestamps(valueBuffer, joinDataSourceListBoList); - encodeJoinDataSourceListBo(valueBuffer, joinDataSourceListBoList); - } - - private void encodeJoinDataSourceListBo(Buffer valueBuffer, List joinDataSourceListBoList) { - for (JoinDataSourceListBo joinDataSourceListBo : joinDataSourceListBoList) { - encodeJoinDataSourceBo(valueBuffer, joinDataSourceListBo.getJoinDataSourceBoList()); - } - } - - private void encodeJoinDataSourceBo(Buffer valueBuffer, List joinDataSourceBoList) { - final int numValues = joinDataSourceBoList.size(); - valueBuffer.putVInt(numValues); - - UnsignedShortEncodingStrategy.Analyzer.Builder serviceTypeAnalyzerBuilder = new UnsignedShortEncodingStrategy.Analyzer.Builder(); - StringEncodingStrategy.Analyzer.Builder jdbcUrlAnalyzerBuilder = new StringEncodingStrategy.Analyzer.Builder(); - JoinIntFieldStrategyAnalyzer.Builder activeConnectionSizeAnalyzerBuilder = new JoinIntFieldStrategyAnalyzer.Builder(); - - for (JoinDataSourceBo joinDataSourceBo : joinDataSourceBoList) { - serviceTypeAnalyzerBuilder.addValue(joinDataSourceBo.getServiceTypeCode()); - jdbcUrlAnalyzerBuilder.addValue(joinDataSourceBo.getUrl()); - activeConnectionSizeAnalyzerBuilder.addValue(joinDataSourceBo.getActiveConnectionSizeJoinValue()); - } - - StrategyAnalyzer serviceTypeAnalyzer = serviceTypeAnalyzerBuilder.build(); - StrategyAnalyzer jdbcUrlAnalyzer = jdbcUrlAnalyzerBuilder.build(); - JoinIntFieldStrategyAnalyzer activeConnectionSizeAnalyzer = activeConnectionSizeAnalyzerBuilder.build(); - - AgentStatHeaderEncoder headerEncoder = new BitCountingHeaderEncoder(); - headerEncoder.addCode(serviceTypeAnalyzer.getBestStrategy().getCode()); - headerEncoder.addCode(jdbcUrlAnalyzer.getBestStrategy().getCode()); - - final byte[] codes = activeConnectionSizeAnalyzer.getBestStrategy().getCodes(); - for (byte code : codes) { - headerEncoder.addCode(code); - } - - final byte[] header = headerEncoder.getHeader(); - valueBuffer.putPrefixedBytes(header); - - this.codec.encodeValues(valueBuffer, serviceTypeAnalyzer.getBestStrategy(), serviceTypeAnalyzer.getValues()); - this.codec.encodeValues(valueBuffer, jdbcUrlAnalyzer.getBestStrategy(), jdbcUrlAnalyzer.getValues()); - this.codec.encodeValues(valueBuffer, activeConnectionSizeAnalyzer.getBestStrategy(), activeConnectionSizeAnalyzer.getValues()); - } - - private void encodeTimestamps(Buffer valueBuffer, List joinDataSourceListBoList) { - List timestamps = new ArrayList(joinDataSourceListBoList.size()); - - for (JoinDataSourceListBo joinDataSourceListBo : joinDataSourceListBoList) { - timestamps.add(joinDataSourceListBo.getTimestamp()); - } - - codec.encodeTimestamps(valueBuffer, timestamps); - } - - private List castJoinDataSourceListBoList(List joinStatBoList) { - List joinDataSourceListBoList = new ArrayList<>(); - - for (JoinStatBo joinStatBo : joinStatBoList) { - joinDataSourceListBoList.add((JoinDataSourceListBo) joinStatBo); - } - - return joinDataSourceListBoList; - } - - @Override - public List decodeValues(Buffer valueBuffer, ApplicationStatDecodingContext decodingContext) { - final String id = decodingContext.getApplicationId(); - final long baseTimestamp = decodingContext.getBaseTimestamp(); - final long timestampDelta = decodingContext.getTimestampDelta(); - final long initialTimestamp = baseTimestamp + timestampDelta; - - int numValues = valueBuffer.readVInt(); - List timestampList = this.codec.decodeTimestamps(initialTimestamp, valueBuffer, numValues); - - List joinDataSourceListBoList = new ArrayList<>(numValues); - - for (int i = 0; i < numValues; ++i) { - JoinDataSourceListBo joinDataSourceListBo = new JoinDataSourceListBo(); - joinDataSourceListBo.setId(id); - joinDataSourceListBo.setTimestamp(timestampList.get(i)); - joinDataSourceListBo.setJoinDataSourceBoList(decodeJoinDataSourceBoList(valueBuffer)); - joinDataSourceListBoList.add(joinDataSourceListBo); - } - - return joinDataSourceListBoList; - } - - private List decodeJoinDataSourceBoList(Buffer valueBuffer) { - int numValues = valueBuffer.readVInt(); - final byte[] header = valueBuffer.readPrefixedBytes(); - AgentStatHeaderDecoder headerDecoder = new BitCountingHeaderDecoder(header); - - EncodingStrategy serviceTypeEncodingStrategy = UnsignedShortEncodingStrategy.getFromCode(headerDecoder.getCode()); - EncodingStrategy urlEncodingStrategy = StringEncodingStrategy.getFromCode(headerDecoder.getCode()); - JoinIntFieldEncodingStrategy activeConnectionSizeEncodingStrategy = JoinIntFieldEncodingStrategy.getFromCode(headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode()); - - List serviceTypeCodeList = this.codec.decodeValues(valueBuffer, serviceTypeEncodingStrategy, numValues); - List jdbcUrlList = this.codec.decodeValues(valueBuffer, urlEncodingStrategy, numValues); - final List activeConnectionSizeValueList = this.codec.decodeValues(valueBuffer, activeConnectionSizeEncodingStrategy, numValues); - - List joinDataSourceBoList = new ArrayList(numValues); - for (int i = 0; i < numValues; ++i) { - JoinDataSourceBo joinDataSourceBo = new JoinDataSourceBo(); - joinDataSourceBo.setServiceTypeCode(serviceTypeCodeList.get(i)); - joinDataSourceBo.setUrl(jdbcUrlList.get(i)); - joinDataSourceBo.setActiveConnectionSizeJoinValue(activeConnectionSizeValueList.get(i)); - joinDataSourceBoList.add(joinDataSourceBo); - } - - return joinDataSourceBoList; - } - - -} diff --git a/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/codec/stat/join/DirectBufferCodec.java b/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/codec/stat/join/DirectBufferCodec.java deleted file mode 100644 index c1bfc6ad7229..000000000000 --- a/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/codec/stat/join/DirectBufferCodec.java +++ /dev/null @@ -1,158 +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.common.server.bo.codec.stat.join; - -import com.navercorp.pinpoint.common.buffer.Buffer; -import com.navercorp.pinpoint.common.server.bo.codec.stat.AgentStatDataPointCodec; -import com.navercorp.pinpoint.common.server.bo.codec.stat.ApplicationStatCodec; -import com.navercorp.pinpoint.common.server.bo.codec.stat.header.AgentStatHeaderDecoder; -import com.navercorp.pinpoint.common.server.bo.codec.stat.header.AgentStatHeaderEncoder; -import com.navercorp.pinpoint.common.server.bo.codec.stat.header.BitCountingHeaderDecoder; -import com.navercorp.pinpoint.common.server.bo.codec.stat.header.BitCountingHeaderEncoder; -import com.navercorp.pinpoint.common.server.bo.codec.stat.strategy.JoinLongFieldEncodingStrategy; -import com.navercorp.pinpoint.common.server.bo.codec.stat.strategy.JoinLongFieldStrategyAnalyzer; -import com.navercorp.pinpoint.common.server.bo.serializer.stat.ApplicationStatDecodingContext; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinDirectBufferBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinLongFieldBo; -import org.springframework.stereotype.Component; -import org.springframework.util.Assert; - -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -/** - * @author Roy Kim - */ -@Component -public class DirectBufferCodec implements ApplicationStatCodec { - - private static final byte VERSION = 1; - - private final AgentStatDataPointCodec codec; - - public DirectBufferCodec(AgentStatDataPointCodec codec) { - this.codec = Objects.requireNonNull(codec, "codec"); - } - - @Override - public byte getVersion() { - return VERSION; - } - - @Override - public void encodeValues(Buffer valueBuffer, List joinDirectBufferBoList) { - Assert.notEmpty(joinDirectBufferBoList, "joinDirectBufferBoList"); - - final int numValues = joinDirectBufferBoList.size(); - valueBuffer.putVInt(numValues); - List timestamps = new ArrayList<>(numValues); - JoinLongFieldStrategyAnalyzer.Builder directCountAnalyzerBuilder = new JoinLongFieldStrategyAnalyzer.Builder(); - JoinLongFieldStrategyAnalyzer.Builder directMemoryUsedAnalyzerBuilder = new JoinLongFieldStrategyAnalyzer.Builder(); - JoinLongFieldStrategyAnalyzer.Builder mappedCountAnalyzerBuilder = new JoinLongFieldStrategyAnalyzer.Builder(); - JoinLongFieldStrategyAnalyzer.Builder mappedMemoryUsedAnalyzerBuilder = new JoinLongFieldStrategyAnalyzer.Builder(); - - for (JoinDirectBufferBo joinDirectBufferBo : joinDirectBufferBoList) { - timestamps.add(joinDirectBufferBo.getTimestamp()); - directCountAnalyzerBuilder.addValue(joinDirectBufferBo.getDirectCountJoinValue()); - directMemoryUsedAnalyzerBuilder.addValue(joinDirectBufferBo.getDirectMemoryUsedJoinValue()); - mappedCountAnalyzerBuilder.addValue(joinDirectBufferBo.getMappedCountJoinValue()); - mappedMemoryUsedAnalyzerBuilder.addValue(joinDirectBufferBo.getMappedMemoryUsedJoinValue()); - } - codec.encodeTimestamps(valueBuffer, timestamps); - encodeDataPoints(valueBuffer - , directCountAnalyzerBuilder.build() - , directMemoryUsedAnalyzerBuilder.build() - , mappedCountAnalyzerBuilder.build() - , mappedMemoryUsedAnalyzerBuilder.build()); - } - - private void encodeDataPoints(Buffer valueBuffer - , JoinLongFieldStrategyAnalyzer directCountAnalyzer - , JoinLongFieldStrategyAnalyzer directMemoryUsedAnalyzer - , JoinLongFieldStrategyAnalyzer mappedCountAnalyzer - , JoinLongFieldStrategyAnalyzer mappedMemoryUsedAnalyzer) { - // encode header - AgentStatHeaderEncoder headerEncoder = new BitCountingHeaderEncoder(); - - - byte[] codes = directCountAnalyzer.getBestStrategy().getCodes(); - for (byte code : codes) { - headerEncoder.addCode(code); - } - codes = directMemoryUsedAnalyzer.getBestStrategy().getCodes(); - for (byte code : codes) { - headerEncoder.addCode(code); - } - codes = mappedCountAnalyzer.getBestStrategy().getCodes(); - for (byte code : codes) { - headerEncoder.addCode(code); - } - codes = mappedMemoryUsedAnalyzer.getBestStrategy().getCodes(); - for (byte code : codes) { - headerEncoder.addCode(code); - } - - final byte[] header = headerEncoder.getHeader(); - valueBuffer.putPrefixedBytes(header); - // encode values - this.codec.encodeValues(valueBuffer, directCountAnalyzer.getBestStrategy(), directCountAnalyzer.getValues()); - this.codec.encodeValues(valueBuffer, directMemoryUsedAnalyzer.getBestStrategy(), directMemoryUsedAnalyzer.getValues()); - this.codec.encodeValues(valueBuffer, mappedCountAnalyzer.getBestStrategy(), mappedCountAnalyzer.getValues()); - this.codec.encodeValues(valueBuffer, mappedMemoryUsedAnalyzer.getBestStrategy(), mappedMemoryUsedAnalyzer.getValues()); - } - - @Override - public List decodeValues(Buffer valueBuffer, ApplicationStatDecodingContext decodingContext) { - final String id = decodingContext.getApplicationId(); - final long baseTimestamp = decodingContext.getBaseTimestamp(); - final long timestampDelta = decodingContext.getTimestampDelta(); - final long initialTimestamp = baseTimestamp + timestampDelta; - - int numValues = valueBuffer.readVInt(); - List timestamps = this.codec.decodeTimestamps(initialTimestamp, valueBuffer, numValues); - - // decode headers - final byte[] header = valueBuffer.readPrefixedBytes(); - AgentStatHeaderDecoder headerDecoder = new BitCountingHeaderDecoder(header); - - JoinLongFieldEncodingStrategy directCountEncodingStrategy = JoinLongFieldEncodingStrategy.getFromCode(headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode()); - JoinLongFieldEncodingStrategy directMemoryUsedEncodingStrategy = JoinLongFieldEncodingStrategy.getFromCode(headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode()); - JoinLongFieldEncodingStrategy mappedCountEncodingStrategy = JoinLongFieldEncodingStrategy.getFromCode(headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode()); - JoinLongFieldEncodingStrategy mappedMemoryUsedEncodingStrategy = JoinLongFieldEncodingStrategy.getFromCode(headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode()); - - // decode values - List directCountList = this.codec.decodeValues(valueBuffer, directCountEncodingStrategy, numValues); - List directMemoryUsedList = this.codec.decodeValues(valueBuffer, directMemoryUsedEncodingStrategy, numValues); - List mappedCountList = this.codec.decodeValues(valueBuffer, mappedCountEncodingStrategy, numValues); - List mappedMemoryUsedList = this.codec.decodeValues(valueBuffer, mappedMemoryUsedEncodingStrategy, numValues); - - List joinDirectBufferBoList = new ArrayList<>(numValues); - for (int i = 0; i < numValues; i++) { - JoinDirectBufferBo joinDirectBufferBo = new JoinDirectBufferBo(); - joinDirectBufferBo.setId(id); - joinDirectBufferBo.setTimestamp(timestamps.get(i)); - - joinDirectBufferBo.setDirectCountJoinValue(directCountList.get(i)); - joinDirectBufferBo.setDirectMemoryUsedJoinValue(directMemoryUsedList.get(i)); - joinDirectBufferBo.setMappedCountJoinValue(mappedCountList.get(i)); - joinDirectBufferBo.setMappedMemoryUsedJoinValue(mappedMemoryUsedList.get(i)); - - joinDirectBufferBoList.add(joinDirectBufferBo); - } - return joinDirectBufferBoList; - } -} diff --git a/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/codec/stat/join/FileDescriptorCodec.java b/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/codec/stat/join/FileDescriptorCodec.java deleted file mode 100644 index 9425fd04bc55..000000000000 --- a/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/codec/stat/join/FileDescriptorCodec.java +++ /dev/null @@ -1,116 +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.common.server.bo.codec.stat.join; - -import com.navercorp.pinpoint.common.buffer.Buffer; -import com.navercorp.pinpoint.common.server.bo.codec.stat.AgentStatDataPointCodec; -import com.navercorp.pinpoint.common.server.bo.codec.stat.ApplicationStatCodec; -import com.navercorp.pinpoint.common.server.bo.codec.stat.header.AgentStatHeaderDecoder; -import com.navercorp.pinpoint.common.server.bo.codec.stat.header.AgentStatHeaderEncoder; -import com.navercorp.pinpoint.common.server.bo.codec.stat.header.BitCountingHeaderDecoder; -import com.navercorp.pinpoint.common.server.bo.codec.stat.header.BitCountingHeaderEncoder; -import com.navercorp.pinpoint.common.server.bo.codec.stat.strategy.JoinLongFieldEncodingStrategy; -import com.navercorp.pinpoint.common.server.bo.codec.stat.strategy.JoinLongFieldStrategyAnalyzer; -import com.navercorp.pinpoint.common.server.bo.serializer.stat.ApplicationStatDecodingContext; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinFileDescriptorBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinLongFieldBo; -import org.springframework.stereotype.Component; -import org.springframework.util.Assert; - -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -/** - * @author Roy Kim - */ -@Component -public class FileDescriptorCodec implements ApplicationStatCodec { - - private static final byte VERSION = 1; - - private final AgentStatDataPointCodec codec; - - public FileDescriptorCodec(AgentStatDataPointCodec codec) { - this.codec = Objects.requireNonNull(codec, "codec"); - } - - @Override - public byte getVersion() { - return VERSION; - } - - @Override - public void encodeValues(Buffer valueBuffer, List joinFileDescriptorBoList) { - Assert.notEmpty(joinFileDescriptorBoList, "joinFileDescriptorBoList"); - - final int numValues = joinFileDescriptorBoList.size(); - valueBuffer.putVInt(numValues); - List timestamps = new ArrayList<>(numValues); - JoinLongFieldStrategyAnalyzer.Builder openFileDescriptorCountAnalyzerBuilder = new JoinLongFieldStrategyAnalyzer.Builder(); - - for (JoinFileDescriptorBo joinFileDescriptorBo : joinFileDescriptorBoList) { - timestamps.add(joinFileDescriptorBo.getTimestamp()); - openFileDescriptorCountAnalyzerBuilder.addValue(joinFileDescriptorBo.getOpenFdCountJoinValue()); - } - codec.encodeTimestamps(valueBuffer, timestamps); - encodeDataPoints(valueBuffer, openFileDescriptorCountAnalyzerBuilder.build()); - } - - private void encodeDataPoints(Buffer valueBuffer, JoinLongFieldStrategyAnalyzer openFileDescriptorCountAnalyzer) { - // encode header - AgentStatHeaderEncoder headerEncoder = new BitCountingHeaderEncoder(); - - final byte[] codes = openFileDescriptorCountAnalyzer.getBestStrategy().getCodes(); - for (byte code : codes) { - headerEncoder.addCode(code); - } - - final byte[] header = headerEncoder.getHeader(); - valueBuffer.putPrefixedBytes(header); - // encode values - this.codec.encodeValues(valueBuffer, openFileDescriptorCountAnalyzer.getBestStrategy(), openFileDescriptorCountAnalyzer.getValues()); - } - - @Override - public List decodeValues(Buffer valueBuffer, ApplicationStatDecodingContext decodingContext) { - final String id = decodingContext.getApplicationId(); - final long baseTimestamp = decodingContext.getBaseTimestamp(); - final long timestampDelta = decodingContext.getTimestampDelta(); - final long initialTimestamp = baseTimestamp + timestampDelta; - - int numValues = valueBuffer.readVInt(); - List timestamps = this.codec.decodeTimestamps(initialTimestamp, valueBuffer, numValues); - - // decode headers - final byte[] header = valueBuffer.readPrefixedBytes(); - AgentStatHeaderDecoder headerDecoder = new BitCountingHeaderDecoder(header); - JoinLongFieldEncodingStrategy openFileDescriptorCountEncodingStrategy = JoinLongFieldEncodingStrategy.getFromCode(headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode()); - - // decode values - final List openFileDescriptorCounts = this.codec.decodeValues(valueBuffer, openFileDescriptorCountEncodingStrategy, numValues); - - List joinFileDescriptorBoList = new ArrayList<>(numValues); - for (int i = 0; i < numValues; i++) { - JoinFileDescriptorBo joinFileDescriptorBo = new JoinFileDescriptorBo(); - joinFileDescriptorBo.setId(id); - joinFileDescriptorBo.setTimestamp(timestamps.get(i)); - joinFileDescriptorBo.setOpenFdCountJoinValue(openFileDescriptorCounts.get(i)); - joinFileDescriptorBoList.add(joinFileDescriptorBo); - } - return joinFileDescriptorBoList; - } -} diff --git a/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/codec/stat/join/LoadedClassCodec.java b/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/codec/stat/join/LoadedClassCodec.java deleted file mode 100644 index 2c076a13f87b..000000000000 --- a/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/codec/stat/join/LoadedClassCodec.java +++ /dev/null @@ -1,128 +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.common.server.bo.codec.stat.join; - -import com.navercorp.pinpoint.common.buffer.Buffer; -import com.navercorp.pinpoint.common.server.bo.codec.stat.AgentStatDataPointCodec; -import com.navercorp.pinpoint.common.server.bo.codec.stat.ApplicationStatCodec; -import com.navercorp.pinpoint.common.server.bo.codec.stat.header.AgentStatHeaderDecoder; -import com.navercorp.pinpoint.common.server.bo.codec.stat.header.AgentStatHeaderEncoder; -import com.navercorp.pinpoint.common.server.bo.codec.stat.header.BitCountingHeaderDecoder; -import com.navercorp.pinpoint.common.server.bo.codec.stat.header.BitCountingHeaderEncoder; -import com.navercorp.pinpoint.common.server.bo.codec.stat.strategy.JoinLongFieldEncodingStrategy; -import com.navercorp.pinpoint.common.server.bo.codec.stat.strategy.JoinLongFieldStrategyAnalyzer; -import com.navercorp.pinpoint.common.server.bo.serializer.stat.ApplicationStatDecodingContext; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinLoadedClassBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinLongFieldBo; -import org.springframework.stereotype.Component; -import org.springframework.util.Assert; - -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -@Component -public class LoadedClassCodec implements ApplicationStatCodec { - private static final byte VERSION = 1; - - private final AgentStatDataPointCodec codec; - - public LoadedClassCodec(AgentStatDataPointCodec codec) { - this.codec = Objects.requireNonNull(codec, "codec"); - } - - @Override - public byte getVersion() { - return VERSION; - } - - @Override - public void encodeValues(Buffer valueBuffer, List joinStatBoList) { - Assert.notEmpty(joinStatBoList, "joinStatBoList"); - - final int numValues = joinStatBoList.size(); - valueBuffer.putVInt(numValues); - List timestamps = new ArrayList<>(numValues); - JoinLongFieldStrategyAnalyzer.Builder loadedClassAnalyzerBuilder = new JoinLongFieldStrategyAnalyzer.Builder(); - JoinLongFieldStrategyAnalyzer.Builder unloadedClassAnalyzerBuilder = new JoinLongFieldStrategyAnalyzer.Builder(); - - for (JoinLoadedClassBo joinLoadedClassBo : joinStatBoList) { - timestamps.add(joinLoadedClassBo.getTimestamp()); - loadedClassAnalyzerBuilder.addValue(joinLoadedClassBo.getLoadedClassJoinValue()); - unloadedClassAnalyzerBuilder.addValue(joinLoadedClassBo.getUnloadedClassJoinValue()); - } - - codec.encodeTimestamps(valueBuffer, timestamps); - - encodeDataPoints(valueBuffer, loadedClassAnalyzerBuilder.build(), unloadedClassAnalyzerBuilder.build()); - } - - private void encodeDataPoints(Buffer valueBuffer, JoinLongFieldStrategyAnalyzer loadedClassAnalyzer, JoinLongFieldStrategyAnalyzer unloadedClassAnalyzer) { - // encode header - AgentStatHeaderEncoder headerEncoder = new BitCountingHeaderEncoder(); - - byte[] codes = loadedClassAnalyzer.getBestStrategy().getCodes(); - for (byte code : codes) { - headerEncoder.addCode(code); - } - codes = unloadedClassAnalyzer.getBestStrategy().getCodes(); - for (byte code : codes) { - headerEncoder.addCode(code); - } - - - final byte[] header = headerEncoder.getHeader(); - valueBuffer.putPrefixedBytes(header); - // encode values - this.codec.encodeValues(valueBuffer, loadedClassAnalyzer.getBestStrategy(), loadedClassAnalyzer.getValues()); - this.codec.encodeValues(valueBuffer, unloadedClassAnalyzer.getBestStrategy(), unloadedClassAnalyzer.getValues()); - } - - @Override - public List decodeValues(Buffer valueBuffer, ApplicationStatDecodingContext decodingContext) { - final String id = decodingContext.getApplicationId(); - final long baseTimestamp = decodingContext.getBaseTimestamp(); - final long timestampDelta = decodingContext.getTimestampDelta(); - final long initialTimestamp = baseTimestamp + timestampDelta; - - int numValues = valueBuffer.readVInt(); - List timestamps = this.codec.decodeTimestamps(initialTimestamp, valueBuffer, numValues); - - // decode headers - final byte[] header = valueBuffer.readPrefixedBytes(); - AgentStatHeaderDecoder headerDecoder = new BitCountingHeaderDecoder(header); - JoinLongFieldEncodingStrategy loadedClassEncodingStrategy = JoinLongFieldEncodingStrategy.getFromCode(headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode()); - JoinLongFieldEncodingStrategy unloadedClassEncodingStrategy = JoinLongFieldEncodingStrategy.getFromCode(headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode()); - - // decode values - List loadedClassList = this.codec.decodeValues(valueBuffer, loadedClassEncodingStrategy, numValues); - List unloadedClassList = this.codec.decodeValues(valueBuffer, unloadedClassEncodingStrategy, numValues); - - List joinLoadedClassBoList = new ArrayList<>(numValues); - for (int i = 0; i < numValues; i++) { - JoinLoadedClassBo joinLoadedClassBo = new JoinLoadedClassBo(); - joinLoadedClassBo.setId(id); - joinLoadedClassBo.setTimestamp(timestamps.get(i)); - - joinLoadedClassBo.setLoadedClassJoinValue(loadedClassList.get(i)); - joinLoadedClassBo.setUnloadedClassJoinValue(unloadedClassList.get(i)); - - joinLoadedClassBoList.add(joinLoadedClassBo); - } - return joinLoadedClassBoList; - } -} diff --git a/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/codec/stat/join/MemoryCodec.java b/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/codec/stat/join/MemoryCodec.java deleted file mode 100644 index 5a674d80e4ef..000000000000 --- a/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/codec/stat/join/MemoryCodec.java +++ /dev/null @@ -1,127 +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.common.server.bo.codec.stat.join; - -import com.navercorp.pinpoint.common.buffer.Buffer; -import com.navercorp.pinpoint.common.server.bo.codec.stat.AgentStatDataPointCodec; -import com.navercorp.pinpoint.common.server.bo.codec.stat.ApplicationStatCodec; -import com.navercorp.pinpoint.common.server.bo.codec.stat.header.AgentStatHeaderDecoder; -import com.navercorp.pinpoint.common.server.bo.codec.stat.header.AgentStatHeaderEncoder; -import com.navercorp.pinpoint.common.server.bo.codec.stat.header.BitCountingHeaderDecoder; -import com.navercorp.pinpoint.common.server.bo.codec.stat.header.BitCountingHeaderEncoder; -import com.navercorp.pinpoint.common.server.bo.codec.stat.strategy.JoinLongFieldEncodingStrategy; -import com.navercorp.pinpoint.common.server.bo.codec.stat.strategy.JoinLongFieldStrategyAnalyzer; -import com.navercorp.pinpoint.common.server.bo.serializer.stat.ApplicationStatDecodingContext; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinLongFieldBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinMemoryBo; -import org.springframework.stereotype.Component; -import org.springframework.util.Assert; - -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -/** - * @author minwoo.jung - */ -@Component -public class MemoryCodec implements ApplicationStatCodec { - private static final byte VERSION = 1; - - private final AgentStatDataPointCodec codec; - - public MemoryCodec(AgentStatDataPointCodec codec) { - this.codec = Objects.requireNonNull(codec, "codec"); - } - - @Override - public byte getVersion() { - return VERSION; - } - - public void encodeValues(Buffer valueBuffer, List joinMemoryBoList) { - Assert.notEmpty(joinMemoryBoList, "joinMemoryBoList"); - - final int numValues = joinMemoryBoList.size(); - valueBuffer.putVInt(numValues); - List timestamps = new ArrayList<>(numValues); - JoinLongFieldStrategyAnalyzer.Builder heapUsedAnalyzerBuilder = new JoinLongFieldStrategyAnalyzer.Builder(); - JoinLongFieldStrategyAnalyzer.Builder nonHeapUsedAnalyzerBuilder = new JoinLongFieldStrategyAnalyzer.Builder(); - - for (JoinMemoryBo joinMemoryBo : joinMemoryBoList) { - timestamps.add(joinMemoryBo.getTimestamp()); - heapUsedAnalyzerBuilder.addValue(joinMemoryBo.getHeapUsedJoinValue()); - nonHeapUsedAnalyzerBuilder.addValue(joinMemoryBo.getNonHeapUsedJoinValue()); - } - - codec.encodeTimestamps(valueBuffer, timestamps); - encodeDataPoints(valueBuffer, heapUsedAnalyzerBuilder.build(), nonHeapUsedAnalyzerBuilder.build()); - } - - private void encodeDataPoints(Buffer valueBuffer, - JoinLongFieldStrategyAnalyzer heapUsedStrategyAnalyzer, - JoinLongFieldStrategyAnalyzer nonHeapUsedStrategyAnalyzer) { - // encode header - AgentStatHeaderEncoder headerEncoder = new BitCountingHeaderEncoder(); - byte[] codes = heapUsedStrategyAnalyzer.getBestStrategy().getCodes(); - for (byte code : codes) { - headerEncoder.addCode(code); - } - codes = nonHeapUsedStrategyAnalyzer.getBestStrategy().getCodes(); - for (byte code : codes) { - headerEncoder.addCode(code); - } - - final byte[] header = headerEncoder.getHeader(); - valueBuffer.putPrefixedBytes(header); - // encode values - this.codec.encodeValues(valueBuffer, heapUsedStrategyAnalyzer.getBestStrategy(), heapUsedStrategyAnalyzer.getValues()); - this.codec.encodeValues(valueBuffer, nonHeapUsedStrategyAnalyzer.getBestStrategy(), nonHeapUsedStrategyAnalyzer.getValues()); - } - - @Override - public List decodeValues(Buffer valueBuffer, ApplicationStatDecodingContext decodingContext) { - final String id = decodingContext.getApplicationId(); - final long baseTimestamp = decodingContext.getBaseTimestamp(); - final long timestampDelta = decodingContext.getTimestampDelta(); - final long initialTimestamp = baseTimestamp + timestampDelta; - - int numValues = valueBuffer.readVInt(); - List timestamps = this.codec.decodeTimestamps(initialTimestamp, valueBuffer, numValues); - - // decode headers - final byte[] header = valueBuffer.readPrefixedBytes(); - AgentStatHeaderDecoder headerDecoder = new BitCountingHeaderDecoder(header); - JoinLongFieldEncodingStrategy heapUsedEncodingStrategy = JoinLongFieldEncodingStrategy.getFromCode(headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode()); - JoinLongFieldEncodingStrategy nonHeapUsedEncodingStrategy = JoinLongFieldEncodingStrategy.getFromCode(headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode()); - - // decode values - final List heapUsedList = this.codec.decodeValues(valueBuffer, heapUsedEncodingStrategy, numValues); - final List nonHeapUsedList = this.codec.decodeValues(valueBuffer, nonHeapUsedEncodingStrategy, numValues); - - List joinMemoryBoList = new ArrayList<>(numValues); - for (int i = 0; i < numValues; i++) { - JoinMemoryBo joinMemoryBo = new JoinMemoryBo(); - joinMemoryBo.setId(id); - joinMemoryBo.setTimestamp(timestamps.get(i)); - joinMemoryBo.setHeapUsedJoinValue(heapUsedList.get(i)); - joinMemoryBo.setNonHeapUsedJoinValue(nonHeapUsedList.get(i)); - joinMemoryBoList.add(joinMemoryBo); - } - - return joinMemoryBoList; - } -} diff --git a/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/codec/stat/join/ResponseTimeCodec.java b/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/codec/stat/join/ResponseTimeCodec.java deleted file mode 100644 index 89a36e6cba4a..000000000000 --- a/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/codec/stat/join/ResponseTimeCodec.java +++ /dev/null @@ -1,115 +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.common.server.bo.codec.stat.join; - -import com.navercorp.pinpoint.common.buffer.Buffer; -import com.navercorp.pinpoint.common.server.bo.codec.stat.AgentStatDataPointCodec; -import com.navercorp.pinpoint.common.server.bo.codec.stat.ApplicationStatCodec; -import com.navercorp.pinpoint.common.server.bo.codec.stat.header.AgentStatHeaderDecoder; -import com.navercorp.pinpoint.common.server.bo.codec.stat.header.AgentStatHeaderEncoder; -import com.navercorp.pinpoint.common.server.bo.codec.stat.header.BitCountingHeaderDecoder; -import com.navercorp.pinpoint.common.server.bo.codec.stat.header.BitCountingHeaderEncoder; -import com.navercorp.pinpoint.common.server.bo.codec.stat.strategy.JoinLongFieldEncodingStrategy; -import com.navercorp.pinpoint.common.server.bo.codec.stat.strategy.JoinLongFieldStrategyAnalyzer; -import com.navercorp.pinpoint.common.server.bo.serializer.stat.ApplicationStatDecodingContext; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinLongFieldBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinResponseTimeBo; -import org.springframework.stereotype.Component; -import org.springframework.util.Assert; - -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -/** - * @author minwoo.jung - */ -@Component -public class ResponseTimeCodec implements ApplicationStatCodec { - private static final byte VERSION = 1; - - private final AgentStatDataPointCodec codec; - - public ResponseTimeCodec(AgentStatDataPointCodec codec) { - this.codec = Objects.requireNonNull(codec, "codec"); - } - - - @Override - public byte getVersion() { - return VERSION; - } - - @Override - public void encodeValues(Buffer valueBuffer, List joinResponseTimeBoList) { - Assert.notEmpty(joinResponseTimeBoList, "joinResponseTimeBoList"); - - final int numValues = joinResponseTimeBoList.size(); - valueBuffer.putVInt(numValues); - List timestamps = new ArrayList(numValues); - JoinLongFieldStrategyAnalyzer.Builder responseTimeAnalyzerBuilder = new JoinLongFieldStrategyAnalyzer.Builder(); - - for (JoinResponseTimeBo joinResponseTimeBo : joinResponseTimeBoList) { - timestamps.add(joinResponseTimeBo.getTimestamp()); - responseTimeAnalyzerBuilder.addValue(joinResponseTimeBo.getResponseTimeJoinValue()); - } - - codec.encodeTimestamps(valueBuffer, timestamps); - encodeDataPoints(valueBuffer, responseTimeAnalyzerBuilder.build()); - } - - private void encodeDataPoints(Buffer valueBuffer, JoinLongFieldStrategyAnalyzer responseTimeAnalyzer) { - AgentStatHeaderEncoder headerEncoder = new BitCountingHeaderEncoder(); - - final byte[] codes = responseTimeAnalyzer.getBestStrategy().getCodes(); - for (byte code : codes) { - headerEncoder.addCode(code); - } - - final byte[] header = headerEncoder.getHeader(); - valueBuffer.putPrefixedBytes(header); - - this.codec.encodeValues(valueBuffer, responseTimeAnalyzer.getBestStrategy(), responseTimeAnalyzer.getValues()); - } - - @Override - public List decodeValues(Buffer valueBuffer, ApplicationStatDecodingContext decodingContext) { - final String id = decodingContext.getApplicationId(); - final long baseTimestamp = decodingContext.getBaseTimestamp(); - final long timestampDelta = decodingContext.getTimestampDelta(); - final long initialTimestamp = baseTimestamp + timestampDelta; - - int numValues = valueBuffer.readVInt(); - List timestampList = this.codec.decodeTimestamps(initialTimestamp, valueBuffer, numValues); - - final byte[] header = valueBuffer.readPrefixedBytes(); - AgentStatHeaderDecoder headerDecoder = new BitCountingHeaderDecoder(header); - JoinLongFieldEncodingStrategy responseTimeEncodingStrategy = JoinLongFieldEncodingStrategy.getFromCode(headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode()); - - final List responseTimeList = this.codec.decodeValues(valueBuffer, responseTimeEncodingStrategy, numValues); - - List joinResponseTimeBoList = new ArrayList<>(); - for (int i = 0 ; i < numValues ; i++) { - JoinResponseTimeBo joinResponseTimeBo = new JoinResponseTimeBo(); - joinResponseTimeBo.setId(id); - joinResponseTimeBo.setTimestamp(timestampList.get(i)); - joinResponseTimeBo.setResponseTimeJoinValue(responseTimeList.get(i)); - joinResponseTimeBoList.add(joinResponseTimeBo); - } - - return joinResponseTimeBoList; - } -} diff --git a/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/codec/stat/join/TotalThreadCountCodec.java b/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/codec/stat/join/TotalThreadCountCodec.java deleted file mode 100644 index 5dc7bfceb513..000000000000 --- a/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/codec/stat/join/TotalThreadCountCodec.java +++ /dev/null @@ -1,110 +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.common.server.bo.codec.stat.join; - -import com.navercorp.pinpoint.common.buffer.Buffer; -import com.navercorp.pinpoint.common.server.bo.codec.stat.AgentStatDataPointCodec; -import com.navercorp.pinpoint.common.server.bo.codec.stat.ApplicationStatCodec; -import com.navercorp.pinpoint.common.server.bo.codec.stat.header.AgentStatHeaderDecoder; -import com.navercorp.pinpoint.common.server.bo.codec.stat.header.AgentStatHeaderEncoder; -import com.navercorp.pinpoint.common.server.bo.codec.stat.header.BitCountingHeaderDecoder; -import com.navercorp.pinpoint.common.server.bo.codec.stat.header.BitCountingHeaderEncoder; -import com.navercorp.pinpoint.common.server.bo.codec.stat.strategy.JoinLongFieldEncodingStrategy; -import com.navercorp.pinpoint.common.server.bo.codec.stat.strategy.JoinLongFieldStrategyAnalyzer; -import com.navercorp.pinpoint.common.server.bo.serializer.stat.ApplicationStatDecodingContext; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinLongFieldBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinTotalThreadCountBo; -import org.springframework.stereotype.Component; -import org.springframework.util.Assert; - -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -@Component -public class TotalThreadCountCodec implements ApplicationStatCodec { - private static final byte VERSION = 1; - - private final AgentStatDataPointCodec codec; - - public TotalThreadCountCodec(AgentStatDataPointCodec codec) { - this.codec = Objects.requireNonNull(codec, "codec"); - } - - @Override - public byte getVersion() { return VERSION; } - - @Override - public void encodeValues(Buffer valueBuffer, List joinTotalThreadCountBoList) { - Assert.notEmpty(joinTotalThreadCountBoList, "joinTotalThreadCountBoList"); - - final int numValues = joinTotalThreadCountBoList.size(); - valueBuffer.putVInt(numValues); - List timestamps = new ArrayList<>(numValues); - JoinLongFieldStrategyAnalyzer.Builder totalThreadCountAnalyzerBuilder = new JoinLongFieldStrategyAnalyzer.Builder(); - - for (JoinTotalThreadCountBo joinTotalThreadCountBo : joinTotalThreadCountBoList) { - timestamps.add(joinTotalThreadCountBo.getTimestamp()); - totalThreadCountAnalyzerBuilder.addValue(joinTotalThreadCountBo.getTotalThreadCountJoinValue()); - - } - codec.encodeTimestamps(valueBuffer, timestamps); - encodeDataPoints(valueBuffer, totalThreadCountAnalyzerBuilder.build()); - } - - private void encodeDataPoints(Buffer valueBuffer, JoinLongFieldStrategyAnalyzer totalThreadCountAnalyzer) { - AgentStatHeaderEncoder headerEncoder = new BitCountingHeaderEncoder(); - - final byte[] codes = totalThreadCountAnalyzer.getBestStrategy().getCodes(); - for (byte code : codes) { - headerEncoder.addCode(code); - } - - final byte[] header = headerEncoder.getHeader(); - valueBuffer.putPrefixedBytes(header); - - this.codec.encodeValues(valueBuffer, totalThreadCountAnalyzer.getBestStrategy(), totalThreadCountAnalyzer.getValues()); - } - - @Override - public List decodeValues(Buffer valueBuffer, ApplicationStatDecodingContext decodingContext) { - final String id = decodingContext.getApplicationId(); - final long baseTimestamp = decodingContext.getBaseTimestamp(); - final long timestampDelta = decodingContext.getTimestampDelta(); - final long initialTimestamp = baseTimestamp + timestampDelta; - - int numValues = valueBuffer.readVInt(); - List timestampList = this.codec.decodeTimestamps(initialTimestamp, valueBuffer, numValues); - - final byte[] header = valueBuffer.readPrefixedBytes(); - AgentStatHeaderDecoder headerDecoder = new BitCountingHeaderDecoder(header); - JoinLongFieldEncodingStrategy totalThreadCountEncodingStrategy = JoinLongFieldEncodingStrategy.getFromCode(headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode()); - - final List totalThreadCountList = this.codec.decodeValues(valueBuffer, totalThreadCountEncodingStrategy, numValues); - - List joinTotalThreadCountBoList = new ArrayList<>(); - for (int i = 0 ; i < numValues ; i++) { - JoinTotalThreadCountBo joinTotalThreadCountBo = new JoinTotalThreadCountBo(); - joinTotalThreadCountBo.setId(id); - joinTotalThreadCountBo.setTimestamp(timestampList.get(i)); - joinTotalThreadCountBo.setTotalThreadCountJoinValue(totalThreadCountList.get(i)); - joinTotalThreadCountBoList.add(joinTotalThreadCountBo); - } - - return joinTotalThreadCountBoList; - } -} diff --git a/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/codec/stat/join/TransactionCodec.java b/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/codec/stat/join/TransactionCodec.java deleted file mode 100644 index 4af8c8bc0e6e..000000000000 --- a/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/codec/stat/join/TransactionCodec.java +++ /dev/null @@ -1,126 +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.common.server.bo.codec.stat.join; - -import com.navercorp.pinpoint.common.buffer.Buffer; -import com.navercorp.pinpoint.common.server.bo.codec.stat.AgentStatDataPointCodec; -import com.navercorp.pinpoint.common.server.bo.codec.stat.ApplicationStatCodec; -import com.navercorp.pinpoint.common.server.bo.codec.stat.header.AgentStatHeaderDecoder; -import com.navercorp.pinpoint.common.server.bo.codec.stat.header.AgentStatHeaderEncoder; -import com.navercorp.pinpoint.common.server.bo.codec.stat.header.BitCountingHeaderDecoder; -import com.navercorp.pinpoint.common.server.bo.codec.stat.header.BitCountingHeaderEncoder; -import com.navercorp.pinpoint.common.server.bo.codec.stat.strategy.JoinLongFieldEncodingStrategy; -import com.navercorp.pinpoint.common.server.bo.codec.stat.strategy.JoinLongFieldStrategyAnalyzer; -import com.navercorp.pinpoint.common.server.bo.codec.stat.strategy.StrategyAnalyzer; -import com.navercorp.pinpoint.common.server.bo.codec.stat.strategy.UnsignedLongEncodingStrategy; -import com.navercorp.pinpoint.common.server.bo.codec.strategy.EncodingStrategy; -import com.navercorp.pinpoint.common.server.bo.serializer.stat.ApplicationStatDecodingContext; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinLongFieldBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinTransactionBo; -import org.springframework.stereotype.Component; -import org.springframework.util.Assert; - -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -/** - * @author minwoo.jung - */ -@Component -public class TransactionCodec implements ApplicationStatCodec { - private static final byte VERSION = 1; - - private final AgentStatDataPointCodec codec; - - public TransactionCodec(AgentStatDataPointCodec codec) { - this.codec = Objects.requireNonNull(codec, "codec"); - } - - @Override - public void encodeValues(Buffer valueBuffer, List joinTransactionBoList) { - Assert.notEmpty(joinTransactionBoList, "joinTransactionBoList"); - - final int numValues = joinTransactionBoList.size(); - valueBuffer.putVInt(numValues); - List timestamps = new ArrayList<>(numValues); - UnsignedLongEncodingStrategy.Analyzer.Builder collectIntervalAnalyzerBuilder = new UnsignedLongEncodingStrategy.Analyzer.Builder(); - JoinLongFieldStrategyAnalyzer.Builder totalCountAnalyzerBuilder = new JoinLongFieldStrategyAnalyzer.Builder(); - - for (JoinTransactionBo joinTransactionBo : joinTransactionBoList) { - timestamps.add(joinTransactionBo.getTimestamp()); - collectIntervalAnalyzerBuilder.addValue(joinTransactionBo.getCollectInterval()); - totalCountAnalyzerBuilder.addValue(joinTransactionBo.getTotalCountJoinValue()); - } - - codec.encodeTimestamps(valueBuffer, timestamps); - encodeDataPoints(valueBuffer, collectIntervalAnalyzerBuilder.build(), totalCountAnalyzerBuilder.build()); - } - - private void encodeDataPoints(Buffer valueBuffer, StrategyAnalyzer collectIntervalAnalyzer, JoinLongFieldStrategyAnalyzer totalCountAnalyzer) { - AgentStatHeaderEncoder headerEncoder = new BitCountingHeaderEncoder(); - headerEncoder.addCode(collectIntervalAnalyzer.getBestStrategy().getCode()); - - final byte[] codes = totalCountAnalyzer.getBestStrategy().getCodes(); - for (byte code : codes) { - headerEncoder.addCode(code); - } - - final byte[] header = headerEncoder.getHeader(); - valueBuffer.putPrefixedBytes(header); - - this.codec.encodeValues(valueBuffer, collectIntervalAnalyzer.getBestStrategy(), collectIntervalAnalyzer.getValues()); - this.codec.encodeValues(valueBuffer, totalCountAnalyzer.getBestStrategy(), totalCountAnalyzer.getValues()); - } - - @Override - public List decodeValues(Buffer valueBuffer, ApplicationStatDecodingContext decodingContext) { - final String id = decodingContext.getApplicationId(); - final long baseTimestamp = decodingContext.getBaseTimestamp(); - final long timestampDelta = decodingContext.getTimestampDelta(); - final long initialTimestamp = baseTimestamp + timestampDelta; - - int numValues = valueBuffer.readVInt(); - List timestampList = this.codec.decodeTimestamps(initialTimestamp, valueBuffer, numValues); - - // decode headers - final byte[] header = valueBuffer.readPrefixedBytes(); - AgentStatHeaderDecoder headerDecoder = new BitCountingHeaderDecoder(header); - EncodingStrategy collectIntervalEncodingStrategy = UnsignedLongEncodingStrategy.getFromCode(headerDecoder.getCode()); - - JoinLongFieldEncodingStrategy totalCountEncodingStrategy = JoinLongFieldEncodingStrategy.getFromCode(headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode(), headerDecoder.getCode()); - - List collectIntervalList = this.codec.decodeValues(valueBuffer, collectIntervalEncodingStrategy, numValues); - final List totalCountList = this.codec.decodeValues(valueBuffer, totalCountEncodingStrategy, numValues); - - List joinTransactionBoList = new ArrayList<>(); - for (int i = 0 ; i < numValues ; i++) { - JoinTransactionBo joinTransactionBo = new JoinTransactionBo(); - joinTransactionBo.setId(id); - joinTransactionBo.setTimestamp(timestampList.get(i)); - joinTransactionBo.setCollectInterval(collectIntervalList.get(i)); - joinTransactionBo.setTotalCountJoinValue(totalCountList.get(i)); - joinTransactionBoList.add(joinTransactionBo); - } - - return joinTransactionBoList; - } - - @Override - public byte getVersion() { - return VERSION; - } -} diff --git a/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/codec/stat/strategy/JoinEncodingStrategy.java b/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/codec/stat/strategy/JoinEncodingStrategy.java deleted file mode 100644 index 33fcadfd6776..000000000000 --- a/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/codec/stat/strategy/JoinEncodingStrategy.java +++ /dev/null @@ -1,42 +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.common.server.bo.codec.stat.strategy; - -import com.navercorp.pinpoint.common.server.bo.codec.strategy.EncodingStrategy; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinFieldBo; - -import java.util.List; -import java.util.function.Function; -import java.util.stream.Collectors; - -/** - * @author Taejin Koo - */ -public interface JoinEncodingStrategy> extends EncodingStrategy { - - byte[] getCodes(); - - @Deprecated - byte getCode(); - - default List mapping(List values, Function mapper) { - return values.stream() - .map(mapper) - .collect(Collectors.toList()); - } - -} diff --git a/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/codec/stat/strategy/JoinFieldStrategyAnalyzer.java b/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/codec/stat/strategy/JoinFieldStrategyAnalyzer.java deleted file mode 100644 index 0ddc24d7c803..000000000000 --- a/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/codec/stat/strategy/JoinFieldStrategyAnalyzer.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.common.server.bo.codec.stat.strategy; - -import com.navercorp.pinpoint.common.server.bo.codec.strategy.EncodingStrategy; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinFieldBo; - -import java.util.List; - -/** - * @author Taejin Koo - */ -public interface JoinFieldStrategyAnalyzer> { - - EncodingStrategy getBestStrategy(); - - List getValues(); - - interface JoinFieldStrategyAnalyzerBuilder> { - - JoinFieldStrategyAnalyzerBuilder addValue(T value); - - JoinFieldStrategyAnalyzer build(); - } - -} - diff --git a/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/codec/stat/strategy/JoinIntFieldEncodingStrategy.java b/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/codec/stat/strategy/JoinIntFieldEncodingStrategy.java deleted file mode 100644 index 12b13742110f..000000000000 --- a/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/codec/stat/strategy/JoinIntFieldEncodingStrategy.java +++ /dev/null @@ -1,131 +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.common.server.bo.codec.stat.strategy; - -import com.navercorp.pinpoint.common.buffer.Buffer; -import com.navercorp.pinpoint.common.server.bo.codec.strategy.EncodingStrategy; -import com.navercorp.pinpoint.common.server.bo.stat.join.AbstractJoinFieldBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinIntFieldBo; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Objects; - -/** - * @author Taejin Koo - */ -public class JoinIntFieldEncodingStrategy implements JoinEncodingStrategy { - - private final EncodingStrategy avgValueStrategy; - private final EncodingStrategy minValueStrategy; - private final EncodingStrategy minAgentIdStrategy; - private final EncodingStrategy maxValueStrategy; - private final EncodingStrategy maxAgentIdStrategy; - - - public JoinIntFieldEncodingStrategy(EncodingStrategy avgValueStrategy, EncodingStrategy minValueStrategy, EncodingStrategy minAgentIdStrategy, EncodingStrategy maxValueStrategy, EncodingStrategy maxAgentIdStrategy) { - this.avgValueStrategy = Objects.requireNonNull(avgValueStrategy, "avgValueStrategy"); - this.minValueStrategy = Objects.requireNonNull(minValueStrategy, "minValueStrategy"); - this.minAgentIdStrategy = Objects.requireNonNull(minAgentIdStrategy, "minAgentIdStrategy"); - this.maxValueStrategy = Objects.requireNonNull(maxValueStrategy, "maxValueStrategy"); - this.maxAgentIdStrategy = Objects.requireNonNull(maxAgentIdStrategy, "maxAgentIdStrategy"); - } - - @Override - @Deprecated - public byte getCode() { - throw new UnsupportedOperationException("unsupported"); - } - - @Override - public byte[] getCodes() { - byte[] codes = new byte[5]; - codes[0] = avgValueStrategy.getCode(); - codes[1] = minValueStrategy.getCode(); - codes[2] = minAgentIdStrategy.getCode(); - codes[3] = maxValueStrategy.getCode(); - codes[4] = maxAgentIdStrategy.getCode(); - return codes; - } - - @Override - public void encodeValues(Buffer buffer, List values) { - final List avgValues = mapping(values, AbstractJoinFieldBo::getAvg); - avgValueStrategy.encodeValues(buffer, avgValues); - - final List minValues = mapping(values, AbstractJoinFieldBo::getMin); - minValueStrategy.encodeValues(buffer, minValues); - - final List minAgentIds = mapping(values, AbstractJoinFieldBo::getMinAgentId); - minAgentIdStrategy.encodeValues(buffer, minAgentIds); - - final List maxValues = mapping(values, AbstractJoinFieldBo::getMax); - maxValueStrategy.encodeValues(buffer, maxValues); - - final List maxAgentIds = mapping(values, AbstractJoinFieldBo::getMaxAgentId); - maxAgentIdStrategy.encodeValues(buffer, maxAgentIds); - } - - - public static JoinIntFieldEncodingStrategy getFromCode(int[] codes) { - Objects.requireNonNull(codes, "codes"); - - if (codes.length != 5) { - throw new IllegalArgumentException("codes must be 5 size"); - } - - return getFromCode(codes[0], codes[1], codes[2], codes[3], codes[4]); - } - - public static JoinIntFieldEncodingStrategy getFromCode(int code1, int code2, int code3, int code4, int code5) { - final UnsignedIntegerEncodingStrategy avgValueStrategy = UnsignedIntegerEncodingStrategy.getFromCode(code1); - final UnsignedIntegerEncodingStrategy minValueStrategy = UnsignedIntegerEncodingStrategy.getFromCode(code2); - final StringEncodingStrategy minAgentIdStrategy = StringEncodingStrategy.getFromCode(code3); - final UnsignedIntegerEncodingStrategy maxValueStrategy = UnsignedIntegerEncodingStrategy.getFromCode(code4); - final StringEncodingStrategy maxAgentIdStrategy = StringEncodingStrategy.getFromCode(code5); - - return new JoinIntFieldEncodingStrategy(avgValueStrategy, minValueStrategy, minAgentIdStrategy, maxValueStrategy, maxAgentIdStrategy); - } - - @Override - public List decodeValues(Buffer buffer, int numValues) { - - final List avgValueList = avgValueStrategy.decodeValues(buffer, numValues); - final List minValueList = minValueStrategy.decodeValues(buffer, numValues); - final List minAgentIdList = minAgentIdStrategy.decodeValues(buffer, numValues); - final List maxValueList = maxValueStrategy.decodeValues(buffer, numValues); - final List maxAgentIdList = maxAgentIdStrategy.decodeValues(buffer, numValues); - - List result = new ArrayList<>(numValues); - - for (int i = 0; i < numValues; i++) { - final Integer avgValue = avgValueList.get(i); - final Integer minValue = minValueList.get(i); - final String minAgentId = minAgentIdList.get(i); - final Integer maxValue = maxValueList.get(i); - final String maxAgentId = maxAgentIdList.get(i); - - final JoinIntFieldBo joinIntFieldBo = new JoinIntFieldBo(avgValue, minValue, minAgentId, maxValue, maxAgentId); - - result.add(joinIntFieldBo); - } - - return Collections.unmodifiableList(result); - } - -} diff --git a/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/codec/stat/strategy/JoinIntFieldStrategyAnalyzer.java b/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/codec/stat/strategy/JoinIntFieldStrategyAnalyzer.java deleted file mode 100644 index f7f18511739a..000000000000 --- a/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/codec/stat/strategy/JoinIntFieldStrategyAnalyzer.java +++ /dev/null @@ -1,103 +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.common.server.bo.codec.stat.strategy; - -import com.navercorp.pinpoint.common.server.bo.codec.strategy.EncodingStrategy; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinIntFieldBo; - -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -/** - * @author Taejin Koo - */ -public class JoinIntFieldStrategyAnalyzer implements JoinFieldStrategyAnalyzer { - - private final StrategyAnalyzer avgValueAnalyzer; - private final StrategyAnalyzer minValueAnalyzer; - private final StrategyAnalyzer minAgentIdAnalyzer; - private final StrategyAnalyzer maxValueAnalyzer; - private final StrategyAnalyzer maxAgentIdAnalyzer; - - private final List values; - - public JoinIntFieldStrategyAnalyzer(StrategyAnalyzer avgValueAnalyzer, - StrategyAnalyzer minValueAnalyzer, StrategyAnalyzer minAgentIdAnalyzer, - StrategyAnalyzer maxValueAnalyzer, StrategyAnalyzer maxAgentIdAnalyzer, - List values) { - this.avgValueAnalyzer = Objects.requireNonNull(avgValueAnalyzer, "avgValueAnalyzer"); - this.minValueAnalyzer = Objects.requireNonNull(minValueAnalyzer, "minValueAnalyzer"); - this.minAgentIdAnalyzer = Objects.requireNonNull(minAgentIdAnalyzer, "minAgentIdAnalyzer"); - this.maxValueAnalyzer = Objects.requireNonNull(maxValueAnalyzer, "maxValueAnalyzer"); - this.maxAgentIdAnalyzer = Objects.requireNonNull(maxAgentIdAnalyzer, "maxAgentIdAnalyzer"); - - this.values = values; - } - - @Override - public JoinEncodingStrategy getBestStrategy() { - final EncodingStrategy avgValueStrategy = avgValueAnalyzer.getBestStrategy(); - final EncodingStrategy minValueStrategy = minValueAnalyzer.getBestStrategy(); - final EncodingStrategy minAgentIdStrategy = minAgentIdAnalyzer.getBestStrategy(); - final EncodingStrategy maxValueStrategy = maxValueAnalyzer.getBestStrategy(); - final EncodingStrategy maxAgentIdStrategy = maxAgentIdAnalyzer.getBestStrategy(); - - return new JoinIntFieldEncodingStrategy(avgValueStrategy, minValueStrategy, minAgentIdStrategy, maxValueStrategy, maxAgentIdStrategy); - } - - @Override - public List getValues() { - return values; - } - - public static class Builder implements JoinFieldStrategyAnalyzer.JoinFieldStrategyAnalyzerBuilder { - - private final UnsignedIntegerEncodingStrategy.Analyzer.Builder avgValueAnalyzerBuilder = new UnsignedIntegerEncodingStrategy.Analyzer.Builder(); - private final UnsignedIntegerEncodingStrategy.Analyzer.Builder minValueAnalyzerBuilder = new UnsignedIntegerEncodingStrategy.Analyzer.Builder(); - private final StringEncodingStrategy.Analyzer.Builder minAgentIdAnalyzerBuilder = new StringEncodingStrategy.Analyzer.Builder(); - private final UnsignedIntegerEncodingStrategy.Analyzer.Builder maxValueAnalyzerBuilder = new UnsignedIntegerEncodingStrategy.Analyzer.Builder(); - private final StringEncodingStrategy.Analyzer.Builder maxAgentIdAnalyzerBuilder = new StringEncodingStrategy.Analyzer.Builder(); - - private final List values = new ArrayList<>(); - - - @Override - public JoinFieldStrategyAnalyzerBuilder addValue(JoinIntFieldBo value) { - avgValueAnalyzerBuilder.addValue(value.getAvg()); - minValueAnalyzerBuilder.addValue(value.getMin()); - minAgentIdAnalyzerBuilder.addValue(value.getMinAgentId()); - maxValueAnalyzerBuilder.addValue(value.getMax()); - maxAgentIdAnalyzerBuilder.addValue(value.getMaxAgentId()); - - values.add(value); - return this; - } - - @Override - public JoinIntFieldStrategyAnalyzer build() { - final StrategyAnalyzer avgValueAnalyzer = avgValueAnalyzerBuilder.build(); - final StrategyAnalyzer minValueAnalyzer = minValueAnalyzerBuilder.build(); - final StrategyAnalyzer minAgentIdAnalyzer = minAgentIdAnalyzerBuilder.build(); - final StrategyAnalyzer maxValueAnalyzer = maxValueAnalyzerBuilder.build(); - final StrategyAnalyzer maxAgentIdAnalyzer = maxAgentIdAnalyzerBuilder.build(); - - return new JoinIntFieldStrategyAnalyzer(avgValueAnalyzer, minValueAnalyzer, minAgentIdAnalyzer, maxValueAnalyzer, maxAgentIdAnalyzer, values); - } - } - -} diff --git a/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/codec/stat/strategy/JoinLongFieldEncodingStrategy.java b/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/codec/stat/strategy/JoinLongFieldEncodingStrategy.java deleted file mode 100644 index 8b266a002211..000000000000 --- a/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/codec/stat/strategy/JoinLongFieldEncodingStrategy.java +++ /dev/null @@ -1,131 +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.common.server.bo.codec.stat.strategy; - -import com.navercorp.pinpoint.common.buffer.Buffer; -import com.navercorp.pinpoint.common.server.bo.codec.strategy.EncodingStrategy; -import com.navercorp.pinpoint.common.server.bo.stat.join.AbstractJoinFieldBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinLongFieldBo; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Objects; - - -/** - * @author Taejin Koo - */ -public class JoinLongFieldEncodingStrategy implements JoinEncodingStrategy { - - private final EncodingStrategy avgValueStrategy; - private final EncodingStrategy minValueStrategy; - private final EncodingStrategy minAgentIdStrategy; - private final EncodingStrategy maxValueStrategy; - private final EncodingStrategy maxAgentIdStrategy; - - - public JoinLongFieldEncodingStrategy(EncodingStrategy avgValueStrategy, EncodingStrategy minValueStrategy, EncodingStrategy minAgentIdStrategy, EncodingStrategy maxValueStrategy, EncodingStrategy maxAgentIdStrategy) { - this.avgValueStrategy = Objects.requireNonNull(avgValueStrategy, "avgValueStrategy"); - this.minValueStrategy = Objects.requireNonNull(minValueStrategy, "minValueStrategy"); - this.minAgentIdStrategy = Objects.requireNonNull(minAgentIdStrategy, "minAgentIdStrategy"); - this.maxValueStrategy = Objects.requireNonNull(maxValueStrategy, "maxValueStrategy"); - this.maxAgentIdStrategy = Objects.requireNonNull(maxAgentIdStrategy, "maxAgentIdStrategy"); - } - - @Override - @Deprecated - public byte getCode() { - throw new UnsupportedOperationException("unsupported"); - } - - @Override - public byte[] getCodes() { - byte[] codes = new byte[5]; - codes[0] = avgValueStrategy.getCode(); - codes[1] = minValueStrategy.getCode(); - codes[2] = minAgentIdStrategy.getCode(); - codes[3] = maxValueStrategy.getCode(); - codes[4] = maxAgentIdStrategy.getCode(); - return codes; - } - - @Override - public void encodeValues(Buffer buffer, List values) { - final List avgValues = mapping(values, AbstractJoinFieldBo::getAvg); - avgValueStrategy.encodeValues(buffer, avgValues); - - final List minValues = mapping(values, AbstractJoinFieldBo::getMin); - minValueStrategy.encodeValues(buffer, minValues); - - final List minAgentIds = mapping(values, AbstractJoinFieldBo::getMinAgentId); - minAgentIdStrategy.encodeValues(buffer, minAgentIds); - - final List maxValues = mapping(values, AbstractJoinFieldBo::getMax); - maxValueStrategy.encodeValues(buffer, maxValues); - - final List maxAgentIds = mapping(values, AbstractJoinFieldBo::getMaxAgentId); - maxAgentIdStrategy.encodeValues(buffer, maxAgentIds); - } - - public static JoinLongFieldEncodingStrategy getFromCode(int[] codes) { - Objects.requireNonNull(codes, "codes"); - - if (codes.length != 5) { - throw new IllegalArgumentException("codes must be 5 size"); - } - - return getFromCode(codes[0], codes[1], codes[2], codes[3], codes[4]); - } - - public static JoinLongFieldEncodingStrategy getFromCode(int code1, int code2, int code3, int code4, int code5) { - final UnsignedLongEncodingStrategy avgValueStrategy = UnsignedLongEncodingStrategy.getFromCode(code1); - final UnsignedLongEncodingStrategy minValueStrategy = UnsignedLongEncodingStrategy.getFromCode(code2); - final StringEncodingStrategy minAgentIdStrategy = StringEncodingStrategy.getFromCode(code3); - final UnsignedLongEncodingStrategy maxValueStrategy = UnsignedLongEncodingStrategy.getFromCode(code4); - final StringEncodingStrategy maxAgentIdStrategy = StringEncodingStrategy.getFromCode(code5); - - return new JoinLongFieldEncodingStrategy(avgValueStrategy, minValueStrategy, minAgentIdStrategy, maxValueStrategy, maxAgentIdStrategy); - } - - @Override - public List decodeValues(Buffer buffer, int numValues) { - - final List avgValueList = avgValueStrategy.decodeValues(buffer, numValues); - final List minValueList = minValueStrategy.decodeValues(buffer, numValues); - final List minAgentIdList = minAgentIdStrategy.decodeValues(buffer, numValues); - final List maxValueList = maxValueStrategy.decodeValues(buffer, numValues); - final List maxAgentIdList = maxAgentIdStrategy.decodeValues(buffer, numValues); - - List result = new ArrayList<>(numValues); - - for (int i = 0; i < numValues; i++) { - final Long avgValue = avgValueList.get(i); - final Long minValue = minValueList.get(i); - final String minAgentId = minAgentIdList.get(i); - final Long maxValue = maxValueList.get(i); - final String maxAgentId = maxAgentIdList.get(i); - - final JoinLongFieldBo joinLongFieldBo = new JoinLongFieldBo(avgValue, minValue, minAgentId, maxValue, maxAgentId); - - result.add(joinLongFieldBo); - } - - return Collections.unmodifiableList(result); - } - -} diff --git a/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/codec/stat/strategy/JoinLongFieldStrategyAnalyzer.java b/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/codec/stat/strategy/JoinLongFieldStrategyAnalyzer.java deleted file mode 100644 index d83e360b3d12..000000000000 --- a/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/codec/stat/strategy/JoinLongFieldStrategyAnalyzer.java +++ /dev/null @@ -1,102 +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.common.server.bo.codec.stat.strategy; - -import com.navercorp.pinpoint.common.server.bo.codec.strategy.EncodingStrategy; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinLongFieldBo; - -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -/** - * @author Taejin Koo - */ -public class JoinLongFieldStrategyAnalyzer implements JoinFieldStrategyAnalyzer { - - private final StrategyAnalyzer avgValueAnalyzer; - private final StrategyAnalyzer minValueAnalyzer; - private final StrategyAnalyzer minAgentIdAnalyzer; - private final StrategyAnalyzer maxValueAnalyzer; - private final StrategyAnalyzer maxAgentIdAnalyzer; - - private final List values; - - public JoinLongFieldStrategyAnalyzer(StrategyAnalyzer avgValueAnalyzer, - StrategyAnalyzer minValueAnalyzer, StrategyAnalyzer minAgentIdAnalyzer, - StrategyAnalyzer maxValueAnalyzer, StrategyAnalyzer maxAgentIdAnalyzer, - List values) { - this.avgValueAnalyzer = Objects.requireNonNull(avgValueAnalyzer, "avgValueAnalyzer"); - this.minValueAnalyzer = Objects.requireNonNull(minValueAnalyzer, "minValueAnalyzer"); - this.minAgentIdAnalyzer = Objects.requireNonNull(minAgentIdAnalyzer, "minAgentIdAnalyzer"); - this.maxValueAnalyzer = Objects.requireNonNull(maxValueAnalyzer, "maxValueAnalyzer"); - this.maxAgentIdAnalyzer = Objects.requireNonNull(maxAgentIdAnalyzer, "maxAgentIdAnalyzer"); - - this.values = values; - } - - @Override - public JoinEncodingStrategy getBestStrategy() { - final EncodingStrategy avgValueStrategy = avgValueAnalyzer.getBestStrategy(); - final EncodingStrategy minValueStrategy = minValueAnalyzer.getBestStrategy(); - final EncodingStrategy minAgentIdStrategy = minAgentIdAnalyzer.getBestStrategy(); - final EncodingStrategy maxValueStrategy = maxValueAnalyzer.getBestStrategy(); - final EncodingStrategy maxAgentIdStrategy = maxAgentIdAnalyzer.getBestStrategy(); - - return new JoinLongFieldEncodingStrategy(avgValueStrategy, minValueStrategy, minAgentIdStrategy, maxValueStrategy, maxAgentIdStrategy); - } - - @Override - public List getValues() { - return values; - } - - public static class Builder implements JoinFieldStrategyAnalyzerBuilder { - - private final UnsignedLongEncodingStrategy.Analyzer.Builder avgValueAnalyzerBuilder = new UnsignedLongEncodingStrategy.Analyzer.Builder(); - private final UnsignedLongEncodingStrategy.Analyzer.Builder minValueAnalyzerBuilder = new UnsignedLongEncodingStrategy.Analyzer.Builder(); - private final StringEncodingStrategy.Analyzer.Builder minAgentIdAnalyzerBuilder = new StringEncodingStrategy.Analyzer.Builder(); - private final UnsignedLongEncodingStrategy.Analyzer.Builder maxValueAnalyzerBuilder = new UnsignedLongEncodingStrategy.Analyzer.Builder(); - private final StringEncodingStrategy.Analyzer.Builder maxAgentIdAnalyzerBuilder = new StringEncodingStrategy.Analyzer.Builder(); - - private final List values = new ArrayList<>(); - - @Override - public JoinFieldStrategyAnalyzerBuilder addValue(JoinLongFieldBo value) { - avgValueAnalyzerBuilder.addValue(value.getAvg()); - minValueAnalyzerBuilder.addValue(value.getMin()); - minAgentIdAnalyzerBuilder.addValue(value.getMinAgentId()); - maxValueAnalyzerBuilder.addValue(value.getMax()); - maxAgentIdAnalyzerBuilder.addValue(value.getMaxAgentId()); - - values.add(value); - return this; - } - - @Override - public JoinLongFieldStrategyAnalyzer build() { - final StrategyAnalyzer avgValueAnalyzer = avgValueAnalyzerBuilder.build(); - final StrategyAnalyzer minValueAnalyzer = minValueAnalyzerBuilder.build(); - final StrategyAnalyzer minAgentIdAnalyzer = minAgentIdAnalyzerBuilder.build(); - final StrategyAnalyzer maxValueAnalyzer = maxValueAnalyzerBuilder.build(); - final StrategyAnalyzer maxAgentIdAnalyzer = maxAgentIdAnalyzerBuilder.build(); - - return new JoinLongFieldStrategyAnalyzer(avgValueAnalyzer, minValueAnalyzer, minAgentIdAnalyzer, maxValueAnalyzer, maxAgentIdAnalyzer, values); - } - } - -} diff --git a/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/serializer/stat/ApplicationStatDecodingContext.java b/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/serializer/stat/ApplicationStatDecodingContext.java deleted file mode 100644 index bbba77b208be..000000000000 --- a/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/serializer/stat/ApplicationStatDecodingContext.java +++ /dev/null @@ -1,52 +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.common.server.bo.serializer.stat; - -/** - * @author minwoo.jung - */ -public class ApplicationStatDecodingContext { - - private String applicationId; - - private long baseTimestamp; - - private long timestampDelta; - - public String getApplicationId() { - return applicationId; - } - - public void setApplicationId(String applicationId) { - this.applicationId = applicationId; - } - - public long getBaseTimestamp() { - return baseTimestamp; - } - - public void setBaseTimestamp(long baseTimestamp) { - this.baseTimestamp = baseTimestamp; - } - - public long getTimestampDelta() { - return timestampDelta; - } - - public void setTimestampDelta(long timestampDelta) { - this.timestampDelta = timestampDelta; - } -} diff --git a/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/serializer/stat/ApplicationStatHbaseOperationFactory.java b/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/serializer/stat/ApplicationStatHbaseOperationFactory.java deleted file mode 100644 index 2b5665847f24..000000000000 --- a/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/serializer/stat/ApplicationStatHbaseOperationFactory.java +++ /dev/null @@ -1,112 +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.common.server.bo.serializer.stat; - -import com.navercorp.pinpoint.common.hbase.HbaseColumnFamily; -import com.navercorp.pinpoint.common.server.bo.serializer.stat.join.ApplicationStatSerializer; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinStatBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.StatType; -import com.sematext.hbase.wd.AbstractRowKeyDistributor; -import org.apache.commons.collections4.CollectionUtils; -import org.apache.hadoop.hbase.client.Put; -import org.apache.hadoop.hbase.client.Scan; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.TreeMap; - -/** - * @author Minwoo Jung - */ -public class ApplicationStatHbaseOperationFactory { - - private final ApplicationStatRowKeyEncoder rowKeyEncoder; - - private final ApplicationStatRowKeyDecoder rowKeyDecoder; - - private final AbstractRowKeyDistributor rowKeyDistributor; - - public ApplicationStatHbaseOperationFactory( - ApplicationStatRowKeyEncoder rowKeyEncoder, - ApplicationStatRowKeyDecoder rowKeyDecoder, - AbstractRowKeyDistributor rowKeyDistributor) { - this.rowKeyEncoder = Objects.requireNonNull(rowKeyEncoder, "rowKeyEncoder"); - this.rowKeyDecoder = Objects.requireNonNull(rowKeyDecoder, "rowKeyDecoder"); - this.rowKeyDistributor = Objects.requireNonNull(rowKeyDistributor, "rowKeyDistributor"); - } - - public List createPuts(String applicationId, List joinStatBoList, StatType statType, ApplicationStatSerializer applicationStatSerializer) { - if (CollectionUtils.isEmpty(joinStatBoList)) { - return Collections.emptyList(); - } - - Map> timeslots = slotApplicationStatDataPoints(joinStatBoList); - List puts = new ArrayList<>(); - for (Map.Entry> timeslot : timeslots.entrySet()) { - long baseTimestamp = timeslot.getKey(); - List slottedApplicationStatDataPoints = timeslot.getValue(); - - final ApplicationStatRowKeyComponent rowKeyComponent = new ApplicationStatRowKeyComponent(applicationId, statType, baseTimestamp); - byte[] rowKey = this.rowKeyEncoder.encodeRowKey(rowKeyComponent); - byte[] distributedRowKey = this.rowKeyDistributor.getDistributedKey(rowKey); - - Put put = new Put(distributedRowKey, true); - applicationStatSerializer.serialize(slottedApplicationStatDataPoints, put, null); - puts.add(put); - } - return puts; - } - - public Scan createScan(String applicationId, StatType statType, long startTimestamp, long endTimestamp) { - final ApplicationStatRowKeyComponent startRowKeyComponent = new ApplicationStatRowKeyComponent(applicationId, statType, AgentStatUtils.getBaseTimestamp(endTimestamp)); - final ApplicationStatRowKeyComponent endRowKeyComponenet = new ApplicationStatRowKeyComponent(applicationId, statType, AgentStatUtils.getBaseTimestamp(startTimestamp) - HbaseColumnFamily.APPLICATION_STAT_STATISTICS.TIMESPAN_MS); - byte[] startRowKey = this.rowKeyEncoder.encodeRowKey(startRowKeyComponent); - byte[] endRowKey = this.rowKeyEncoder.encodeRowKey(endRowKeyComponenet); - Scan scan = new Scan(); - scan.withStartRow(startRowKey); - scan.withStopRow(endRowKey); - return scan; - } - - public AbstractRowKeyDistributor getRowKeyDistributor() { - return this.rowKeyDistributor; - } - - public String getApplicationId(byte[] distributedRowKey) { - byte[] originalRowKey = this.rowKeyDistributor.getOriginalKey(distributedRowKey); - return this.rowKeyDecoder.decodeRowKey(originalRowKey).getApplicationId(); - } - - public long getBaseTimestamp(byte[] distributedRowKey) { - byte[] originalRowKey = this.rowKeyDistributor.getOriginalKey(distributedRowKey); - return this.rowKeyDecoder.decodeRowKey(originalRowKey).getBaseTimestamp(); - } - - private Map> slotApplicationStatDataPoints(List joinStatBoList) { - Map> timeslots = new TreeMap<>(); - for (T joinStatBo : joinStatBoList) { - long timestamp = joinStatBo.getTimestamp(); - long timeslot = AgentStatUtils.getBaseTimestamp(timestamp); - List slottedDataPoints = timeslots.computeIfAbsent(timeslot, k -> new ArrayList<>()); - slottedDataPoints.add(joinStatBo); - } - return timeslots; - } -} diff --git a/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/serializer/stat/ApplicationStatRowKeyComponent.java b/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/serializer/stat/ApplicationStatRowKeyComponent.java deleted file mode 100644 index b35b92bd1a4e..000000000000 --- a/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/serializer/stat/ApplicationStatRowKeyComponent.java +++ /dev/null @@ -1,47 +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.common.server.bo.serializer.stat; - -import com.navercorp.pinpoint.common.server.bo.stat.join.StatType; - -/** - * @author Minwoo Jung - */ -public class ApplicationStatRowKeyComponent { - - private final String applicationId; - private final StatType statType; - private final long baseTimestamp; - - public ApplicationStatRowKeyComponent(String applicationId, StatType statType, long baseTimestamp) { - this.applicationId = applicationId; - this.statType = statType; - this.baseTimestamp = baseTimestamp; - } - - public String getApplicationId() { - return this.applicationId; - } - - public StatType getStatType() { - return this.statType; - } - - public long getBaseTimestamp() { - return this.baseTimestamp; - } -} diff --git a/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/serializer/stat/ApplicationStatRowKeyDecoder.java b/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/serializer/stat/ApplicationStatRowKeyDecoder.java deleted file mode 100644 index bb79561bd315..000000000000 --- a/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/serializer/stat/ApplicationStatRowKeyDecoder.java +++ /dev/null @@ -1,40 +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.common.server.bo.serializer.stat; - -import com.navercorp.pinpoint.common.server.bo.serializer.RowKeyDecoder; -import com.navercorp.pinpoint.common.server.bo.stat.join.StatType; -import com.navercorp.pinpoint.common.util.BytesUtils; -import com.navercorp.pinpoint.common.util.TimeUtils; - -import static com.navercorp.pinpoint.common.hbase.HbaseTableConstants.APPLICATION_NAME_MAX_LEN; -import static com.navercorp.pinpoint.common.server.bo.stat.join.StatType.TYPE_CODE_BYTE_LENGTH; - - -/** - * @author minwoo.jung - */ -public class ApplicationStatRowKeyDecoder implements RowKeyDecoder { - - @Override - public ApplicationStatRowKeyComponent decodeRowKey(byte[] rowkey) { - final String applicationId = BytesUtils.toStringAndRightTrim(rowkey, 0, APPLICATION_NAME_MAX_LEN); - final StatType statType = StatType.fromTypeCode(rowkey[APPLICATION_NAME_MAX_LEN]); - final long reversedBaseTimestamp = BytesUtils.bytesToLong(rowkey, APPLICATION_NAME_MAX_LEN + TYPE_CODE_BYTE_LENGTH); - final long baseTimestamp = TimeUtils.recoveryTimeMillis(reversedBaseTimestamp); - return new ApplicationStatRowKeyComponent(applicationId, statType, baseTimestamp); - } -} \ No newline at end of file diff --git a/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/serializer/stat/ApplicationStatRowKeyEncoder.java b/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/serializer/stat/ApplicationStatRowKeyEncoder.java deleted file mode 100644 index 37dd631580ab..000000000000 --- a/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/serializer/stat/ApplicationStatRowKeyEncoder.java +++ /dev/null @@ -1,45 +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.common.server.bo.serializer.stat; - -import com.navercorp.pinpoint.common.server.bo.serializer.RowKeyEncoder; -import com.navercorp.pinpoint.common.util.BytesUtils; -import com.navercorp.pinpoint.common.util.TimeUtils; - -import java.util.Objects; - -import static com.navercorp.pinpoint.common.hbase.HbaseTableConstants.APPLICATION_NAME_MAX_LEN; - -/** - * @author minwoo.jung - */ -public class ApplicationStatRowKeyEncoder implements RowKeyEncoder { - - @Override - public byte[] encodeRowKey(ApplicationStatRowKeyComponent component) { - Objects.requireNonNull(component, "component"); - - byte[] bApplicationId = BytesUtils.toBytes(component.getApplicationId()); - byte[] bStatType = new byte[]{component.getStatType().getRawTypeCode()}; - byte[] rowKey = new byte[APPLICATION_NAME_MAX_LEN + bStatType.length + BytesUtils.LONG_BYTE_LENGTH]; - - BytesUtils.writeBytes(rowKey, 0, bApplicationId); - BytesUtils.writeBytes(rowKey, APPLICATION_NAME_MAX_LEN, bStatType); - BytesUtils.writeLong(TimeUtils.reverseTimeMillis(component.getBaseTimestamp()), rowKey, APPLICATION_NAME_MAX_LEN + bStatType.length); - - return rowKey; - } -} diff --git a/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/serializer/stat/config/ApplicationStatSerializeConfiguration.java b/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/serializer/stat/config/ApplicationStatSerializeConfiguration.java deleted file mode 100644 index 523c85bf9d58..000000000000 --- a/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/serializer/stat/config/ApplicationStatSerializeConfiguration.java +++ /dev/null @@ -1,93 +0,0 @@ -package com.navercorp.pinpoint.common.server.bo.serializer.stat.config; - -import com.navercorp.pinpoint.common.server.bo.codec.stat.ApplicationStatEncoder; -import com.navercorp.pinpoint.common.server.bo.serializer.stat.ApplicationStatHbaseOperationFactory; -import com.navercorp.pinpoint.common.server.bo.serializer.stat.ApplicationStatRowKeyDecoder; -import com.navercorp.pinpoint.common.server.bo.serializer.stat.ApplicationStatRowKeyEncoder; -import com.navercorp.pinpoint.common.server.bo.serializer.stat.join.ApplicationStatSerializer; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinActiveTraceBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinCpuLoadBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinDataSourceListBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinDirectBufferBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinFileDescriptorBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinLoadedClassBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinMemoryBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinResponseTimeBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinTotalThreadCountBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinTransactionBo; -import com.sematext.hbase.wd.AbstractRowKeyDistributor; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -@Configuration -public class ApplicationStatSerializeConfiguration { - @Bean - public ApplicationStatRowKeyDecoder applicationStatRowKeyDecoder() { - return new ApplicationStatRowKeyDecoder(); - } - - @Bean - public ApplicationStatRowKeyEncoder applicationStatRowKeyEncoder() { - return new ApplicationStatRowKeyEncoder(); - } - - @Bean - public ApplicationStatHbaseOperationFactory applicationStatHbaseOperationFactory( - ApplicationStatRowKeyEncoder rowKeyEncoder, - ApplicationStatRowKeyDecoder rowKeyDecoder, - @Qualifier("applicationStatRowKeyDistributor") AbstractRowKeyDistributor rowKeyDistributor) { - return new ApplicationStatHbaseOperationFactory(rowKeyEncoder, rowKeyDecoder, rowKeyDistributor); - } - - @Bean - public ApplicationStatSerializer getAppActiveTraceSerializer(ApplicationStatEncoder coder) { - return new ApplicationStatSerializer<>(coder); - } - - @Bean - public ApplicationStatSerializer getAppCpuLoadSerializer(ApplicationStatEncoder coder) { - return new ApplicationStatSerializer<>(coder); - } - - @Bean - public ApplicationStatSerializer getAppDataSourceSerializer(ApplicationStatEncoder coder) { - return new ApplicationStatSerializer<>(coder); - } - - @Bean - public ApplicationStatSerializer getAppDirectBufferSerializer(ApplicationStatEncoder coder) { - return new ApplicationStatSerializer<>(coder); - } - - @Bean - public ApplicationStatSerializer getAppFileDescriptorSerializer(ApplicationStatEncoder coder) { - return new ApplicationStatSerializer<>(coder); - } - - @Bean - public ApplicationStatSerializer getAppLoadedClassSerializer(ApplicationStatEncoder coder) { - return new ApplicationStatSerializer<>(coder); - } - - @Bean - public ApplicationStatSerializer getAppMemorySerializer(ApplicationStatEncoder coder) { - return new ApplicationStatSerializer<>(coder); - } - - @Bean - public ApplicationStatSerializer getAppResponseTimeSerializer(ApplicationStatEncoder coder) { - return new ApplicationStatSerializer<>(coder); - } - - @Bean - public ApplicationStatSerializer getAppTotalThreadCountSerializer(ApplicationStatEncoder coder) { - return new ApplicationStatSerializer<>(coder); - } - - @Bean - public ApplicationStatSerializer getAppTransactionSerializer(ApplicationStatEncoder coder) { - return new ApplicationStatSerializer<>(coder); - } -} - diff --git a/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/serializer/stat/join/ApplicationStatSerializer.java b/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/serializer/stat/join/ApplicationStatSerializer.java deleted file mode 100644 index e6e171dfafd9..000000000000 --- a/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/serializer/stat/join/ApplicationStatSerializer.java +++ /dev/null @@ -1,55 +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.common.server.bo.serializer.stat.join; - -import com.navercorp.pinpoint.common.hbase.HbaseColumnFamily; -import com.navercorp.pinpoint.common.server.bo.codec.stat.ApplicationStatEncoder; -import com.navercorp.pinpoint.common.server.bo.serializer.HbaseSerializer; -import com.navercorp.pinpoint.common.server.bo.serializer.SerializationContext; -import com.navercorp.pinpoint.common.server.bo.serializer.stat.AgentStatUtils; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinStatBo; -import org.apache.commons.collections4.CollectionUtils; -import org.apache.hadoop.hbase.HConstants; -import org.apache.hadoop.hbase.client.Put; - -import java.nio.ByteBuffer; -import java.util.List; -import java.util.Objects; - -/** - * @author minwoo.jung - */ -public class ApplicationStatSerializer implements HbaseSerializer, Put> { - - private final ApplicationStatEncoder encoder; - - public ApplicationStatSerializer(ApplicationStatEncoder encoder) { - this.encoder = Objects.requireNonNull(encoder, "encoder"); - } - - @Override - public void serialize(List joinStatBoList, Put put, SerializationContext context) { - if (CollectionUtils.isEmpty(joinStatBoList)) { - throw new IllegalArgumentException("agentStatBos should not be empty"); - } - long initialTimestamp = joinStatBoList.get(0).getTimestamp(); - long baseTimestamp = AgentStatUtils.getBaseTimestamp(initialTimestamp); - long timestampDelta = initialTimestamp - baseTimestamp; - ByteBuffer qualifierBuffer = this.encoder.encodeQualifier(timestampDelta); - ByteBuffer valueBuffer = this.encoder.encodeValue(joinStatBoList); - put.addColumn(HbaseColumnFamily.APPLICATION_STAT_STATISTICS.getName(), qualifierBuffer, HConstants.LATEST_TIMESTAMP, valueBuffer); - } -} diff --git a/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/join/AbstractJoinFieldBo.java b/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/join/AbstractJoinFieldBo.java deleted file mode 100644 index 295ae50b2c2f..000000000000 --- a/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/join/AbstractJoinFieldBo.java +++ /dev/null @@ -1,108 +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.common.server.bo.stat.join; - -import java.util.Objects; -import java.util.StringJoiner; - -/** - * @author Taejin Koo - */ -public abstract class AbstractJoinFieldBo implements JoinFieldBo { - - private final V avgValue; - - private final V minValue; - - private final String minAgentId; - - private final V maxValue; - - private final String maxAgentid; - - public AbstractJoinFieldBo(V avgValue, V minValue, String minAgentId, V maxValue, String maxAgentid) { - this.avgValue = avgValue; - this.minValue = minValue; - this.minAgentId = Objects.requireNonNull(minAgentId, "minAgentId"); - this.maxValue = maxValue; - this.maxAgentid = Objects.requireNonNull(maxAgentid, "maxAgentid"); - } - - @Override - public V getAvg() { - return avgValue; - } - - @Override - public V getMin() { - return minValue; - } - - @Override - public String getMinAgentId() { - return minAgentId; - } - - @Override - public V getMax() { - return maxValue; - } - - @Override - public String getMaxAgentId() { - return maxAgentid; - } - - abstract protected JoinFieldBo getUncollectedValue(); - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - AbstractJoinFieldBo that = (AbstractJoinFieldBo) o; - - if (avgValue != null ? !avgValue.equals(that.avgValue) : that.avgValue != null) return false; - if (minValue != null ? !minValue.equals(that.minValue) : that.minValue != null) return false; - if (minAgentId != null ? !minAgentId.equals(that.minAgentId) : that.minAgentId != null) return false; - if (maxValue != null ? !maxValue.equals(that.maxValue) : that.maxValue != null) return false; - return maxAgentid != null ? maxAgentid.equals(that.maxAgentid) : that.maxAgentid == null; - } - - @Override - public int hashCode() { - int result = avgValue != null ? avgValue.hashCode() : 0; - result = 31 * result + (minValue != null ? minValue.hashCode() : 0); - result = 31 * result + (minAgentId != null ? minAgentId.hashCode() : 0); - result = 31 * result + (maxValue != null ? maxValue.hashCode() : 0); - result = 31 * result + (maxAgentid != null ? maxAgentid.hashCode() : 0); - return result; - } - - @Override - public String toString() { - return new StringJoiner(", ", getClass().getSimpleName() + "[", "]") - .add("avgValue=" + avgValue) - .add("minValue=" + minValue) - .add("minAgentId='" + minAgentId + "'") - .add("maxValue=" + maxValue) - .add("maxAgentid='" + maxAgentid + "'") - .toString(); - } - -} - diff --git a/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinActiveTraceBo.java b/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinActiveTraceBo.java deleted file mode 100644 index e27db1c61a96..000000000000 --- a/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinActiveTraceBo.java +++ /dev/null @@ -1,154 +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.common.server.bo.stat.join; - -import java.util.List; -import java.util.stream.Collectors; - -/** - * @author minwoo.jung - */ -public class JoinActiveTraceBo implements JoinStatBo { - - public static final JoinActiveTraceBo EMPTY_JOIN_ACTIVE_TRACE_BO = new JoinActiveTraceBo(); - public static final int UNCOLLECTED_VALUE = -1; - private static final int DEFAULT_HISTOGRAM_SCHEMA_TYPE = -1; - private static final short DEFAULT_VERSION = -1; - - private String id = UNKNOWN_ID; - private long timestamp = Long.MIN_VALUE; - private int histogramSchemaType = DEFAULT_HISTOGRAM_SCHEMA_TYPE; - private short version = DEFAULT_VERSION; - private JoinIntFieldBo totalCountJoinValue = JoinIntFieldBo.UNCOLLECTED_FIELD_BO; - - public JoinActiveTraceBo() { - } - - public JoinActiveTraceBo(String id, int histogramSchemaType, short version, int totalCount, int minTotalCount, String minTotalCountAgentId, int maxTotalCount, String maxTotalCountAgentId, long timestamp) { - this(id, histogramSchemaType, version, new JoinIntFieldBo(totalCount, minTotalCount, minTotalCountAgentId, maxTotalCount, maxTotalCountAgentId), timestamp); - } - - public JoinActiveTraceBo(String id, int histogramSchemaType, short version, JoinIntFieldBo totalCountJoinValue, long timestamp) { - this.id = id; - this.timestamp = timestamp; - this.histogramSchemaType = histogramSchemaType; - this.version = version; - this.totalCountJoinValue = totalCountJoinValue; - } - - @Override - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - @Override - public long getTimestamp() { - return timestamp; - } - - public void setTimestamp(long timestamp) { - this.timestamp = timestamp; - } - - public int getHistogramSchemaType() { - return histogramSchemaType; - } - - public void setHistogramSchemaType(int histogramSchemaType) { - this.histogramSchemaType = histogramSchemaType; - } - - public short getVersion() { - return version; - } - - public void setVersion(short version) { - this.version = version; - } - - public JoinIntFieldBo getTotalCountJoinValue() { - return totalCountJoinValue; - } - - public void setTotalCountJoinValue(JoinIntFieldBo totalCountJoinValue) { - this.totalCountJoinValue = totalCountJoinValue; - } - - public static void apply(JoinApplicationStatBo.Builder builder, List joinActiveTraceBoList, Long timestamp) { - builder.addActiveTrace(joinActiveTraceBoList(joinActiveTraceBoList, timestamp)); - } - - public static JoinActiveTraceBo joinActiveTraceBoList(List joinActiveTraceBoList, Long timestamp) { - if (joinActiveTraceBoList.isEmpty()) { - return JoinActiveTraceBo.EMPTY_JOIN_ACTIVE_TRACE_BO; - } - - List totalCountFieldBoList = joinActiveTraceBoList.stream() - .map(JoinActiveTraceBo::getTotalCountJoinValue) - .collect(Collectors.toList()); - JoinIntFieldBo totalCountJoinValue = JoinIntFieldBo.merge(totalCountFieldBoList); - - final JoinActiveTraceBo firstJoinActiveTraceBo = joinActiveTraceBoList.get(0); - - final JoinActiveTraceBo newJoinActiveTraceBo = new JoinActiveTraceBo(); - newJoinActiveTraceBo.setId(firstJoinActiveTraceBo.getId()); - newJoinActiveTraceBo.setTimestamp(timestamp); - newJoinActiveTraceBo.setHistogramSchemaType(firstJoinActiveTraceBo.getHistogramSchemaType()); - newJoinActiveTraceBo.setVersion(firstJoinActiveTraceBo.getVersion()); - newJoinActiveTraceBo.setTotalCountJoinValue(totalCountJoinValue); - return newJoinActiveTraceBo; - } - - @Override - public String toString() { - final StringBuilder sb = new StringBuilder("JoinActiveTraceBo{"); - sb.append("id='").append(id).append('\''); - sb.append(", timestamp=").append(timestamp); - sb.append(", histogramSchemaType=").append(histogramSchemaType); - sb.append(", version=").append(version); - sb.append(", totalCountJoinValue=").append(totalCountJoinValue); - sb.append('}'); - return sb.toString(); - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - JoinActiveTraceBo that = (JoinActiveTraceBo) o; - - if (timestamp != that.timestamp) return false; - if (histogramSchemaType != that.histogramSchemaType) return false; - if (version != that.version) return false; - if (id != null ? !id.equals(that.id) : that.id != null) return false; - return totalCountJoinValue != null ? totalCountJoinValue.equals(that.totalCountJoinValue) : that.totalCountJoinValue == null; - } - - @Override - public int hashCode() { - int result = id != null ? id.hashCode() : 0; - result = 31 * result + (int) (timestamp ^ (timestamp >>> 32)); - result = 31 * result + histogramSchemaType; - result = 31 * result + (int) version; - result = 31 * result + (totalCountJoinValue != null ? totalCountJoinValue.hashCode() : 0); - return result; - } -} diff --git a/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinAgentStatBo.java b/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinAgentStatBo.java deleted file mode 100644 index ae17282097b9..000000000000 --- a/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinAgentStatBo.java +++ /dev/null @@ -1,255 +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.common.server.bo.stat.join; - -import com.navercorp.pinpoint.common.server.util.FilterUtils; - -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -/** - * @author minwoo.jung - */ -public class JoinAgentStatBo implements JoinStatBo { - public static final JoinAgentStatBo EMPTY_JOIN_AGENT_STAT_BO = newEmptyAgentStatBo(); - - private static JoinAgentStatBo newEmptyAgentStatBo() { - return JoinAgentStatBo.newBuilder(UNKNOWN_AGENT, Long.MIN_VALUE, Long.MIN_VALUE).build(); - } - - private final String agentId; - private final long agentStartTimestamp; - private final long timestamp; - private final List joinCpuLoadBoList; - private final List joinMemoryBoList; - private final List joinTransactionBoList; - private final List joinActiveTraceBoList; - private final List joinResponseTimeBoList; - private final List joinDataSourceListBoList; - private final List joinFileDescriptorBoList; - private final List joinDirectBufferBoList; - private final List joinTotalThreadCountBoList; - private final List joinLoadedClassBoList; - - protected JoinAgentStatBo(JoinAgentStatBo joinAgentStatBo) { - Objects.requireNonNull(joinAgentStatBo, "joinAgentStatBo"); - - this.agentId = joinAgentStatBo.getId(); - this.agentStartTimestamp = joinAgentStatBo.getAgentStartTimestamp(); - this.timestamp = joinAgentStatBo.getTimestamp(); - this.joinCpuLoadBoList = joinAgentStatBo.getJoinCpuLoadBoList(); - this.joinMemoryBoList = joinAgentStatBo.getJoinMemoryBoList(); - this.joinTransactionBoList = joinAgentStatBo.getJoinTransactionBoList(); - this.joinActiveTraceBoList = joinAgentStatBo.getJoinActiveTraceBoList(); - this.joinResponseTimeBoList = joinAgentStatBo.getJoinResponseTimeBoList(); - this.joinDataSourceListBoList = joinAgentStatBo.getJoinDataSourceListBoList(); - this.joinFileDescriptorBoList = joinAgentStatBo.getJoinFileDescriptorBoList(); - this.joinDirectBufferBoList = joinAgentStatBo.getJoinDirectBufferBoList(); - this.joinTotalThreadCountBoList = joinAgentStatBo.getJoinTotalThreadCountBoList(); - this.joinLoadedClassBoList = joinAgentStatBo.getJoinLoadedClassBoList(); - } - - private JoinAgentStatBo(JoinAgentStatBo.Builder joinAgentStatBo) { - Objects.requireNonNull(joinAgentStatBo, "joinAgentStatBo"); - - this.agentId = joinAgentStatBo.agentId; - this.agentStartTimestamp = joinAgentStatBo.agentStartTimestamp; - this.timestamp = joinAgentStatBo.timestamp; - - this.joinCpuLoadBoList = FilterUtils.filter(joinAgentStatBo.statList, JoinCpuLoadBo.class); - this.joinMemoryBoList = FilterUtils.filter(joinAgentStatBo.statList, JoinMemoryBo.class); - this.joinTransactionBoList = FilterUtils.filter(joinAgentStatBo.statList, JoinTransactionBo.class); - this.joinActiveTraceBoList = FilterUtils.filter(joinAgentStatBo.statList, JoinActiveTraceBo.class); - this.joinResponseTimeBoList = FilterUtils.filter(joinAgentStatBo.statList, JoinResponseTimeBo.class); - this.joinDataSourceListBoList = FilterUtils.filter(joinAgentStatBo.statList, JoinDataSourceListBo.class); - this.joinFileDescriptorBoList = FilterUtils.filter(joinAgentStatBo.statList, JoinFileDescriptorBo.class); - this.joinDirectBufferBoList = FilterUtils.filter(joinAgentStatBo.statList, JoinDirectBufferBo.class); - this.joinTotalThreadCountBoList = FilterUtils.filter(joinAgentStatBo.statList, JoinTotalThreadCountBo.class); - this.joinLoadedClassBoList = FilterUtils.filter(joinAgentStatBo.statList, JoinLoadedClassBo.class); - } - - public List getJoinResponseTimeBoList() { - return joinResponseTimeBoList; - } - - public String getId() { - return agentId; - } - - - public long getTimestamp() { - return timestamp; - } - - public List getJoinFileDescriptorBoList() { - return joinFileDescriptorBoList; - } - - public List getJoinCpuLoadBoList() { - return joinCpuLoadBoList; - } - - public List getJoinDirectBufferBoList() { - return joinDirectBufferBoList; - } - - public List getJoinTotalThreadCountBoList() { - return joinTotalThreadCountBoList; - } - - public List getJoinLoadedClassBoList() { - return joinLoadedClassBoList; - } - - - public long getAgentStartTimestamp() { - return agentStartTimestamp; - } - - public static JoinAgentStatBo joinAgentStatBo(List joinAgentStatBoList) { - if (joinAgentStatBoList.isEmpty()) { - return newEmptyAgentStatBo(); - } - - List joinCpuLoadBoList = new ArrayList<>(); - for (JoinAgentStatBo joinAgentStatBo : joinAgentStatBoList) { - joinCpuLoadBoList.addAll(joinAgentStatBo.getJoinCpuLoadBoList()); - } - - JoinCpuLoadBo joinCpuLoadBo = JoinCpuLoadBo.joinCpuLoadBoList(joinCpuLoadBoList, joinCpuLoadBoList.get(0).getTimestamp()); - - JoinAgentStatBo.Builder builder = JoinAgentStatBo.newBuilder(joinCpuLoadBo.getId(), Long.MIN_VALUE, joinCpuLoadBo.getTimestamp()); - builder.addCpuLoadBo(joinCpuLoadBo); - - return builder.build(); - - } - - public List getJoinMemoryBoList() { - return joinMemoryBoList; - } - - public List getJoinTransactionBoList() { - return joinTransactionBoList; - } - - public List getJoinActiveTraceBoList() { - return joinActiveTraceBoList; - } - - public List getJoinDataSourceListBoList() { - return joinDataSourceListBoList; - } - - public static Builder newBuilder(String agentId, long agentStartTimestamp, long timestamp) { - return new Builder(agentId, agentStartTimestamp, timestamp); - } - - public static class Builder { - private final String agentId; - private final long agentStartTimestamp; - private final long timestamp; - - private final List statList = new ArrayList<>(); - - - Builder(String agentId, long agentStartTimestamp, long timestamp) { - this.agentId = Objects.requireNonNull(agentId, "agentId"); - this.agentStartTimestamp = agentStartTimestamp; - this.timestamp = timestamp; - } - - public long getTimestamp() { - return timestamp; - } - - public void addCpuLoadBo(JoinCpuLoadBo cpuLoadBo) { - Objects.requireNonNull(cpuLoadBo, "cpuLoadBo"); - this.statList.add(cpuLoadBo); - } - - public void addDataSourceListBo(JoinDataSourceListBo dataSourceListBo) { - Objects.requireNonNull(dataSourceListBo, "dataSourceListBo"); - this.statList.add(dataSourceListBo); - } - - public void addResponseTime(JoinResponseTimeBo responseTime) { - Objects.requireNonNull(responseTime, "responseTime"); - this.statList.add(responseTime); - } - - public void addFileDescriptor(JoinFileDescriptorBo fileDescriptor) { - Objects.requireNonNull(fileDescriptor, "fileDescriptor"); - this.statList.add(fileDescriptor); - } - - public void addDirectBuffer(JoinDirectBufferBo directBuffer) { - Objects.requireNonNull(directBuffer, "directBuffer"); - this.statList.add(directBuffer); - } - - public void addTotalThreadCount(JoinTotalThreadCountBo totalThreadCount) { - Objects.requireNonNull(totalThreadCount, "totalThreadCount"); - this.statList.add(totalThreadCount); - } - - public void addLoadedClass(JoinLoadedClassBo loadedClass) { - Objects.requireNonNull(loadedClass, "loadedClass"); - this.statList.add(loadedClass); - } - - public void addMemory(JoinMemoryBo memory) { - Objects.requireNonNull(memory, "memory"); - this.statList.add(memory); - } - - - public void addTransaction(JoinTransactionBo transaction) { - Objects.requireNonNull(transaction, "transaction"); - this.statList.add(transaction); - } - - - public void addActiveTrace(JoinActiveTraceBo activeTrace) { - Objects.requireNonNull(activeTrace, "activeTrace"); - this.statList.add(activeTrace); - } - - public JoinAgentStatBo build() { - return new JoinAgentStatBo(this); - } - } - - @Override - public String toString() { - return "JoinAgentStatBo{" + - "agentId='" + agentId + '\'' + - ", agentStartTimestamp=" + agentStartTimestamp + - ", timestamp=" + timestamp + - ", joinCpuLoadBoList=" + joinCpuLoadBoList + - ", joinMemoryBoList=" + joinMemoryBoList + - ", joinTransactionBoList=" + joinTransactionBoList + - ", joinActiveTraceBoList=" + joinActiveTraceBoList + - ", joinResponseTimeBoList=" + joinResponseTimeBoList + - ", joinDataSourceListBoList=" + joinDataSourceListBoList + - ", joinFileDescriptorBoList=" + joinFileDescriptorBoList + - ", joinDirectBufferBoList=" + joinDirectBufferBoList + - ", joinTotalThreadCountBoList=" + joinTotalThreadCountBoList + - ", joinLoadedClassBoList=" + joinLoadedClassBoList + - '}'; - } -} diff --git a/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinApplicationStatBo.java b/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinApplicationStatBo.java deleted file mode 100644 index d5bc081265f1..000000000000 --- a/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinApplicationStatBo.java +++ /dev/null @@ -1,447 +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.common.server.bo.stat.join; - -import com.navercorp.pinpoint.common.server.util.FilterUtils; - -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.function.BiConsumer; -import java.util.function.Function; -import java.util.stream.Collectors; - -/** - * @author minwoo.jung - */ -public class JoinApplicationStatBo implements JoinStatBo { - public static final JoinApplicationStatBo EMPTY_JOIN_APPLICATION_STAT_BO = newEmptyApplicationStatBo(); - - private static JoinApplicationStatBo newEmptyApplicationStatBo() { - Builder builder = JoinApplicationStatBo.newBuilder(UNKNOWN_ID, Long.MIN_VALUE); - return builder.build(); - } - - private static final long SHIFT_RANGE = 1000 * 5; - - private final String applicationId; - private final List joinCpuLoadBoList; - private final List joinMemoryBoList; - private final List joinTransactionBoList; - private final List joinActiveTraceBoList; - private final List joinResponseTimeBoList; - private final List joinDataSourceListBoList; - private final List joinFileDescriptorBoList; - private final List joinDirectBufferBoList; - private final List joinTotalThreadCountBoList; - private final List joinLoadedClassBoList; - - private final long timestamp; - private final StatType statType; - - protected JoinApplicationStatBo(JoinApplicationStatBo joinApplicationStatBo) { - Objects.requireNonNull(joinApplicationStatBo, "joinApplicationStatBo"); - - this.applicationId = joinApplicationStatBo.getId(); - this.joinCpuLoadBoList = joinApplicationStatBo.getJoinCpuLoadBoList(); - this.joinMemoryBoList = joinApplicationStatBo.getJoinMemoryBoList(); - this.joinTransactionBoList = joinApplicationStatBo.getJoinTransactionBoList(); - this.joinActiveTraceBoList = joinApplicationStatBo.getJoinActiveTraceBoList(); - this.joinResponseTimeBoList = joinApplicationStatBo.getJoinResponseTimeBoList(); - this.joinDataSourceListBoList = joinApplicationStatBo.getJoinDataSourceListBoList(); - this.joinFileDescriptorBoList = joinApplicationStatBo.getJoinFileDescriptorBoList(); - this.joinDirectBufferBoList = joinApplicationStatBo.getJoinDirectBufferBoList(); - this.joinTotalThreadCountBoList = joinApplicationStatBo.getJoinTotalThreadCountBoList(); - this.joinLoadedClassBoList = joinApplicationStatBo.getJoinLoadedClassBoList(); - - this.timestamp = joinApplicationStatBo.getTimestamp(); - this.statType = joinApplicationStatBo.getStatType(); - } - - - JoinApplicationStatBo(Builder builder) { - Objects.requireNonNull(builder, "builder"); - - this.applicationId = builder.applicationId; - this.joinCpuLoadBoList = FilterUtils.filter(builder.statList, JoinCpuLoadBo.class); - this.joinMemoryBoList = FilterUtils.filter(builder.statList, JoinMemoryBo.class); - this.joinTransactionBoList = FilterUtils.filter(builder.statList, JoinTransactionBo.class); - this.joinActiveTraceBoList = FilterUtils.filter(builder.statList, JoinActiveTraceBo.class); - this.joinResponseTimeBoList = FilterUtils.filter(builder.statList, JoinResponseTimeBo.class); - this.joinDataSourceListBoList = FilterUtils.filter(builder.statList, JoinDataSourceListBo.class); - this.joinFileDescriptorBoList = FilterUtils.filter(builder.statList, JoinFileDescriptorBo.class); - this.joinDirectBufferBoList = FilterUtils.filter(builder.statList, JoinDirectBufferBo.class); - this.joinTotalThreadCountBoList = FilterUtils.filter(builder.statList, JoinTotalThreadCountBo.class); - this.joinLoadedClassBoList = FilterUtils.filter(builder.statList, JoinLoadedClassBo.class); - - this.timestamp = builder.timestamp; - this.statType = builder.statType; - - } - - public static JoinApplicationStatBo joinApplicationStatBoByTimeSlice(final List joinApplicationStatBoList) { - if (joinApplicationStatBoList.isEmpty()) { - return EMPTY_JOIN_APPLICATION_STAT_BO; - } - String applicationId = joinApplicationStatBoList.get(0).getId(); - long timestamp = extractMinTimestamp(joinApplicationStatBoList); - JoinApplicationStatBo.Builder builder = JoinApplicationStatBo.newBuilder(applicationId, timestamp); - - Joiner joiner = new Joiner(joinApplicationStatBoList, builder); - joiner.join(JoinApplicationStatBo::getJoinCpuLoadBoList, JoinCpuLoadBo::apply); - joiner.join(JoinApplicationStatBo::getJoinMemoryBoList, JoinMemoryBo::apply); - joiner.join(JoinApplicationStatBo::getJoinTransactionBoList, JoinTransactionBo::apply); - joiner.join(JoinApplicationStatBo::getJoinActiveTraceBoList, JoinActiveTraceBo::apply); - joiner.join(JoinApplicationStatBo::getJoinResponseTimeBoList, JoinResponseTimeBo::apply); - joiner.join(JoinApplicationStatBo::getJoinDataSourceListBoList, JoinDataSourceListBo::apply); - joiner.join(JoinApplicationStatBo::getJoinFileDescriptorBoList, JoinFileDescriptorBo::apply); - joiner.join(JoinApplicationStatBo::getJoinDirectBufferBoList, JoinDirectBufferBo::apply); - joiner.join(JoinApplicationStatBo::getJoinTotalThreadCountBoList, JoinTotalThreadCountBo::apply); - joiner.join(JoinApplicationStatBo::getJoinLoadedClassBoList, JoinLoadedClassBo::apply); - - return builder.build(); - } - - - - public static class Joiner { - private final List joinApplicationStatBoList; - private final JoinApplicationStatBo.Builder builder; - - public Joiner(List joinApplicationStatBoList, JoinApplicationStatBo.Builder builder) { - this.joinApplicationStatBoList = Objects.requireNonNull(joinApplicationStatBoList, "joinApplicationStatBoList"); - this.builder = Objects.requireNonNull(builder, "builder"); - } - - public interface MappingFunction { - void apply(JoinApplicationStatBo.Builder builder, List t, Long timeStamp); - } - - private void join(Function> fieldSupplier, - MappingFunction joinStatBoTransform) { - Map> joinMap = join(fieldSupplier); - map(joinMap, joinStatBoTransform); - } - - private void map(Map> joinMap, MappingFunction joinStatBoTransform) { - for (Map.Entry> entry : joinMap.entrySet()) { - final Long key = entry.getKey(); - final List statData = entry.getValue(); - - joinStatBoTransform.apply(builder, statData, key); - } - } - - private Map> join(Function> fieldSupplier) { - final Map> result = new HashMap<>(); - for (JoinApplicationStatBo joinApplicationStatBo : joinApplicationStatBoList) { - final List statList = fieldSupplier.apply(joinApplicationStatBo); - for (T statBo : statList) { - long shiftTimestamp = shiftTimestamp(statBo.getTimestamp()); - List joinResponseTimeBoList = result.computeIfAbsent(shiftTimestamp, k -> new ArrayList<>()); - joinResponseTimeBoList.add(statBo); - } - } - return result; - } - - } - - private static long extractMinTimestamp(List joinApplicationStatBoList) { - long minTimestamp = Long.MAX_VALUE; - for (JoinApplicationStatBo joinApplicationStatBo : joinApplicationStatBoList) { - minTimestamp = minTimestamp(joinApplicationStatBo.getJoinCpuLoadBoList(), minTimestamp); - minTimestamp = minTimestamp(joinApplicationStatBo.getJoinMemoryBoList(), minTimestamp); - minTimestamp = minTimestamp(joinApplicationStatBo.getJoinTransactionBoList(), minTimestamp); - minTimestamp = minTimestamp(joinApplicationStatBo.getJoinActiveTraceBoList(), minTimestamp); - minTimestamp = minTimestamp(joinApplicationStatBo.getJoinResponseTimeBoList(), minTimestamp); - minTimestamp = minTimestamp(joinApplicationStatBo.getJoinDataSourceListBoList(), minTimestamp); - minTimestamp = minTimestamp(joinApplicationStatBo.getJoinFileDescriptorBoList(), minTimestamp); - minTimestamp = minTimestamp(joinApplicationStatBo.getJoinDirectBufferBoList(), minTimestamp); - minTimestamp = minTimestamp(joinApplicationStatBo.getJoinTotalThreadCountBoList(), minTimestamp); - minTimestamp = minTimestamp(joinApplicationStatBo.getJoinLoadedClassBoList(), minTimestamp); - } - return minTimestamp; - } - - - private static long minTimestamp(List list, long minTimestamp) { - for (T statBo : list) { - minTimestamp = Math.min(statBo.getTimestamp(), minTimestamp); - } - return minTimestamp; - } - - private static long shiftTimestamp(long timestamp) { - return timestamp - (timestamp % SHIFT_RANGE); - } - - public long getTimestamp() { - return timestamp; - } - - - public String getId() { - return applicationId; - } - - public List getJoinCpuLoadBoList() { - return joinCpuLoadBoList; - } - - public StatType getStatType() { - return statType; - } - - - public List getJoinMemoryBoList() { - return joinMemoryBoList; - } - - public List getJoinTransactionBoList() { - return joinTransactionBoList; - } - - public List getJoinActiveTraceBoList() { - return joinActiveTraceBoList; - } - - public List getJoinResponseTimeBoList() { - return joinResponseTimeBoList; - } - - public List getJoinDataSourceListBoList() { - return joinDataSourceListBoList; - } - - public List getJoinFileDescriptorBoList() { - return joinFileDescriptorBoList; - } - - public List getJoinDirectBufferBoList() { - return joinDirectBufferBoList; - } - - public List getJoinTotalThreadCountBoList() { - return joinTotalThreadCountBoList; - } - - public List getJoinLoadedClassBoList() { - return joinLoadedClassBoList; - } - - public static List createJoinApplicationStatBo(String applicationId, JoinAgentStatBo joinAgentStatBo, long rangeTime) { - List joinApplicationStatBoList = new ArrayList<>(); - List joinAgentStatBoList = splitJoinAgentStatBo(applicationId, joinAgentStatBo, rangeTime); - - for (JoinAgentStatBo sliceJoinAgentStatBo : joinAgentStatBoList) { - JoinApplicationStatBo.Builder builder = JoinApplicationStatBo.newBuilder(applicationId, sliceJoinAgentStatBo.getTimestamp()); - - sliceJoinAgentStatBo.getJoinCpuLoadBoList().forEach(builder::addCpuLoad); - sliceJoinAgentStatBo.getJoinMemoryBoList().forEach(builder::addMemory); - sliceJoinAgentStatBo.getJoinTransactionBoList().forEach(builder::addTransaction); - sliceJoinAgentStatBo.getJoinActiveTraceBoList().forEach(builder::addActiveTrace); - sliceJoinAgentStatBo.getJoinResponseTimeBoList().forEach(builder::addResponseTime); - sliceJoinAgentStatBo.getJoinDataSourceListBoList().forEach(builder::addDataSourceList); - sliceJoinAgentStatBo.getJoinFileDescriptorBoList().forEach(builder::addFileDescriptor); - sliceJoinAgentStatBo.getJoinDirectBufferBoList().forEach(builder::addDirectBuffer); - sliceJoinAgentStatBo.getJoinTotalThreadCountBoList().forEach(builder::addTotalThreadCount); - sliceJoinAgentStatBo.getJoinLoadedClassBoList().forEach(builder::addLoadedClass); - - joinApplicationStatBoList.add(builder.build()); - } - - return joinApplicationStatBoList; - } - - private static List splitJoinAgentStatBo(String applicationId, JoinAgentStatBo joinAgentStatBo, long rangeTime) { - Slicer slicer = new Slicer(applicationId, rangeTime); - - slicer.slice(joinAgentStatBo.getJoinCpuLoadBoList(), JoinAgentStatBo.Builder::addCpuLoadBo); - slicer.slice(joinAgentStatBo.getJoinMemoryBoList(), JoinAgentStatBo.Builder::addMemory); - slicer.slice(joinAgentStatBo.getJoinTransactionBoList(), JoinAgentStatBo.Builder::addTransaction); - slicer.slice(joinAgentStatBo.getJoinActiveTraceBoList(), JoinAgentStatBo.Builder::addActiveTrace); - slicer.slice(joinAgentStatBo.getJoinResponseTimeBoList(), JoinAgentStatBo.Builder::addResponseTime); - slicer.slice(joinAgentStatBo.getJoinDataSourceListBoList(), JoinAgentStatBo.Builder::addDataSourceListBo); - slicer.slice(joinAgentStatBo.getJoinFileDescriptorBoList(), JoinAgentStatBo.Builder::addFileDescriptor); - slicer.slice(joinAgentStatBo.getJoinDirectBufferBoList(), JoinAgentStatBo.Builder::addDirectBuffer); - slicer.slice(joinAgentStatBo.getJoinTotalThreadCountBoList(), JoinAgentStatBo.Builder::addTotalThreadCount); - slicer.slice(joinAgentStatBo.getJoinLoadedClassBoList(), JoinAgentStatBo.Builder::addLoadedClass); - return slicer.build(); - } - - public static class Slicer { - private final Map joinAgentStatBoMap = new HashMap<>(); - private final String applicationId; - private final long rangeTime; - - public Slicer(String applicationId, long rangeTime) { - this.applicationId = Objects.requireNonNull(applicationId, "applicationId"); - this.rangeTime = rangeTime; - } - - public void slice(List agentStatList, BiConsumer consumer) { - if (agentStatList == null) { - return; - } - - final Map> result = map(agentStatList); - - for (Map.Entry> entry : result.entrySet()) { - long time = entry.getKey(); - JoinAgentStatBo.Builder statBo = getORCreateJoinAgentStatBo(applicationId, time); - List value = entry.getValue(); - for (T t : value) { - consumer.accept(statBo, t); - } - } - } - - private Map> map(List agentStatList) { - final Map> result = new HashMap<>(); - for (T joinStatListBo : agentStatList) { - long timestamp = joinStatListBo.getTimestamp(); - long time = timestamp - (timestamp % rangeTime); - - List statList = result.computeIfAbsent(time, k -> new ArrayList<>()); - statList.add(joinStatListBo); - } - return result; - } - - - private JoinAgentStatBo.Builder getORCreateJoinAgentStatBo(String applicationId, long time) { - JoinAgentStatBo.Builder joinAgentStatBo = joinAgentStatBoMap.get(time); - if (joinAgentStatBo == null) { - joinAgentStatBo = new JoinAgentStatBo.Builder(applicationId, Long.MIN_VALUE, time); - joinAgentStatBoMap.put(time, joinAgentStatBo); - } - - return joinAgentStatBo; - } - - public List build() { - return joinAgentStatBoMap.values().stream() - .map(JoinAgentStatBo.Builder::build) - .collect(Collectors.toList()); - } - } - - public static Builder newBuilder(String applicationId, long timestamp) { - return new Builder(applicationId, timestamp); - } - - public static class Builder { - private final String applicationId; - private final long timestamp; - private StatType statType = StatType.APP_STST; - - private final List statList = new ArrayList<>(); - - Builder(String applicationId, long timestamp) { - this.applicationId = Objects.requireNonNull(applicationId, "applicationId"); - this.timestamp = timestamp; - } - - - public void addCpuLoad(JoinCpuLoadBo joinCpuLoadBoList) { - Objects.requireNonNull(joinCpuLoadBoList, "joinCpuLoadBoList"); - this.statList.add(joinCpuLoadBoList); - } - - public void setStatType(StatType statType) { - this.statType = Objects.requireNonNull(statType, "statType"); - } - - public void addMemory(JoinMemoryBo joinMemory) { - Objects.requireNonNull(joinMemory, "joinMemory"); - this.statList.add(joinMemory); - - } - - public void addTransaction(JoinTransactionBo joinTransaction) { - Objects.requireNonNull(joinTransaction, "joinTransaction"); - this.statList.add(joinTransaction); - } - - public void addActiveTrace(JoinActiveTraceBo joinActiveTrace) { - Objects.requireNonNull(joinActiveTrace, "joinActiveTrace"); - this.statList.add(joinActiveTrace); - } - - - public void addResponseTime(JoinResponseTimeBo joinResponseTime) { - Objects.requireNonNull(joinResponseTime, "joinResponseTime"); - this.statList.add(joinResponseTime); - } - - public void addDataSourceList(JoinDataSourceListBo joinDataSourceList) { - Objects.requireNonNull(joinDataSourceList, "joinDataSourceList"); - this.statList.add(joinDataSourceList); - } - - - public void addFileDescriptor(JoinFileDescriptorBo joinFileDescriptor) { - Objects.requireNonNull(joinFileDescriptor, "joinFileDescriptor"); - this.statList.add(joinFileDescriptor); - } - - - public void addDirectBuffer(JoinDirectBufferBo joinDirectBuffer) { - Objects.requireNonNull(joinDirectBuffer, "joinDirectBuffer"); - this.statList.add(joinDirectBuffer); - } - - public void addTotalThreadCount(JoinTotalThreadCountBo joinTotalThreadCount) { - Objects.requireNonNull(joinTotalThreadCount, "joinTotalThreadCount"); - this.statList.add(joinTotalThreadCount); - } - - public void addLoadedClass(JoinLoadedClassBo joinLoadedClass) { - Objects.requireNonNull(joinLoadedClass, "joinLoadedClass"); - this.statList.add(joinLoadedClass); - } - - public JoinApplicationStatBo build() { - - return new JoinApplicationStatBo(this); - } - - } - - - @Override - public String toString() { - return "JoinApplicationStatBo{" + - ", timestamp=" + new Date(timestamp) + - ", applicationId='" + applicationId + '\'' + - ", joinCpuLoadBoList=" + joinCpuLoadBoList + - ", joinMemoryBoList=" + joinMemoryBoList + - ", joinTransactionBoList=" + joinTransactionBoList + - ", joinActiveTraceBoList=" + joinActiveTraceBoList + - ", joinResponseTimeBoList=" + joinResponseTimeBoList + - ", joinDataSourceListBoList=" + joinDataSourceListBoList + - ", joinFileDescriptorBoList=" + joinFileDescriptorBoList + - ", joinDirectBufferBoList=" + joinDirectBufferBoList + - ", joinTotalThreadCountBoList=" + joinTotalThreadCountBoList + - ", joinLoadedClassBoList=" + joinLoadedClassBoList + - ", statType=" + statType + - '}'; - } -} diff --git a/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinCpuLoadBo.java b/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinCpuLoadBo.java deleted file mode 100644 index ff9f93ffa710..000000000000 --- a/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinCpuLoadBo.java +++ /dev/null @@ -1,143 +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.common.server.bo.stat.join; - -import java.util.List; -import java.util.Objects; -import java.util.stream.Collectors; - -/** - * @author minwoo.jung - */ -public class JoinCpuLoadBo implements JoinStatBo { - public static final JoinCpuLoadBo EMPTY_JOIN_CPU_LOAD_BO = new JoinCpuLoadBo(); - public static final double UNCOLLECTED_VALUE = -1; - - private String id = UNKNOWN_ID; - private long timestamp = Long.MIN_VALUE; - - private JoinDoubleFieldBo jvmCpuLoadJoinValue = JoinDoubleFieldBo.UNCOLLECTED_FIELD_BO; - private JoinDoubleFieldBo systemCpuLoadJoinValue = JoinDoubleFieldBo.UNCOLLECTED_FIELD_BO; - - public JoinCpuLoadBo() { - } - - public JoinCpuLoadBo(String id, double jvmCpuLoad, double maxJvmCpuLoad, String maxJvmCpuAgentId, double minJvmCpuLoad, String minJvmCpuAgentId, double systemCpuLoad, double maxSystemCpuLoad, String maxSysCpuAgentId, double minSystemCpuLoad, String minSysCpuAgentId, long timestamp) { - this(id, new JoinDoubleFieldBo(jvmCpuLoad, minJvmCpuLoad, minJvmCpuAgentId, maxJvmCpuLoad, maxJvmCpuAgentId), - new JoinDoubleFieldBo(systemCpuLoad, minSystemCpuLoad, minSysCpuAgentId, maxSystemCpuLoad, maxSysCpuAgentId), timestamp); - } - - public JoinCpuLoadBo(String id, JoinDoubleFieldBo jvmCpuLoadJoinValue, JoinDoubleFieldBo systemCpuLoadJoinValue, long timestamp) { - this.id = id; - this.jvmCpuLoadJoinValue = Objects.requireNonNull(jvmCpuLoadJoinValue, "jvmCpuLoadJoinValue"); - this.systemCpuLoadJoinValue = Objects.requireNonNull(systemCpuLoadJoinValue, "systemCpuLoadJoinValue"); - this.timestamp = timestamp; - } - - public static void apply(JoinApplicationStatBo.Builder builder, List joinCpuLoadBoList, Long timestamp) { - builder.addCpuLoad(joinCpuLoadBoList(joinCpuLoadBoList, timestamp)); - } - - public static JoinCpuLoadBo joinCpuLoadBoList(List joinCpuLoadBoList, Long timestamp) { - if (joinCpuLoadBoList.isEmpty()) { - return EMPTY_JOIN_CPU_LOAD_BO; - } - - final List jvmCpuLoadFieldBoList = joinCpuLoadBoList.stream() - .map(JoinCpuLoadBo::getJvmCpuLoadJoinValue).collect(Collectors.toList()); - final JoinDoubleFieldBo jvmCpuLoadJoinValue = JoinDoubleFieldBo.merge(jvmCpuLoadFieldBoList); - - final List systemCpuLoadFieldBoList = joinCpuLoadBoList.stream() - .map(JoinCpuLoadBo::getSystemCpuLoadJoinValue).collect(Collectors.toList()); - final JoinDoubleFieldBo systenCpuLoadJoinValue = JoinDoubleFieldBo.merge(systemCpuLoadFieldBoList); - - JoinCpuLoadBo firstJoinCpuLoadBo = joinCpuLoadBoList.get(0); - - JoinCpuLoadBo newJoinCpuLoadBo = new JoinCpuLoadBo(); - newJoinCpuLoadBo.setId(firstJoinCpuLoadBo.getId()); - newJoinCpuLoadBo.setTimestamp(timestamp); - newJoinCpuLoadBo.setJvmCpuLoadJoinValue(jvmCpuLoadJoinValue); - newJoinCpuLoadBo.setSystemCpuLoadJoinValue(systenCpuLoadJoinValue); - return newJoinCpuLoadBo; - } - - public void setId(String id) { - this.id = id; - } - - public String getId() { - return id; - } - - @Override - public long getTimestamp() { - return timestamp; - } - - public void setTimestamp(long timestamp) { - this.timestamp = timestamp; - } - - public JoinDoubleFieldBo getJvmCpuLoadJoinValue() { - return jvmCpuLoadJoinValue; - } - - public void setJvmCpuLoadJoinValue(JoinDoubleFieldBo jvmCpuLoadJoinValue) { - this.jvmCpuLoadJoinValue = jvmCpuLoadJoinValue; - } - - public JoinDoubleFieldBo getSystemCpuLoadJoinValue() { - return systemCpuLoadJoinValue; - } - - public void setSystemCpuLoadJoinValue(JoinDoubleFieldBo systemCpuLoadJoinValue) { - this.systemCpuLoadJoinValue = systemCpuLoadJoinValue; - } - - @Override - public String toString() { - final StringBuilder sb = new StringBuilder("JoinCpuLoadBo{"); - sb.append("id='").append(id).append('\''); - sb.append(", timestamp=").append(timestamp); - sb.append(", jvmCpuLoadJoinValue=").append(jvmCpuLoadJoinValue); - sb.append(", systemCpuLoadJoinValue=").append(systemCpuLoadJoinValue); - sb.append('}'); - return sb.toString(); - } - - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - JoinCpuLoadBo that = (JoinCpuLoadBo) o; - - if (timestamp != that.timestamp) return false; - if (id != null ? !id.equals(that.id) : that.id != null) return false; - if (jvmCpuLoadJoinValue != null ? !jvmCpuLoadJoinValue.equals(that.jvmCpuLoadJoinValue) : that.jvmCpuLoadJoinValue != null) return false; - return systemCpuLoadJoinValue != null ? systemCpuLoadJoinValue.equals(that.systemCpuLoadJoinValue) : that.systemCpuLoadJoinValue == null; - } - - @Override - public int hashCode() { - int result = id != null ? id.hashCode() : 0; - result = 31 * result + (int) (timestamp ^ (timestamp >>> 32)); - result = 31 * result + (jvmCpuLoadJoinValue != null ? jvmCpuLoadJoinValue.hashCode() : 0); - result = 31 * result + (systemCpuLoadJoinValue != null ? systemCpuLoadJoinValue.hashCode() : 0); - return result; - } -} diff --git a/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinDataSourceBo.java b/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinDataSourceBo.java deleted file mode 100644 index 1a156c725c0b..000000000000 --- a/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinDataSourceBo.java +++ /dev/null @@ -1,132 +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.common.server.bo.stat.join; - -import java.util.List; -import java.util.Objects; -import java.util.stream.Collectors; - -/** - * @author minwoo.jung - */ -public class JoinDataSourceBo implements JoinStatBo { - public static final JoinDataSourceBo EMPTY_JOIN_DATA_SOURCE_BO = new JoinDataSourceBo(); - public static final int UNCOLLECTED_VALUE = -1; - private static final short UNDEFINED_CATEGORY = -1; - private static final String EMPTY_URL = ""; - - private short serviceTypeCode = UNDEFINED_CATEGORY; - private String url = EMPTY_URL; - private JoinIntFieldBo activeConnectionSizeJoinValue = JoinIntFieldBo.UNCOLLECTED_FIELD_BO; - - public JoinDataSourceBo() { - } - - public JoinDataSourceBo(short serviceTypeCode, String url, int avgActiveConnectionSize, int minActiveConnectionSize, String minActiveConnectionAgentId, int maxActiveConnectionSize, String maxActiveConnectionAgentId) { - this(serviceTypeCode, url, new JoinIntFieldBo(avgActiveConnectionSize, minActiveConnectionSize, minActiveConnectionAgentId, maxActiveConnectionSize, maxActiveConnectionAgentId)); - } - - public JoinDataSourceBo(short serviceTypeCode, String url, JoinIntFieldBo activeConnectionSizeJoinValue) { - this.serviceTypeCode = serviceTypeCode; - this.url = url; - this.activeConnectionSizeJoinValue = Objects.requireNonNull(activeConnectionSizeJoinValue, "activeConnectionSizeJoinValue"); - } - - public short getServiceTypeCode() { - return serviceTypeCode; - } - - public String getUrl() { - return url; - } - - public JoinIntFieldBo getActiveConnectionSizeJoinValue() { - return activeConnectionSizeJoinValue; - } - - public void setServiceTypeCode(short serviceTypeCode) { - this.serviceTypeCode = serviceTypeCode; - } - - public void setUrl(String url) { - this.url = url; - } - - public void setActiveConnectionSizeJoinValue(JoinIntFieldBo activeConnectionSizeJoinValue) { - this.activeConnectionSizeJoinValue = activeConnectionSizeJoinValue; - } - - @Override - public long getTimestamp() { - throw new UnsupportedOperationException(); - } - - @Override - public String getId() { - throw new UnsupportedOperationException(); - } - - public static JoinDataSourceBo joinDataSourceBoList(List joinDataSourceBoList) { - final int boCount = joinDataSourceBoList.size(); - if (boCount == 0) { - return JoinDataSourceBo.EMPTY_JOIN_DATA_SOURCE_BO; - } - - List activeConnectionSizeFieldBoList = joinDataSourceBoList.stream() - .map(JoinDataSourceBo::getActiveConnectionSizeJoinValue) - .collect(Collectors.toList()); - JoinIntFieldBo activeConnectionSizeJoinValue = JoinIntFieldBo.merge(activeConnectionSizeFieldBoList); - - final JoinDataSourceBo firstJoindataSourceBo = joinDataSourceBoList.get(0); - - final JoinDataSourceBo newJoinDataSourceBo = new JoinDataSourceBo(); - newJoinDataSourceBo.setServiceTypeCode(firstJoindataSourceBo.getServiceTypeCode()); - newJoinDataSourceBo.setUrl(firstJoindataSourceBo.getUrl()); - newJoinDataSourceBo.setActiveConnectionSizeJoinValue(activeConnectionSizeJoinValue); - return newJoinDataSourceBo; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - JoinDataSourceBo that = (JoinDataSourceBo) o; - - if (serviceTypeCode != that.serviceTypeCode) return false; - if (url != null ? !url.equals(that.url) : that.url != null) return false; - return activeConnectionSizeJoinValue != null ? activeConnectionSizeJoinValue.equals(that.activeConnectionSizeJoinValue) : that.activeConnectionSizeJoinValue == null; - } - - @Override - public int hashCode() { - int result = (int) serviceTypeCode; - result = 31 * result + (url != null ? url.hashCode() : 0); - result = 31 * result + (activeConnectionSizeJoinValue != null ? activeConnectionSizeJoinValue.hashCode() : 0); - return result; - } - - @Override - public String toString() { - final StringBuilder sb = new StringBuilder("JoinDataSourceBo{"); - sb.append("serviceTypeCode=").append(serviceTypeCode); - sb.append(", url='").append(url).append('\''); - sb.append(", activeConnectionSizeJoinValue=").append(activeConnectionSizeJoinValue); - sb.append('}'); - return sb.toString(); - } - -} diff --git a/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinDataSourceListBo.java b/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinDataSourceListBo.java deleted file mode 100644 index f3ec0b4e059c..000000000000 --- a/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinDataSourceListBo.java +++ /dev/null @@ -1,173 +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.common.server.bo.stat.join; - -import java.util.*; - -/** - * @author minwoo.jung - */ -public class JoinDataSourceListBo implements JoinStatBo { - - public static final JoinDataSourceListBo EMPTY_JOIN_DATA_SOURCE_LIST_BO = new JoinDataSourceListBo(); - - private List joinDataSourceBoList = Collections.emptyList(); - private String id = UNKNOWN_ID; - private long timestamp = Long.MIN_VALUE; - - public JoinDataSourceListBo() { - } - - public JoinDataSourceListBo(String id, List joinDataSourceBoList, long timestamp) { - this.id = id; - this.timestamp = timestamp; - this.joinDataSourceBoList = joinDataSourceBoList; - } - - public List getJoinDataSourceBoList() { - return joinDataSourceBoList; - } - - public void setJoinDataSourceBoList(List joinDataSourceBoList) { - this.joinDataSourceBoList = joinDataSourceBoList; - } - - public void setId(String id) { - this.id = id; - } - - @Override - public long getTimestamp() { - return timestamp; - } - - @Override - public String getId() { - return id; - } - - public void setTimestamp(long timestamp) { - this.timestamp = timestamp; - } - - public static void apply(JoinApplicationStatBo.Builder builder, List joinDataSourceListBoList, Long timestamp) { - builder.addDataSourceList(joinDataSourceListBoList(joinDataSourceListBoList, timestamp)); - } - - public static JoinDataSourceListBo joinDataSourceListBoList(List joinDataSourceListBoList, Long timestamp) { - if (joinDataSourceListBoList.isEmpty()) { - return EMPTY_JOIN_DATA_SOURCE_LIST_BO; - } - - JoinDataSourceListBo newJoinDataSourceListBo = new JoinDataSourceListBo(); - JoinDataSourceListBo initJoinDataSourceListBo = joinDataSourceListBoList.get(0); - newJoinDataSourceListBo.setId(initJoinDataSourceListBo.getId()); - newJoinDataSourceListBo.setTimestamp(timestamp); - newJoinDataSourceListBo.setJoinDataSourceBoList(joinDatasourceBo(joinDataSourceListBoList)); - - return newJoinDataSourceListBo; - } - - private static List joinDatasourceBo(List joinDataSourceListBoList) { - Map> dataSourceBoListMap = new HashMap<>(); - - for (JoinDataSourceListBo joinDataSourceListBo : joinDataSourceListBoList) { - List dataSourceBoList = joinDataSourceListBo.getJoinDataSourceBoList(); - - for (JoinDataSourceBo joinDataSourceBo : dataSourceBoList) { - DataSourceKey dataSourceKey = new DataSourceKey(joinDataSourceBo.getUrl(), joinDataSourceBo.getServiceTypeCode()); - List joinDataSourceBoList = dataSourceBoListMap.computeIfAbsent(dataSourceKey, k -> new ArrayList<>()); - - joinDataSourceBoList.add(joinDataSourceBo); - } - } - - List newJoinDatasourceBoList = new ArrayList<>(); - - for (List joinDataSourceBoList : dataSourceBoListMap.values()) { - JoinDataSourceBo newJoinDataSourceBo = JoinDataSourceBo.joinDataSourceBoList(joinDataSourceBoList); - newJoinDatasourceBoList.add(newJoinDataSourceBo); - } - - return newJoinDatasourceBoList; - } - - public static class DataSourceKey { - String url; - short serviceTypeCode; - - public DataSourceKey(String url, short serviceTypeCode) { - this.url = url; - this.serviceTypeCode = serviceTypeCode; - } - - public String getUrl() { - return url; - } - - public short getServiceTypeCode() { - return serviceTypeCode; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - DataSourceKey that = (DataSourceKey) o; - - if (serviceTypeCode != that.serviceTypeCode) return false; - return url != null ? url.equals(that.url) : that.url == null; - - } - - @Override - public int hashCode() { - int result = url != null ? url.hashCode() : 0; - result = 31 * result + serviceTypeCode; - return result; - } - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - JoinDataSourceListBo that = (JoinDataSourceListBo) o; - - if (timestamp != that.timestamp) return false; - if (!joinDataSourceBoList.equals(that.joinDataSourceBoList)) return false; - return id.equals(that.id); - } - - @Override - public int hashCode() { - int result = joinDataSourceBoList.hashCode(); - result = 31 * result + id.hashCode(); - result = 31 * result + (int) (timestamp ^ (timestamp >>> 32)); - return result; - } - - @Override - public String toString() { - return "JoinDataSourceListBo{" + - "timestamp=" + new Date(timestamp) + - "joinDataSourceBoList=" + joinDataSourceBoList + - ", id='" + id + '\'' + - '}'; - } -} diff --git a/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinDirectBufferBo.java b/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinDirectBufferBo.java deleted file mode 100644 index 267d8bedbbfb..000000000000 --- a/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinDirectBufferBo.java +++ /dev/null @@ -1,193 +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.common.server.bo.stat.join; - -import java.util.List; -import java.util.Objects; -import java.util.function.Function; -import java.util.stream.Collectors; - -/** - * @author Roy Kim - */ -public class JoinDirectBufferBo implements JoinStatBo { - public static final JoinDirectBufferBo EMPTY_JOIN_DIRECT_BUFFER_BO = new JoinDirectBufferBo(); - public static final long UNCOLLECTED_VALUE = -1; - - private String id = UNKNOWN_ID; - private long timestamp = Long.MIN_VALUE; - - private JoinLongFieldBo directCountJoinValue = JoinLongFieldBo.UNCOLLECTED_FIELD_BO; - private JoinLongFieldBo directMemoryUsedJoinValue = JoinLongFieldBo.UNCOLLECTED_FIELD_BO; - private JoinLongFieldBo mappedCountJoinValue = JoinLongFieldBo.UNCOLLECTED_FIELD_BO; - private JoinLongFieldBo mappedMemoryUsedJoinValue = JoinLongFieldBo.UNCOLLECTED_FIELD_BO; - - public JoinDirectBufferBo() { - } - - public JoinDirectBufferBo(String id, long avgDirectCount, long maxDirectCount, String maxDirectCountAgentId, long minDirectCount, String minDirectCountAgentId - , long avgDirectMemoryUsed, long maxDirectMemoryUsed, String maxDirectMemoryUsedAgentId, long minDirectMemoryUsed, String minDirectMemoryUsedAgentId - , long avgMappedCount, long maxMappedCount, String maxMappedCountAgentId, long minMappedCount, String minMappedCountAgentId - , long avgMappedMemoryUsed, long maxMappedMemoryUsed, String maxMappedMemoryUsedAgentId, long minMappedMemoryUsed, String minMappedMemoryUsedAgentId - , long timestamp) { - this(id, - new JoinLongFieldBo(avgDirectCount, minDirectCount, minDirectCountAgentId, maxDirectCount, maxDirectCountAgentId), - new JoinLongFieldBo(avgDirectMemoryUsed, minDirectMemoryUsed, minDirectMemoryUsedAgentId, maxDirectMemoryUsed, maxDirectMemoryUsedAgentId), - new JoinLongFieldBo(avgMappedCount, minMappedCount, minMappedCountAgentId, maxMappedCount, maxMappedCountAgentId), - new JoinLongFieldBo(avgMappedMemoryUsed, minMappedMemoryUsed, minMappedMemoryUsedAgentId, maxMappedMemoryUsed, maxMappedMemoryUsedAgentId), timestamp); - } - - - public JoinDirectBufferBo(String id, JoinLongFieldBo directCountJoinValue, JoinLongFieldBo directMemoryUsedJoinValue, - JoinLongFieldBo mappedCountJoinValue, JoinLongFieldBo mappedMemoryUsedJoinValue, long timestamp) { - this.id = id; - this.timestamp = timestamp; - this.directCountJoinValue = Objects.requireNonNull(directCountJoinValue, "directCountJoinValue"); - this.directMemoryUsedJoinValue = Objects.requireNonNull(directMemoryUsedJoinValue, "directMemoryUsedJoinValue"); - this.mappedCountJoinValue = Objects.requireNonNull(mappedCountJoinValue, "mappedCountJoinValue"); - this.mappedMemoryUsedJoinValue = Objects.requireNonNull(mappedMemoryUsedJoinValue, "mappedMemoryUsedJoinValue"); - } - - - public static void apply(JoinApplicationStatBo.Builder builder, List joinDirectBufferBoList, Long timestamp) { - builder.addDirectBuffer(joinDirectBufferBoList(joinDirectBufferBoList, timestamp)); - } - - public static JoinDirectBufferBo joinDirectBufferBoList(List joinDirectBufferBoList, Long timestamp) { - if (joinDirectBufferBoList.isEmpty()) { - return EMPTY_JOIN_DIRECT_BUFFER_BO; - } - - List directCountFieldBoList = mapping(joinDirectBufferBoList, JoinDirectBufferBo::getDirectCountJoinValue); - JoinLongFieldBo directCountJoinValue = JoinLongFieldBo.merge(directCountFieldBoList); - - List directMemoryUsedFieldBoList = mapping(joinDirectBufferBoList, JoinDirectBufferBo::getDirectMemoryUsedJoinValue); - JoinLongFieldBo directMemoryUsedJoinValue = JoinLongFieldBo.merge(directMemoryUsedFieldBoList); - - List mappedCountFieldBoList = mapping(joinDirectBufferBoList, JoinDirectBufferBo::getMappedCountJoinValue); - JoinLongFieldBo mappedCountJoinValue = JoinLongFieldBo.merge(mappedCountFieldBoList); - - List mappedMemoryUsedFieldBoList = mapping(joinDirectBufferBoList, JoinDirectBufferBo::getMappedMemoryUsedJoinValue); - JoinLongFieldBo mappedMemoryUsedJoinValue = JoinLongFieldBo.merge(mappedMemoryUsedFieldBoList); - - JoinDirectBufferBo firstJoinDirectBufferBo = joinDirectBufferBoList.get(0); - - JoinDirectBufferBo newJoinDirectBufferBo = new JoinDirectBufferBo(); - newJoinDirectBufferBo.setId(firstJoinDirectBufferBo.getId()); - newJoinDirectBufferBo.setTimestamp(timestamp); - newJoinDirectBufferBo.setDirectCountJoinValue(directCountJoinValue); - newJoinDirectBufferBo.setDirectMemoryUsedJoinValue(directMemoryUsedJoinValue); - newJoinDirectBufferBo.setMappedCountJoinValue(mappedCountJoinValue); - newJoinDirectBufferBo.setMappedMemoryUsedJoinValue(mappedMemoryUsedJoinValue); - return newJoinDirectBufferBo; - } - - private static List mapping(List values, Function mapper) { - return values.stream() - .map(mapper) - .collect(Collectors.toList()); - } - - @Override - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - @Override - public long getTimestamp() { - return timestamp; - } - - public void setTimestamp(long timestamp) { - this.timestamp = timestamp; - } - - public JoinLongFieldBo getDirectCountJoinValue() { - return directCountJoinValue; - } - - public void setDirectCountJoinValue(JoinLongFieldBo directCountJoinValue) { - this.directCountJoinValue = directCountJoinValue; - } - - public JoinLongFieldBo getDirectMemoryUsedJoinValue() { - return directMemoryUsedJoinValue; - } - - public void setDirectMemoryUsedJoinValue(JoinLongFieldBo directMemoryUsedJoinValue) { - this.directMemoryUsedJoinValue = directMemoryUsedJoinValue; - } - - public JoinLongFieldBo getMappedCountJoinValue() { - return mappedCountJoinValue; - } - - public void setMappedCountJoinValue(JoinLongFieldBo mappedCountJoinValue) { - this.mappedCountJoinValue = mappedCountJoinValue; - } - - public JoinLongFieldBo getMappedMemoryUsedJoinValue() { - return mappedMemoryUsedJoinValue; - } - - public void setMappedMemoryUsedJoinValue(JoinLongFieldBo mappedMemoryUsedJoinValue) { - this.mappedMemoryUsedJoinValue = mappedMemoryUsedJoinValue; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - JoinDirectBufferBo that = (JoinDirectBufferBo) o; - - if (timestamp != that.timestamp) return false; - if (id != null ? !id.equals(that.id) : that.id != null) return false; - if (directCountJoinValue != null ? !directCountJoinValue.equals(that.directCountJoinValue) : that.directCountJoinValue != null) return false; - if (directMemoryUsedJoinValue != null ? !directMemoryUsedJoinValue.equals(that.directMemoryUsedJoinValue) : that.directMemoryUsedJoinValue != null) return false; - if (mappedCountJoinValue != null ? !mappedCountJoinValue.equals(that.mappedCountJoinValue) : that.mappedCountJoinValue != null) return false; - return mappedMemoryUsedJoinValue != null ? mappedMemoryUsedJoinValue.equals(that.mappedMemoryUsedJoinValue) : that.mappedMemoryUsedJoinValue == null; - } - - @Override - public int hashCode() { - int result = id != null ? id.hashCode() : 0; - result = 31 * result + (int) (timestamp ^ (timestamp >>> 32)); - result = 31 * result + (directCountJoinValue != null ? directCountJoinValue.hashCode() : 0); - result = 31 * result + (directMemoryUsedJoinValue != null ? directMemoryUsedJoinValue.hashCode() : 0); - result = 31 * result + (mappedCountJoinValue != null ? mappedCountJoinValue.hashCode() : 0); - result = 31 * result + (mappedMemoryUsedJoinValue != null ? mappedMemoryUsedJoinValue.hashCode() : 0); - return result; - } - - @Override - public String toString() { - final StringBuilder sb = new StringBuilder("JoinDirectBufferBo{"); - sb.append("id='").append(id).append('\''); - sb.append(", timestamp=").append(timestamp); - sb.append(", directCountJoinValue=").append(directCountJoinValue); - sb.append(", directMemoryUsedJoinValue=").append(directMemoryUsedJoinValue); - sb.append(", mappedCountJoinValue=").append(mappedCountJoinValue); - sb.append(", mappedMemoryUsedJoinValue=").append(mappedMemoryUsedJoinValue); - sb.append('}'); - return sb.toString(); - } - -} diff --git a/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinDoubleFieldBo.java b/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinDoubleFieldBo.java deleted file mode 100644 index a871c387d42f..000000000000 --- a/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinDoubleFieldBo.java +++ /dev/null @@ -1,77 +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.common.server.bo.stat.join; - -import com.navercorp.pinpoint.common.server.bo.serializer.stat.AgentStatUtils; -import com.navercorp.pinpoint.common.util.CollectionUtils; - -import java.util.Comparator; -import java.util.List; -import java.util.NoSuchElementException; - -/** - * @author Taejin Koo - */ -public class JoinDoubleFieldBo extends AbstractJoinFieldBo { - - private static final double UNCOLLECTED_VALUE = -1; - static final JoinDoubleFieldBo UNCOLLECTED_FIELD_BO = new JoinDoubleFieldBo(UNCOLLECTED_VALUE, UNCOLLECTED_VALUE, JoinStatBo.UNKNOWN_AGENT, UNCOLLECTED_VALUE, JoinStatBo.UNKNOWN_AGENT); - - public JoinDoubleFieldBo(Double avgValue, Double minValue, String minAgentId, Double maxValue, String maxAgentId) { - super(avgValue, minValue, minAgentId, maxValue, maxAgentId); - } - - @Override - protected JoinFieldBo getUncollectedValue() { - return UNCOLLECTED_FIELD_BO; - } - - public JoinLongFieldBo toLongFieldBo() { - final long avg = AgentStatUtils.convertDoubleToLong(getAvg()); - final long min = AgentStatUtils.convertDoubleToLong(getMin()); - final long max = AgentStatUtils.convertDoubleToLong(getMax()); - - return new JoinLongFieldBo(avg, min, getMinAgentId(), max, getMaxAgentId()); - } - - protected static JoinDoubleFieldBo merge(List joinDoubleFieldBoList) { - if (CollectionUtils.isEmpty(joinDoubleFieldBoList)) { - return UNCOLLECTED_FIELD_BO; - } - - double avg = joinDoubleFieldBoList.stream() - .mapToDouble(JoinFieldBo::getAvg) - .average() - .orElseThrow(NoSuchElementException::new); - JoinDoubleFieldBo max = joinDoubleFieldBoList.stream() - .max(Comparator.comparing(JoinFieldBo::getMax)) - .orElseThrow(NoSuchElementException::new); - JoinDoubleFieldBo min = joinDoubleFieldBoList.stream() - .min(Comparator.comparing(JoinFieldBo::getMin)) - .orElseThrow(NoSuchElementException::new); - - String maxAgentId = max.getMaxAgentId(); - double maxValue = max.getMax(); - - String minAgentId = min.getMinAgentId(); - double minValue = min.getMin(); - - return new JoinDoubleFieldBo(avg, minValue, minAgentId, maxValue, maxAgentId); - } - -} - diff --git a/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinFieldBo.java b/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinFieldBo.java deleted file mode 100644 index 661b7ad10699..000000000000 --- a/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinFieldBo.java +++ /dev/null @@ -1,34 +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.common.server.bo.stat.join; - -/** - * @author Taejin Koo - */ -public interface JoinFieldBo { - - V getAvg(); - - V getMin(); - - String getMinAgentId(); - - V getMax(); - - String getMaxAgentId(); - -} diff --git a/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinFileDescriptorBo.java b/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinFileDescriptorBo.java deleted file mode 100644 index d09c3b5b2e0c..000000000000 --- a/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinFileDescriptorBo.java +++ /dev/null @@ -1,123 +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.common.server.bo.stat.join; - -import java.util.List; -import java.util.Objects; -import java.util.stream.Collectors; - -/** - * @author Roy Kim - */ -public class JoinFileDescriptorBo implements JoinStatBo { - public static final JoinFileDescriptorBo EMPTY_JOIN_FILE_DESCRIPTOR_BO = new JoinFileDescriptorBo(); - public static final long UNCOLLECTED_VALUE = -1; - - private String id = UNKNOWN_ID; - private long timestamp = Long.MIN_VALUE; - private JoinLongFieldBo openFdCountJoinValue = JoinLongFieldBo.UNCOLLECTED_FIELD_BO; - - public JoinFileDescriptorBo() { - } - - public JoinFileDescriptorBo(String id, long avgOpenFDCount, long maxOpenFDCount, String maxOpenFDCountAgentId, long minOpenFDCount, String minOpenFDCountAgentId, long timestamp) { - this(id, new JoinLongFieldBo(avgOpenFDCount, minOpenFDCount, minOpenFDCountAgentId, maxOpenFDCount, maxOpenFDCountAgentId), timestamp); - } - - public JoinFileDescriptorBo(String id, JoinLongFieldBo openFdCountJoinValue, long timestamp) { - this.id = id; - this.openFdCountJoinValue = Objects.requireNonNull(openFdCountJoinValue, "openFdCountJoinValue"); - this.timestamp = timestamp; - } - - public static void apply(JoinApplicationStatBo.Builder builder, List joinFileDescriptorBoList, Long timestamp) { - builder.addFileDescriptor(joinFileDescriptorBoList(joinFileDescriptorBoList, timestamp)); - } - - public static JoinFileDescriptorBo joinFileDescriptorBoList(List joinFileDescriptorBoList, Long timestamp) { - - if (joinFileDescriptorBoList.isEmpty()) { - return EMPTY_JOIN_FILE_DESCRIPTOR_BO; - } - - List openFdCountFieldBoList = joinFileDescriptorBoList.stream().map(e -> e.openFdCountJoinValue).collect(Collectors.toList()); - JoinLongFieldBo openFdCountJoinValue = JoinLongFieldBo.merge(openFdCountFieldBoList); - - final JoinFileDescriptorBo firstJoinFileDescriptorBo = joinFileDescriptorBoList.get(0); - - final JoinFileDescriptorBo newJoinFileDescriptorBo = new JoinFileDescriptorBo(); - newJoinFileDescriptorBo.setId(firstJoinFileDescriptorBo.getId()); - newJoinFileDescriptorBo.setTimestamp(timestamp); - newJoinFileDescriptorBo.setOpenFdCountJoinValue(openFdCountJoinValue); - - return newJoinFileDescriptorBo; - } - - public JoinLongFieldBo getOpenFdCountJoinValue() { - return openFdCountJoinValue; - } - - public void setOpenFdCountJoinValue(JoinLongFieldBo openFdCountJoinValue) { - this.openFdCountJoinValue = openFdCountJoinValue; - } - - public void setId(String id) { - this.id = id; - } - - public String getId() { - return id; - } - - @Override - public long getTimestamp() { - return timestamp; - } - - public void setTimestamp(long timestamp) { - this.timestamp = timestamp; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - JoinFileDescriptorBo that = (JoinFileDescriptorBo) o; - - if (timestamp != that.timestamp) return false; - if (id != null ? !id.equals(that.id) : that.id != null) return false; - return openFdCountJoinValue != null ? openFdCountJoinValue.equals(that.openFdCountJoinValue) : that.openFdCountJoinValue == null; - } - - @Override - public int hashCode() { - int result = id != null ? id.hashCode() : 0; - result = 31 * result + (int) (timestamp ^ (timestamp >>> 32)); - result = 31 * result + (openFdCountJoinValue != null ? openFdCountJoinValue.hashCode() : 0); - return result; - } - - @Override - public String toString() { - final StringBuilder sb = new StringBuilder("JoinFileDescriptorBo{"); - sb.append("id='").append(id).append('\''); - sb.append(", timestamp=").append(timestamp); - sb.append(", openFdCountJoinValue=").append(openFdCountJoinValue); - sb.append('}'); - return sb.toString(); - } -} diff --git a/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinIntFieldBo.java b/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinIntFieldBo.java deleted file mode 100644 index e8e974d981ce..000000000000 --- a/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinIntFieldBo.java +++ /dev/null @@ -1,68 +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.common.server.bo.stat.join; - -import com.navercorp.pinpoint.common.util.CollectionUtils; - -import java.util.Comparator; -import java.util.List; -import java.util.NoSuchElementException; - -/** - * @author Taejin Koo - */ -public class JoinIntFieldBo extends AbstractJoinFieldBo { - - private static final int UNCOLLECTED_VALUE = -1; - static final JoinIntFieldBo UNCOLLECTED_FIELD_BO = new JoinIntFieldBo(UNCOLLECTED_VALUE, UNCOLLECTED_VALUE, JoinStatBo.UNKNOWN_AGENT, UNCOLLECTED_VALUE, JoinStatBo.UNKNOWN_AGENT); - - public JoinIntFieldBo(Integer avgValue, Integer minValue, String minAgentId, Integer maxValue, String maxAgentId) { - super(avgValue, minValue, minAgentId, maxValue, maxAgentId); - } - - @Override - protected JoinFieldBo getUncollectedValue() { - return UNCOLLECTED_FIELD_BO; - } - - protected static JoinIntFieldBo merge(List joinIntFieldBoList) { - if (CollectionUtils.isEmpty(joinIntFieldBoList)) { - return UNCOLLECTED_FIELD_BO; - } - - double avg = joinIntFieldBoList.stream() - .mapToInt(JoinFieldBo::getAvg) - .average() - .orElseThrow(NoSuchElementException::new); - JoinIntFieldBo max = joinIntFieldBoList.stream() - .max(Comparator.comparing(JoinFieldBo::getMax)) - .orElseThrow(NoSuchElementException::new); - JoinIntFieldBo min = joinIntFieldBoList.stream() - .min(Comparator.comparing(JoinFieldBo::getMin)) - .orElseThrow(NoSuchElementException::new); - - String maxAgentId = max.getMaxAgentId(); - int maxValue = max.getMax(); - - String minAgentId = min.getMinAgentId(); - int minValue = min.getMin(); - - return new JoinIntFieldBo((int) avg, minValue, minAgentId, maxValue, maxAgentId); - } - -} - diff --git a/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinLoadedClassBo.java b/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinLoadedClassBo.java deleted file mode 100644 index 8645bd99733f..000000000000 --- a/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinLoadedClassBo.java +++ /dev/null @@ -1,147 +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.common.server.bo.stat.join; - -import java.util.List; -import java.util.Objects; -import java.util.stream.Collectors; - -public class JoinLoadedClassBo implements JoinStatBo { - public static final JoinLoadedClassBo EMPTY_JOIN_LOADED_CLASS_BO = new JoinLoadedClassBo(); - public static final long UNCOLLECTED_VALUE = -1; - - private String id = UNKNOWN_ID; - private long timestamp = Long.MIN_VALUE; - - private JoinLongFieldBo loadedClassJoinValue = JoinLongFieldBo.UNCOLLECTED_FIELD_BO; - private JoinLongFieldBo unloadedClassJoinValue = JoinLongFieldBo.UNCOLLECTED_FIELD_BO; - - public JoinLoadedClassBo() { - } - - public JoinLoadedClassBo(String id, long avgLoadedClass, long maxLoadedClass, String maxLoadedClassAgentId, long minLoadedClass, String minLoadedClassAgentId, - long avgUnloadedClass, long maxUnloadedClass, String maxUnloadedClassAgentId, long minUnloadedClass, String minUnloadedClassAgentId, - long timestamp) { - this(id, new JoinLongFieldBo(avgLoadedClass, minLoadedClass, minLoadedClassAgentId, maxLoadedClass, maxLoadedClassAgentId), - new JoinLongFieldBo(avgUnloadedClass, minUnloadedClass, minUnloadedClassAgentId, maxUnloadedClass, maxUnloadedClassAgentId), timestamp); - } - - public JoinLoadedClassBo(String id, JoinLongFieldBo loadedClassJoinValue, JoinLongFieldBo unloadedClassJoinValue, long timestamp) { - this.id = id; - this.loadedClassJoinValue = Objects.requireNonNull(loadedClassJoinValue, "loadedClassJoinValue"); - this.unloadedClassJoinValue = Objects.requireNonNull(unloadedClassJoinValue, "unloadedClassJoinValue"); - this.timestamp = timestamp; - } - - public static void apply(JoinApplicationStatBo.Builder builder, List joinLoadedClassBoList, Long timestamp) { - builder.addLoadedClass(joinLoadedClassBoList(joinLoadedClassBoList, timestamp)); - } - - public static JoinLoadedClassBo joinLoadedClassBoList(List joinLoadedClassBoList, Long timestamp) { - if (joinLoadedClassBoList.isEmpty()) { - return EMPTY_JOIN_LOADED_CLASS_BO; - } - - List loadedClassFieldBoList = joinLoadedClassBoList.stream() - .map(JoinLoadedClassBo::getLoadedClassJoinValue).collect(Collectors.toList()); - JoinLongFieldBo loadedClassJoinValue = JoinLongFieldBo.merge(loadedClassFieldBoList); - - List unloadedClassFieldBoList = joinLoadedClassBoList.stream() - .map(JoinLoadedClassBo::getUnloadedClassJoinValue).collect(Collectors.toList()); - JoinLongFieldBo unloadedClassJoinValue = JoinLongFieldBo.merge(unloadedClassFieldBoList); - - JoinLoadedClassBo firstJoinLoadedClassBo = joinLoadedClassBoList.get(0); - - JoinLoadedClassBo newJoinLoadedClassBo = new JoinLoadedClassBo(); - newJoinLoadedClassBo.setId(firstJoinLoadedClassBo.getId()); - newJoinLoadedClassBo.setTimestamp(timestamp); - newJoinLoadedClassBo.setLoadedClassJoinValue(loadedClassJoinValue); - newJoinLoadedClassBo.setUnloadedClassJoinValue(unloadedClassJoinValue); - - return newJoinLoadedClassBo; - } - - @Override - public long getTimestamp() { - return timestamp; - } - - public void setTimestamp(long timestamp) { - this.timestamp = timestamp; - } - - @Override - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public JoinLongFieldBo getLoadedClassJoinValue() { - return loadedClassJoinValue; - } - - public void setLoadedClassJoinValue(JoinLongFieldBo loadedClassJoinValue) { - this.loadedClassJoinValue = loadedClassJoinValue; - } - - public JoinLongFieldBo getUnloadedClassJoinValue() { - return unloadedClassJoinValue; - } - - public void setUnloadedClassJoinValue(JoinLongFieldBo unloadedClassJoinValue) { - this.unloadedClassJoinValue = unloadedClassJoinValue; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - JoinLoadedClassBo that = (JoinLoadedClassBo) o; - - if (timestamp != that.timestamp) return false; - if (!id.equals(that.id)) return false; - if (loadedClassJoinValue != null ? !loadedClassJoinValue.equals(that.loadedClassJoinValue) : that.loadedClassJoinValue != null) return false; - if (unloadedClassJoinValue != null ? !unloadedClassJoinValue.equals(that.unloadedClassJoinValue) : that.unloadedClassJoinValue != null) return false; - - return (unloadedClassJoinValue != null ? unloadedClassJoinValue.equals(that.unloadedClassJoinValue) : that.unloadedClassJoinValue == null); - } - - - @Override - public int hashCode() { - int result = (id != null) ? id.hashCode() : 0; - result = 31 * result + (int) (timestamp ^ (timestamp >>> 32)); - result = 31 * result + (loadedClassJoinValue != null ? loadedClassJoinValue.hashCode() : 0); - result = 31 * result + (unloadedClassJoinValue != null ? unloadedClassJoinValue.hashCode() : 0); - return result; - } - - @Override - public String toString() { - final StringBuilder sb = new StringBuilder("JoinLoadedClassBo{"); - sb.append("id='").append(id).append('\''); - sb.append(", timestamp=").append(timestamp); - sb.append(", loadedClassJoinValue=").append(loadedClassJoinValue); - sb.append(", unloadedClassJoinValue=").append(unloadedClassJoinValue); - sb.append('}'); - return sb.toString(); - } -} diff --git a/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinLongFieldBo.java b/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinLongFieldBo.java deleted file mode 100644 index f303f767f395..000000000000 --- a/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinLongFieldBo.java +++ /dev/null @@ -1,75 +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.common.server.bo.stat.join; - -import com.navercorp.pinpoint.common.server.bo.serializer.stat.AgentStatUtils; -import com.navercorp.pinpoint.common.util.CollectionUtils; - -import java.util.Comparator; -import java.util.List; -import java.util.NoSuchElementException; - -/** - * @author Taejin Koo - */ -public class JoinLongFieldBo extends AbstractJoinFieldBo { - - private static final long UNCOLLECTED_VALUE = -1L; - static final JoinLongFieldBo UNCOLLECTED_FIELD_BO = new JoinLongFieldBo(UNCOLLECTED_VALUE, UNCOLLECTED_VALUE, JoinStatBo.UNKNOWN_AGENT, UNCOLLECTED_VALUE, JoinStatBo.UNKNOWN_AGENT); - - public JoinLongFieldBo(Long avgValue, Long minValue, String minAgentId, Long maxValue, String maxAgentId) { - super(avgValue, minValue, minAgentId, maxValue, maxAgentId); - } - - @Override - protected JoinFieldBo getUncollectedValue() { - return UNCOLLECTED_FIELD_BO; - } - - public JoinDoubleFieldBo toLongFieldBo() { - double avg = AgentStatUtils.convertLongToDouble(getAvg()); - double min = AgentStatUtils.convertLongToDouble(getMin()); - double max = AgentStatUtils.convertLongToDouble(getMax()); - return new JoinDoubleFieldBo(avg, min, getMinAgentId(), max, getMaxAgentId()); - } - - protected static JoinLongFieldBo merge(List joinLongFieldBoList) { - if (CollectionUtils.isEmpty(joinLongFieldBoList)) { - return UNCOLLECTED_FIELD_BO; - } - double avg = joinLongFieldBoList.stream() - .mapToLong(JoinFieldBo::getAvg) - .average() - .orElseThrow(NoSuchElementException::new); - JoinLongFieldBo max = joinLongFieldBoList.stream() - .max(Comparator.comparing(JoinFieldBo::getMax)) - .orElseThrow(NoSuchElementException::new); - JoinLongFieldBo min = joinLongFieldBoList.stream() - .min(Comparator.comparing(JoinFieldBo::getMin)) - .orElseThrow(NoSuchElementException::new); - - String maxAgentId = max.getMaxAgentId(); - long maxValue = max.getMax(); - - String minAgentId = min.getMinAgentId(); - long minValue = min.getMin(); - - return new JoinLongFieldBo((long) avg, minValue, minAgentId, maxValue, maxAgentId); - } - -} - diff --git a/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinMemoryBo.java b/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinMemoryBo.java deleted file mode 100644 index 62af72725109..000000000000 --- a/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinMemoryBo.java +++ /dev/null @@ -1,145 +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.common.server.bo.stat.join; - -import java.util.List; -import java.util.Objects; -import java.util.stream.Collectors; - -/** - * @author minwoo.jung - */ -public class JoinMemoryBo implements JoinStatBo { - public static final JoinMemoryBo EMPTY_JOIN_MEMORY_BO = new JoinMemoryBo(); - public static final long UNCOLLECTED_VALUE = -1; - - private String id = UNKNOWN_ID; - private long timestamp = Long.MIN_VALUE; - - private JoinLongFieldBo heapUsedJoinValue = JoinLongFieldBo.UNCOLLECTED_FIELD_BO; - private JoinLongFieldBo nonHeapUsedJoinValue = JoinLongFieldBo.UNCOLLECTED_FIELD_BO; - - public JoinMemoryBo() { - } - - public JoinMemoryBo(String id, long timestamp, long heapUsed, long minHeapUsed, long maxHeapUsed, String minHeapAgentId, String maxHeapAgentId, long nonHeapUsed, long minNonHeapUsed, long maxNonHeapUsed, String minNonHeapAgentId, String maxNonHeapAgentId) { - this(id, timestamp, new JoinLongFieldBo(heapUsed, minHeapUsed, minHeapAgentId, maxHeapUsed, maxHeapAgentId), new JoinLongFieldBo(nonHeapUsed, minNonHeapUsed, minNonHeapAgentId, maxNonHeapUsed, maxNonHeapAgentId)); - } - - public JoinMemoryBo(String id, long timestamp, JoinLongFieldBo heapUsedJoinValue, JoinLongFieldBo nonHeapUsedJoinValue) { - this.id = id; - this.timestamp = timestamp; - this.heapUsedJoinValue = Objects.requireNonNull(heapUsedJoinValue, "heapUsedJoinValue"); - this.nonHeapUsedJoinValue = Objects.requireNonNull(nonHeapUsedJoinValue, "nonHeapUsedJoinValue"); - } - - public JoinLongFieldBo getHeapUsedJoinValue() { - return heapUsedJoinValue; - } - - public void setHeapUsedJoinValue(JoinLongFieldBo heapUsedJoinValue) { - this.heapUsedJoinValue = heapUsedJoinValue; - } - - public JoinLongFieldBo getNonHeapUsedJoinValue() { - return nonHeapUsedJoinValue; - } - - public void setNonHeapUsedJoinValue(JoinLongFieldBo nonHeapUsedJoinValue) { - this.nonHeapUsedJoinValue = nonHeapUsedJoinValue; - } - - @Override - public long getTimestamp() { - return timestamp; - } - - public void setTimestamp(long timestamp) { - this.timestamp = timestamp; - } - - @Override - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public static void apply(JoinApplicationStatBo.Builder builder, List joinMemoryBoList, Long timestamp) { - builder.addMemory(joinMemoryBoList(joinMemoryBoList, timestamp)); - } - - public static JoinMemoryBo joinMemoryBoList(List joinMemoryBoList, Long timestamp) { - if (joinMemoryBoList.isEmpty()) { - return JoinMemoryBo.EMPTY_JOIN_MEMORY_BO; - } - - List heapUsedFieldBoList = joinMemoryBoList.stream() - .map(JoinMemoryBo::getHeapUsedJoinValue).collect(Collectors.toList()); - final JoinLongFieldBo heapUsedJoinValue = JoinLongFieldBo.merge(heapUsedFieldBoList); - - List nonHeapUsedFieldBoList = joinMemoryBoList.stream() - .map(JoinMemoryBo::getNonHeapUsedJoinValue).collect(Collectors.toList()); - final JoinLongFieldBo nonHeapUsedJoinValue = JoinLongFieldBo.merge(nonHeapUsedFieldBoList); - - - final JoinMemoryBo firstJoinMemoryBo = joinMemoryBoList.get(0); - - final JoinMemoryBo newJoinMemoryBo = new JoinMemoryBo(); - newJoinMemoryBo.setId(firstJoinMemoryBo.getId()); - newJoinMemoryBo.setTimestamp(timestamp); - newJoinMemoryBo.setHeapUsedJoinValue(heapUsedJoinValue); - newJoinMemoryBo.setNonHeapUsedJoinValue(nonHeapUsedJoinValue); - return newJoinMemoryBo; - } - - @Override - public String toString() { - final StringBuilder sb = new StringBuilder("JoinMemoryBo{"); - sb.append("id='").append(id).append('\''); - sb.append(", timestamp=").append(timestamp); - sb.append(", heapUsedJoinValue=").append(heapUsedJoinValue); - sb.append(", nonHeapUsedJoinValue=").append(nonHeapUsedJoinValue); - sb.append('}'); - return sb.toString(); - } - - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - JoinMemoryBo that = (JoinMemoryBo) o; - - if (timestamp != that.timestamp) return false; - if (id != null ? !id.equals(that.id) : that.id != null) return false; - if (heapUsedJoinValue != null ? !heapUsedJoinValue.equals(that.heapUsedJoinValue) : that.heapUsedJoinValue != null) return false; - return nonHeapUsedJoinValue != null ? nonHeapUsedJoinValue.equals(that.nonHeapUsedJoinValue) : that.nonHeapUsedJoinValue == null; - } - - @Override - public int hashCode() { - int result = id != null ? id.hashCode() : 0; - result = 31 * result + (int) (timestamp ^ (timestamp >>> 32)); - result = 31 * result + (heapUsedJoinValue != null ? heapUsedJoinValue.hashCode() : 0); - result = 31 * result + (nonHeapUsedJoinValue != null ? nonHeapUsedJoinValue.hashCode() : 0); - return result; - } - -} diff --git a/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinResponseTimeBo.java b/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinResponseTimeBo.java deleted file mode 100644 index bfd0f85ee5f9..000000000000 --- a/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinResponseTimeBo.java +++ /dev/null @@ -1,127 +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.common.server.bo.stat.join; - -import java.util.List; -import java.util.Objects; -import java.util.stream.Collectors; - -/** - * @author minwoo.jung - */ -public class JoinResponseTimeBo implements JoinStatBo { - - public static final JoinResponseTimeBo EMPTY_JOIN_RESPONSE_TIME_BO = new JoinResponseTimeBo(); - public static final long UNCOLLECTED_VALUE = -1; - - - private String id = UNKNOWN_ID; - private long timestamp = Long.MIN_VALUE; - private JoinLongFieldBo responseTimeJoinValue = JoinLongFieldBo.UNCOLLECTED_FIELD_BO; - - public JoinResponseTimeBo() { - } - - public JoinResponseTimeBo(String id, long timestamp, long avg, long minAvg, String minAvgAgentId, long maxAvg, String maxAvgAgentId) { - this(id, timestamp, new JoinLongFieldBo(avg, minAvg, minAvgAgentId, maxAvg, maxAvgAgentId)); - } - - public JoinResponseTimeBo(String id, long timestamp, JoinLongFieldBo responseTimeJoinValue) { - this.id = id; - this.timestamp = timestamp; - this.responseTimeJoinValue = Objects.requireNonNull(responseTimeJoinValue, "responseTimeJoinValue"); - } - - public void setId(String id) { - this.id = id; - } - - public void setTimestamp(long timestamp) { - this.timestamp = timestamp; - } - - public void setResponseTimeJoinValue(JoinLongFieldBo responseTimeJoinValue) { - this.responseTimeJoinValue = responseTimeJoinValue; - } - - @Override - public String getId() { - return id; - } - - @Override - public long getTimestamp() { - return timestamp; - } - - public JoinLongFieldBo getResponseTimeJoinValue() { - return responseTimeJoinValue; - } - - public static void apply(JoinApplicationStatBo.Builder builder, List joinResponseTimeBoList, Long timestamp) { - builder.addResponseTime(joinResponseTimeBoList(joinResponseTimeBoList, timestamp)); - } - - public static JoinResponseTimeBo joinResponseTimeBoList(List joinResponseTimeBoList, Long timestamp) { - if (joinResponseTimeBoList.isEmpty()) { - return JoinResponseTimeBo.EMPTY_JOIN_RESPONSE_TIME_BO; - } - - List responseTimeFieldBoList = joinResponseTimeBoList.stream() - .map(JoinResponseTimeBo::getResponseTimeJoinValue).collect(Collectors.toList()); - final JoinLongFieldBo responseTimeJoinValue = JoinLongFieldBo.merge(responseTimeFieldBoList); - - final JoinResponseTimeBo firstJoinResponseTimeBo = joinResponseTimeBoList.get(0); - - final JoinResponseTimeBo newJoinResponseTimeBo = new JoinResponseTimeBo(); - newJoinResponseTimeBo.setId(firstJoinResponseTimeBo.getId()); - newJoinResponseTimeBo.setTimestamp(timestamp); - newJoinResponseTimeBo.setResponseTimeJoinValue(responseTimeJoinValue); - - return newJoinResponseTimeBo; - } - - @Override - public String toString() { - final StringBuilder sb = new StringBuilder("JoinResponseTimeBo{"); - sb.append("id='").append(id).append('\''); - sb.append(", timestamp=").append(timestamp); - sb.append(", responseTimeJoinValue=").append(responseTimeJoinValue); - sb.append('}'); - return sb.toString(); - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - JoinResponseTimeBo that = (JoinResponseTimeBo) o; - - if (timestamp != that.timestamp) return false; - if (id != null ? !id.equals(that.id) : that.id != null) return false; - return responseTimeJoinValue != null ? responseTimeJoinValue.equals(that.responseTimeJoinValue) : that.responseTimeJoinValue == null; - } - - @Override - public int hashCode() { - int result = id != null ? id.hashCode() : 0; - result = 31 * result + (int) (timestamp ^ (timestamp >>> 32)); - result = 31 * result + (responseTimeJoinValue != null ? responseTimeJoinValue.hashCode() : 0); - return result; - } - -} diff --git a/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinTotalThreadCountBo.java b/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinTotalThreadCountBo.java deleted file mode 100644 index 1610e13374bb..000000000000 --- a/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinTotalThreadCountBo.java +++ /dev/null @@ -1,118 +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.common.server.bo.stat.join; - -import java.util.List; -import java.util.Objects; -import java.util.stream.Collectors; - -public class JoinTotalThreadCountBo implements JoinStatBo { - public static final JoinTotalThreadCountBo EMPTY_TOTAL_THREAD_COUNT_BO = new JoinTotalThreadCountBo(); - public static final long UNCOLLECTED_VALUE = -1L; - - private String id = UNKNOWN_ID; - private long timestamp = Long.MIN_VALUE; - - private JoinLongFieldBo totalThreadCountJoinValue = JoinLongFieldBo.UNCOLLECTED_FIELD_BO; - - public JoinTotalThreadCountBo() { - } - - public JoinTotalThreadCountBo(String id, long timestamp, long avgTotalThreadCount, - long minTotalThreadCount, String minTotalThreadCountAgentId, - long maxTotalThreadCount, String maxTotalThreadCountAgentId) { - this(id, timestamp, new JoinLongFieldBo(avgTotalThreadCount, minTotalThreadCount, minTotalThreadCountAgentId, maxTotalThreadCount, maxTotalThreadCountAgentId)); - } - - public JoinTotalThreadCountBo(String id, long timestamp, JoinLongFieldBo totalThreadCountJoinValue) { - this.id = id; - this.timestamp = timestamp; - this.totalThreadCountJoinValue = Objects.requireNonNull(totalThreadCountJoinValue, "totalThreadCountJoinValue"); - } - - @Override - public long getTimestamp() { return timestamp; } - - public void setTimestamp(long timestamp) { this.timestamp = timestamp; } - - @Override - public String getId() { return id; } - - public void setId(String id) { this.id = id; } - - public JoinLongFieldBo getTotalThreadCountJoinValue() { - return totalThreadCountJoinValue; - } - - public void setTotalThreadCountJoinValue(JoinLongFieldBo totalThreadCountJoinValue) { - this.totalThreadCountJoinValue = totalThreadCountJoinValue; - } - - public static void apply(JoinApplicationStatBo.Builder builder, List joinTotalThreadCountBoList, Long timestamp) { - builder.addTotalThreadCount(joinTotalThreadCountBoList(joinTotalThreadCountBoList, timestamp)); - } - - public static JoinTotalThreadCountBo joinTotalThreadCountBoList(List joinTotalThreadCountBoList, Long timestamp) { - if (joinTotalThreadCountBoList.isEmpty()) { - return JoinTotalThreadCountBo.EMPTY_TOTAL_THREAD_COUNT_BO; - } - - final List totalThreadCountFieldBoList = joinTotalThreadCountBoList.stream() - .map(JoinTotalThreadCountBo::getTotalThreadCountJoinValue) - .collect(Collectors.toList()); - final JoinLongFieldBo totalThreadCountJoinValue = JoinLongFieldBo.merge(totalThreadCountFieldBoList); - - final JoinTotalThreadCountBo firstJoinTotalThreadCountBo = joinTotalThreadCountBoList.get(0); - - final JoinTotalThreadCountBo newJoinTotalThreadCountBo = new JoinTotalThreadCountBo(); - newJoinTotalThreadCountBo.setId(firstJoinTotalThreadCountBo.getId()); - newJoinTotalThreadCountBo.setTimestamp(timestamp); - newJoinTotalThreadCountBo.setTotalThreadCountJoinValue(totalThreadCountJoinValue); - - return newJoinTotalThreadCountBo; - } - - @Override - public String toString() { - final StringBuilder sb = new StringBuilder("JoinTotalThreadCountBo{"); - sb.append("id='").append(id).append('\''); - sb.append(", timestamp=").append(timestamp); - sb.append(", totalThreadCountJoinValue=").append(totalThreadCountJoinValue); - sb.append('}'); - return sb.toString(); - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - JoinTotalThreadCountBo that = (JoinTotalThreadCountBo) o; - - if (timestamp != that.timestamp) return false; - if (id != null ? !id.equals(that.id) : that.id != null) return false; - return totalThreadCountJoinValue != null ? totalThreadCountJoinValue.equals(that.totalThreadCountJoinValue) : that.totalThreadCountJoinValue == null; - } - - @Override - public int hashCode() { - int result = id != null ? id.hashCode() : 0; - result = 31 * result + (int) (timestamp ^ (timestamp >>> 32)); - result = 31 * result + (totalThreadCountJoinValue != null ? totalThreadCountJoinValue.hashCode() : 0); - return result; - } -} diff --git a/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinTransactionBo.java b/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinTransactionBo.java deleted file mode 100644 index ef62a6b299f9..000000000000 --- a/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinTransactionBo.java +++ /dev/null @@ -1,138 +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.common.server.bo.stat.join; - -import java.util.List; -import java.util.Objects; -import java.util.stream.Collectors; - -/** - * @author minwoo.jung - */ -public class JoinTransactionBo implements JoinStatBo { - public static final JoinTransactionBo EMPTY_JOIN_TRANSACTION_BO = new JoinTransactionBo(); - public static final long UNCOLLECTED_VALUE = -1; - - private String id = UNKNOWN_ID; - private long collectInterval = UNCOLLECTED_VALUE; - private JoinLongFieldBo totalCountJoinValue = JoinLongFieldBo.UNCOLLECTED_FIELD_BO; - private long timestamp = Long.MIN_VALUE; - - public JoinTransactionBo() { - } - - public JoinTransactionBo(String id, long collectInterval, long totalCount, long minTotalCount, String minTotalCountAgentId, long maxTotalCount, String maxTotalCountAgentId, long timestamp) { - this(id, collectInterval, new JoinLongFieldBo(totalCount, minTotalCount, minTotalCountAgentId, maxTotalCount, maxTotalCountAgentId), timestamp); - } - - public JoinTransactionBo(String id, long collectInterval, JoinLongFieldBo totalCountJoinValue, long timestamp) { - this.id = id; - this.collectInterval = collectInterval; - this.totalCountJoinValue = Objects.requireNonNull(totalCountJoinValue, "totalCountJoinValue"); - this.timestamp = timestamp; - } - - public void setTimestamp(long timestamp) { - this.timestamp = timestamp; - } - - public long getCollectInterval() { - return collectInterval; - } - - public void setCollectInterval(long collectInterval) { - this.collectInterval = collectInterval; - } - - public JoinLongFieldBo getTotalCountJoinValue() { - return totalCountJoinValue; - } - - public void setTotalCountJoinValue(JoinLongFieldBo totalCountJoinValue) { - this.totalCountJoinValue = totalCountJoinValue; - } - - @Override - public long getTimestamp() { - return timestamp; - } - - @Override - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public static void apply(JoinApplicationStatBo.Builder builder, List joinTransactionBoList, Long timestamp) { - builder.addTransaction(joinTransactionBoList(joinTransactionBoList, timestamp)); - } - - public static JoinTransactionBo joinTransactionBoList(List joinTransactionBoList, Long timestamp) { - if (joinTransactionBoList.isEmpty()) { - return JoinTransactionBo.EMPTY_JOIN_TRANSACTION_BO; - } - - List totalCountFieldBoList = joinTransactionBoList.stream() - .map(JoinTransactionBo::getTotalCountJoinValue).collect(Collectors.toList()); - final JoinLongFieldBo totalCountJoinValue = JoinLongFieldBo.merge(totalCountFieldBoList); - - final JoinTransactionBo firstJoinTransactionBo = joinTransactionBoList.get(0); - - final JoinTransactionBo newJoinTransactionBo = new JoinTransactionBo(); - newJoinTransactionBo.setId(firstJoinTransactionBo.getId()); - newJoinTransactionBo.setTimestamp(timestamp); - newJoinTransactionBo.setCollectInterval(firstJoinTransactionBo.getCollectInterval()); - newJoinTransactionBo.setTotalCountJoinValue(totalCountJoinValue); - return newJoinTransactionBo; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - JoinTransactionBo that = (JoinTransactionBo) o; - - if (collectInterval != that.collectInterval) return false; - if (timestamp != that.timestamp) return false; - if (id != null ? !id.equals(that.id) : that.id != null) return false; - return totalCountJoinValue != null ? totalCountJoinValue.equals(that.totalCountJoinValue) : that.totalCountJoinValue == null; - } - - @Override - public int hashCode() { - int result = id != null ? id.hashCode() : 0; - result = 31 * result + (int) (collectInterval ^ (collectInterval >>> 32)); - result = 31 * result + (totalCountJoinValue != null ? totalCountJoinValue.hashCode() : 0); - result = 31 * result + (int) (timestamp ^ (timestamp >>> 32)); - return result; - } - - @Override - public String toString() { - final StringBuilder sb = new StringBuilder("JoinTransactionBo{"); - sb.append("id='").append(id).append('\''); - sb.append(", collectInterval=").append(collectInterval); - sb.append(", totalCountJoinValue=").append(totalCountJoinValue); - sb.append(", timestamp=").append(timestamp); - sb.append('}'); - return sb.toString(); - } - -} diff --git a/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/join/StatType.java b/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/join/StatType.java deleted file mode 100644 index 35935a396226..000000000000 --- a/commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/join/StatType.java +++ /dev/null @@ -1,118 +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.common.server.bo.stat.join; - -import com.navercorp.pinpoint.common.util.apache.IntHashMap; - -/** - * @author minwoo.jung - */ -public enum StatType { - UNKNOWN(0, "Unknown", null), - - APP_STST(1, "Application stat", null), - APP_CPU_LOAD(2, "Application Cpu Usage", "cpuLoad"), - APP_MEMORY_USED(3, "Application Memory Usage", "memory"), - APP_TRANSACTION_COUNT(4, "Application Transaction Count", "transaction"), - APP_ACTIVE_TRACE_COUNT(5, "Application Active trace Count", "activeTrace"), - APP_RESPONSE_TIME(6, "Application Response Time", "responseTime"), - APP_DATA_SOURCE(7, "Application data Source", "dataSource"), - APP_FILE_DESCRIPTOR(8, "Application File Descriptor Count", "fileDescriptor"), - APP_DIRECT_BUFFER(9, "Application Direct Buffer", "directBuffer"), - APP_TOTAL_THREAD_COUNT(10, "Application Total Thread Count", "totalThreadCount"), - APP_LOADED_CLASS(11, "Application Loaded Class", "loadedClass"), - - APP_STST_AGGRE(51, "Application stst aggregation", null), - APP_CPU_LOAD_AGGRE(52, "Application Cpu Usage aggregation", "cpuLoad"), - APP_MEMORY_USED_AGGRE(53, "Application Memory Usage aggregation", "memory"), - APP_TRANSACTION_COUNT_AGGRE(54, "Application Transaction count aggregation", "transaction"), - APP_ACTIVE_TRACE_COUNT_AGGRE(55, "Application Active trace count aggregation", "activeTrace"), - APP_RESPONSE_TIME_AGGRE(56, "Application Response Time aggregation", "responseTime"), - APP_DATA_SOURCE_AGGRE(57, "Application Data Source aggregation", "dataSource"), - APP_FILE_DESCRIPTOR_AGGRE(58, "Application File Descriptor count aggregation", "fileDescriptor"), - APP_DIRECT_BUFFER_AGGRE(59, "Application Direct Buffer aggregation", "directBuffer"), - APP_TOTAL_THREAD_COUNT_AGGRE(60, "Application Total Thread count aggregation", "totalThreadCount"), - APP_LOADED_CLASS_AGGRE(61, "Application Loaded Class aggregation", "loadedClass"), - - AGENT_STST_AGGRE(101, "Agent stst aggregation", null), - AGENT_CPU_LOAD_AGGRE(102, "Agent Cpu Usage aggregation", "cpuLoad"), - AGENT_MEMORY_USED_AGGRE(103, "Agent Memory Usage aggregation", "memory"), - AGENT_TRANSACTION_COUNT_AGGRE(104, "Agent Transaction count aggregation", "transaction"), - AGENT_ACTIVE_TRACE_COUNT_AGGRE(105, "Agent Active trace count aggregation", "activeTrace"), - AGENT_RESPONSE_TIME_AGGRE(106, "Agent response time aggregation", "responseTime"), - AGENT_DATA_SOURCE_AGGRE(107, "Agent data source aggregation", "dataSource"), - AGENT_FILE_DESCRIPTOR_AGGRE(108, "Agent File Descriptor count aggregation", "fileDescriptor"), - AGENT_DIRECT_BUFFER_AGGRE(109, "Agent Direct Buffer aggregation", "directBuffer"), - AGENT_TOTAL_THREAD_AGGRE(110, "Agent Total Thread count aggregation", "totalThreadCount"), - AGENT_LOADED_CLASS_AGGRE(111, "Agent Loaded Class aggregation", "loadedClass"); - - public static final int TYPE_CODE_BYTE_LENGTH = 1; - - private final byte typeCode; - private final String name; - private final String chartType; - - private static final IntHashMap STAT_TYPE_MAP = toStatTypeMap(); - - StatType(int typeCode, String name, String chartType) { - if (typeCode < 0 || typeCode > 255) { - throw new IllegalArgumentException("type code out of range (0~255)"); - } - this.typeCode = (byte) (typeCode & 0xFF); - this.name = name; - this.chartType = chartType; - } - - public int getTypeCode() { - return this.typeCode & 0xFF; - } - - public byte getRawTypeCode() { - return typeCode; - } - - public String getName() { - return name; - } - - public String getChartType() { - return chartType; - } - - @Override - public String toString() { - return this.name; - } - - public static StatType fromTypeCode(byte typeCode) { - final StatType statType = STAT_TYPE_MAP.get(typeCode); - if (statType == null) { - return UNKNOWN; - } - return statType; - } - - private static IntHashMap toStatTypeMap() { - final IntHashMap map = new IntHashMap<>(); - for (StatType agentStatType : StatType.values()) { - map.put(agentStatType.getTypeCode(), agentStatType); - } - return map; - } - - - -} diff --git a/commons-server/src/test/java/com/navercorp/pinpoint/common/server/bo/codec/stat/join/ActiveTraceCodecTest.java b/commons-server/src/test/java/com/navercorp/pinpoint/common/server/bo/codec/stat/join/ActiveTraceCodecTest.java deleted file mode 100644 index 0bfc7eaaec4a..000000000000 --- a/commons-server/src/test/java/com/navercorp/pinpoint/common/server/bo/codec/stat/join/ActiveTraceCodecTest.java +++ /dev/null @@ -1,75 +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.common.server.bo.codec.stat.join; - -import com.navercorp.pinpoint.common.buffer.AutomaticBuffer; -import com.navercorp.pinpoint.common.buffer.Buffer; -import com.navercorp.pinpoint.common.buffer.FixedBuffer; -import com.navercorp.pinpoint.common.server.bo.codec.stat.AgentStatDataPointCodec; -import com.navercorp.pinpoint.common.server.bo.codec.stat.ApplicationStatCodec; -import com.navercorp.pinpoint.common.server.bo.serializer.stat.AgentStatUtils; -import com.navercorp.pinpoint.common.server.bo.serializer.stat.ApplicationStatDecodingContext; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinActiveTraceBo; -import org.junit.jupiter.api.Test; - -import java.util.Date; -import java.util.List; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * @author minwoo.jung - */ -public class ActiveTraceCodecTest { - - @Test - public void encodeValuesTest() { - final String id = "test_app"; - final long currentTime = new Date().getTime(); - ApplicationStatCodec activeTraceCodec = new ActiveTraceCodec(new AgentStatDataPointCodec()); - final Buffer encodedValueBuffer = new AutomaticBuffer(); - final List joinActiveTraceBoList = createJoinActiveTRaceBoList(currentTime); - encodedValueBuffer.putByte(activeTraceCodec.getVersion()); - activeTraceCodec.encodeValues(encodedValueBuffer, joinActiveTraceBoList); - - final Buffer valueBuffer = new FixedBuffer(encodedValueBuffer.getBuffer()); - final long baseTimestamp = AgentStatUtils.getBaseTimestamp(currentTime); - final long timestampDelta = currentTime - baseTimestamp; - final ApplicationStatDecodingContext decodingContext = new ApplicationStatDecodingContext(); - decodingContext.setApplicationId(id); - decodingContext.setBaseTimestamp(baseTimestamp); - decodingContext.setTimestampDelta(timestampDelta); - - assertEquals(valueBuffer.readByte(), activeTraceCodec.getVersion()); - List decodedJoinActiveTraceBoList = activeTraceCodec.decodeValues(valueBuffer, decodingContext); - for (int i = 0; i < decodedJoinActiveTraceBoList.size(); i++) { - assertEquals(decodedJoinActiveTraceBoList.get(i), joinActiveTraceBoList.get(i)); - } - } - - private List createJoinActiveTRaceBoList(long currentTime) { - final String id = "test_app"; - return List.of( - new JoinActiveTraceBo(id, 1, (short) 2, 31, 11, "app_1_1", 41, "app_1_2", currentTime), - new JoinActiveTraceBo(id, 1, (short) 2, 32, 12, "app_2_1", 42, "app_2_2", currentTime + 5000), - new JoinActiveTraceBo(id, 1, (short) 2, 33, 13, "app_3_1", 43, "app_3_2", currentTime + 10000), - new JoinActiveTraceBo(id, 1, (short) 2, 34, 14, "app_4_1", 44, "app_4_2", currentTime + 15000), - new JoinActiveTraceBo(id, 1, (short) 2, 35, 15, "app_5_1", 45, "app_5_2", currentTime + 20000) - ); - } - -} \ No newline at end of file diff --git a/commons-server/src/test/java/com/navercorp/pinpoint/common/server/bo/codec/stat/join/CpuLoadCodecTest.java b/commons-server/src/test/java/com/navercorp/pinpoint/common/server/bo/codec/stat/join/CpuLoadCodecTest.java deleted file mode 100644 index 55cfe699af23..000000000000 --- a/commons-server/src/test/java/com/navercorp/pinpoint/common/server/bo/codec/stat/join/CpuLoadCodecTest.java +++ /dev/null @@ -1,75 +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.common.server.bo.codec.stat.join; - -import com.navercorp.pinpoint.common.buffer.AutomaticBuffer; -import com.navercorp.pinpoint.common.buffer.Buffer; -import com.navercorp.pinpoint.common.buffer.FixedBuffer; -import com.navercorp.pinpoint.common.server.bo.codec.stat.AgentStatDataPointCodec; -import com.navercorp.pinpoint.common.server.bo.serializer.stat.AgentStatUtils; -import com.navercorp.pinpoint.common.server.bo.serializer.stat.ApplicationStatDecodingContext; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinCpuLoadBo; -import org.junit.jupiter.api.Test; - -import java.util.Date; -import java.util.List; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * @author minwoo.jung - */ -public class CpuLoadCodecTest { - - @Test - public void encodeAndDecodeTest() { - final String id = "test_app"; - final long currentTime = new Date().getTime(); - final AgentStatDataPointCodec agentStatDataPointCodec = new AgentStatDataPointCodec(); - final CpuLoadCodec cpuLoadCodec = new CpuLoadCodec(agentStatDataPointCodec); - final Buffer encodedValueBuffer = new AutomaticBuffer(); - final List joinCpuLoadBoList = createJoinCpuLoadBoList(currentTime); - encodedValueBuffer.putByte(cpuLoadCodec.getVersion()); - cpuLoadCodec.encodeValues(encodedValueBuffer, joinCpuLoadBoList); - - final Buffer valueBuffer = new FixedBuffer(encodedValueBuffer.getBuffer()); - final long baseTimestamp = AgentStatUtils.getBaseTimestamp(currentTime); - final long timestampDelta = currentTime - baseTimestamp; - final ApplicationStatDecodingContext decodingContext = new ApplicationStatDecodingContext(); - decodingContext.setApplicationId(id); - decodingContext.setBaseTimestamp(baseTimestamp); - decodingContext.setTimestampDelta(timestampDelta); - - assertEquals(valueBuffer.readByte(), cpuLoadCodec.getVersion()); - List decodedjoinCpuLoadBoList = cpuLoadCodec.decodeValues(valueBuffer, decodingContext); - for (int i = 0; i < decodedjoinCpuLoadBoList.size(); i++) { - assertEquals(decodedjoinCpuLoadBoList.get(i), joinCpuLoadBoList.get(i)); - } - } - - private List createJoinCpuLoadBoList(long currentTime) { - final String id = "test_app"; - return List.of( - new JoinCpuLoadBo(id, 50, 97, "agent1_1", 27, "agent1_2", 80, 97, "agent1_3", 46, "agent1_4", currentTime), - new JoinCpuLoadBo(id, 40, 87, "agent2_1", 40, "agent2_2", 70, 97, "agent2_3", 40, "agent2_4", currentTime + 5000), - new JoinCpuLoadBo(id, 30, 77, "agent3_1", 27, "agent3_2", 60, 77, "agent3_3", 27, "agent3_4", currentTime + 10000), - new JoinCpuLoadBo(id, 20, 67, "agent4_1", 17, "agent4_2", 40, 99, "agent4_3", 18, "agent4_4", currentTime + 15000), - new JoinCpuLoadBo(id, 10, 99, "agent5_1", 7, "agent5_2", 30, 59, "agent5_3", 8, "agent5_4", currentTime + 20000) - ); - } - -} \ No newline at end of file diff --git a/commons-server/src/test/java/com/navercorp/pinpoint/common/server/bo/codec/stat/join/DataSourceCodecTest.java b/commons-server/src/test/java/com/navercorp/pinpoint/common/server/bo/codec/stat/join/DataSourceCodecTest.java deleted file mode 100644 index a95877c25eed..000000000000 --- a/commons-server/src/test/java/com/navercorp/pinpoint/common/server/bo/codec/stat/join/DataSourceCodecTest.java +++ /dev/null @@ -1,87 +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.common.server.bo.codec.stat.join; - -import com.navercorp.pinpoint.common.buffer.AutomaticBuffer; -import com.navercorp.pinpoint.common.buffer.Buffer; -import com.navercorp.pinpoint.common.buffer.FixedBuffer; -import com.navercorp.pinpoint.common.server.bo.codec.stat.AgentStatDataPointCodec; -import com.navercorp.pinpoint.common.server.bo.codec.stat.ApplicationStatCodec; -import com.navercorp.pinpoint.common.server.bo.serializer.stat.AgentStatUtils; -import com.navercorp.pinpoint.common.server.bo.serializer.stat.ApplicationStatDecodingContext; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinDataSourceBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinDataSourceListBo; -import org.junit.jupiter.api.Test; - -import java.util.Date; -import java.util.List; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * @author minwoo.jung - */ -public class DataSourceCodecTest { - - @Test - public void encodeAndDecodeTest() { - final String id = "test_app"; - final long currentTime = new Date().getTime(); - final AgentStatDataPointCodec agentStatDataPointCodec = new AgentStatDataPointCodec(); - final ApplicationStatCodec dataSourceCodec = new DataSourceCodec(agentStatDataPointCodec); - final List joinDataSourceListBoList = createJoinDataSourceListBoList(currentTime); - final Buffer encodedValueBuffer = new AutomaticBuffer(); - encodedValueBuffer.putByte(dataSourceCodec.getVersion()); - dataSourceCodec.encodeValues(encodedValueBuffer, joinDataSourceListBoList); - - final Buffer valueBuffer = new FixedBuffer(encodedValueBuffer.getBuffer()); - final long baseTimestamp = AgentStatUtils.getBaseTimestamp(currentTime); - final long timestampDelta = currentTime - baseTimestamp; - final ApplicationStatDecodingContext decodingContext = new ApplicationStatDecodingContext(); - decodingContext.setApplicationId(id); - decodingContext.setBaseTimestamp(baseTimestamp); - decodingContext.setTimestampDelta(timestampDelta); - - assertEquals(valueBuffer.readByte(), dataSourceCodec.getVersion()); - List decodedJoinDataSourceListBoList = dataSourceCodec.decodeValues(valueBuffer, decodingContext); - for (int i = 0; i < decodedJoinDataSourceListBoList.size(); ++i) { - assertEquals(decodedJoinDataSourceListBoList.get(i), joinDataSourceListBoList.get(i)); - } - } - - private List createJoinDataSourceListBoList(long currentTime) { - final String id = "test_app"; - return List.of( - new JoinDataSourceListBo(id, createJoinDataSourceBoList(10), currentTime), - new JoinDataSourceListBo(id, createJoinDataSourceBoList(20), currentTime + 5000), - new JoinDataSourceListBo(id, createJoinDataSourceBoList(30), currentTime + 10000), - new JoinDataSourceListBo(id, createJoinDataSourceBoList(40), currentTime + 15000), - new JoinDataSourceListBo(id, createJoinDataSourceBoList(50), currentTime + 20000) - ); - } - - private List createJoinDataSourceBoList(int plus) { - return List.of( - new JoinDataSourceBo((short) 1000, "jdbc:mysql", 30 + plus, 25 + plus, "agent_id_1", 60 + plus, "agent_id_6"), - new JoinDataSourceBo((short) 2000, "jdbc:mssql", 20 + plus, 5 + plus, "agent_id_2", 30 + plus, "agent_id_7"), - new JoinDataSourceBo((short) 3000, "jdbc:postgre", 10 + plus, 25 + plus, "agent_id_3", 50 + plus, "agent_id_8"), - new JoinDataSourceBo((short) 4000, "jdbc:oracle", 40 + plus, 5 + plus, "agent_id_4", 70 + plus, "agent_id_9"), - new JoinDataSourceBo((short) 5000, "jdbc:cubrid", 50 + plus, 25 + plus, "agent_id_5", 80 + plus, "agent_id_10") - ); - } - -} \ No newline at end of file diff --git a/commons-server/src/test/java/com/navercorp/pinpoint/common/server/bo/codec/stat/join/DirectBufferCodecTest.java b/commons-server/src/test/java/com/navercorp/pinpoint/common/server/bo/codec/stat/join/DirectBufferCodecTest.java deleted file mode 100644 index 55afd067f446..000000000000 --- a/commons-server/src/test/java/com/navercorp/pinpoint/common/server/bo/codec/stat/join/DirectBufferCodecTest.java +++ /dev/null @@ -1,76 +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.common.server.bo.codec.stat.join; - -import com.navercorp.pinpoint.common.buffer.AutomaticBuffer; -import com.navercorp.pinpoint.common.buffer.Buffer; -import com.navercorp.pinpoint.common.buffer.FixedBuffer; -import com.navercorp.pinpoint.common.server.bo.codec.stat.AgentStatDataPointCodec; -import com.navercorp.pinpoint.common.server.bo.codec.stat.ApplicationStatCodec; -import com.navercorp.pinpoint.common.server.bo.serializer.stat.AgentStatUtils; -import com.navercorp.pinpoint.common.server.bo.serializer.stat.ApplicationStatDecodingContext; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinDirectBufferBo; -import org.junit.jupiter.api.Test; - -import java.util.Date; -import java.util.List; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * @author Roy Kim - */ -public class DirectBufferCodecTest { - - @Test - public void encodeAndDecodeTest() { - final String id = "test_app"; - final long currentTime = new Date().getTime(); - final AgentStatDataPointCodec agentStatDataPointCodec = new AgentStatDataPointCodec(); - final ApplicationStatCodec directBufferCodec = new DirectBufferCodec(agentStatDataPointCodec); - final Buffer encodedValueBuffer = new AutomaticBuffer(); - final List joinDirectBufferBoList = createJoinDirectBufferBoList(currentTime); - encodedValueBuffer.putByte(directBufferCodec.getVersion()); - directBufferCodec.encodeValues(encodedValueBuffer, joinDirectBufferBoList); - - final Buffer valueBuffer = new FixedBuffer(encodedValueBuffer.getBuffer()); - final long baseTimestamp = AgentStatUtils.getBaseTimestamp(currentTime); - final long timestampDelta = currentTime - baseTimestamp; - final ApplicationStatDecodingContext decodingContext = new ApplicationStatDecodingContext(); - decodingContext.setApplicationId(id); - decodingContext.setBaseTimestamp(baseTimestamp); - decodingContext.setTimestampDelta(timestampDelta); - - assertEquals(valueBuffer.readByte(), directBufferCodec.getVersion()); - List decodedJoinDirectBufferBoList = directBufferCodec.decodeValues(valueBuffer, decodingContext); - for (int i = 0; i < decodedJoinDirectBufferBoList.size(); i++) { - assertEquals(decodedJoinDirectBufferBoList.get(i), joinDirectBufferBoList.get(i)); - } - } - - private List createJoinDirectBufferBoList(long currentTime) { - final String id = "test_app"; - return List.of( - new JoinDirectBufferBo(id, 80, 1000, "agent1_1", 30, "agent1_2", 80, 1000, "agent1_1", 30, "agent1_2", 80, 1000, "agent1_1", 30, "agent1_2", 80, 1000, "agent1_1", 30, "agent1_2", currentTime), - new JoinDirectBufferBo(id, 70, 900, "agent2_1", 20, "agent2_2", 70, 900, "agent2_1", 20, "agent2_2", 70, 900, "agent2_1", 20, "agent2_2", 70, 900, "agent2_1", 20, "agent2_2", currentTime + 5000), - new JoinDirectBufferBo(id, 60, 800, "agent4_1", 15, "agent4_2", 60, 800, "agent4_1", 15, "agent4_2", 60, 800, "agent4_1", 15, "agent4_2", 60, 800, "agent4_1", 15, "agent4_2", currentTime + 15000), - new JoinDirectBufferBo(id, 50, 700, "agent3_1", 10, "agent3_2", 50, 700, "agent3_1", 10, "agent3_2", 50, 700, "agent3_1", 10, "agent3_2", 50, 700, "agent3_1", 10, "agent3_2", currentTime + 10000), - new JoinDirectBufferBo(id, 40, 600, "agent5_1", 5, "agent5_2", 40, 600, "agent5_1", 5, "agent5_2", 40, 600, "agent5_1", 5, "agent5_2", 40, 600, "agent5_1", 5, "agent5_2", currentTime + 20000) - ); - } - -} \ No newline at end of file diff --git a/commons-server/src/test/java/com/navercorp/pinpoint/common/server/bo/codec/stat/join/FileDescriptorCodecTest.java b/commons-server/src/test/java/com/navercorp/pinpoint/common/server/bo/codec/stat/join/FileDescriptorCodecTest.java deleted file mode 100644 index e1cf24a8604b..000000000000 --- a/commons-server/src/test/java/com/navercorp/pinpoint/common/server/bo/codec/stat/join/FileDescriptorCodecTest.java +++ /dev/null @@ -1,76 +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.common.server.bo.codec.stat.join; - -import com.navercorp.pinpoint.common.buffer.AutomaticBuffer; -import com.navercorp.pinpoint.common.buffer.Buffer; -import com.navercorp.pinpoint.common.buffer.FixedBuffer; -import com.navercorp.pinpoint.common.server.bo.codec.stat.AgentStatDataPointCodec; -import com.navercorp.pinpoint.common.server.bo.codec.stat.ApplicationStatCodec; -import com.navercorp.pinpoint.common.server.bo.serializer.stat.AgentStatUtils; -import com.navercorp.pinpoint.common.server.bo.serializer.stat.ApplicationStatDecodingContext; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinFileDescriptorBo; -import org.junit.jupiter.api.Test; - -import java.util.Date; -import java.util.List; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * @author Roy Kim - */ -public class FileDescriptorCodecTest { - - @Test - public void encodeAndDecodeTest() { - final String id = "test_app"; - final long currentTime = new Date().getTime(); - final AgentStatDataPointCodec agentStatDataPointCodec = new AgentStatDataPointCodec(); - final ApplicationStatCodec fileDescriptorCodec = new FileDescriptorCodec(agentStatDataPointCodec); - final Buffer encodedValueBuffer = new AutomaticBuffer(); - final List joinFileDescriptorBoList = createJoinFileDescriptorBoList(currentTime); - encodedValueBuffer.putByte(fileDescriptorCodec.getVersion()); - fileDescriptorCodec.encodeValues(encodedValueBuffer, joinFileDescriptorBoList); - - final Buffer valueBuffer = new FixedBuffer(encodedValueBuffer.getBuffer()); - final long baseTimestamp = AgentStatUtils.getBaseTimestamp(currentTime); - final long timestampDelta = currentTime - baseTimestamp; - final ApplicationStatDecodingContext decodingContext = new ApplicationStatDecodingContext(); - decodingContext.setApplicationId(id); - decodingContext.setBaseTimestamp(baseTimestamp); - decodingContext.setTimestampDelta(timestampDelta); - - assertEquals(valueBuffer.readByte(), fileDescriptorCodec.getVersion()); - List decodedJoinFileDescriptorBoList = fileDescriptorCodec.decodeValues(valueBuffer, decodingContext); - for (int i = 0; i < decodedJoinFileDescriptorBoList.size(); i++) { - assertEquals(decodedJoinFileDescriptorBoList.get(i), joinFileDescriptorBoList.get(i)); - } - } - - private List createJoinFileDescriptorBoList(long currentTime) { - final String id = "test_app"; - return List.of( - new JoinFileDescriptorBo(id, 80, 1000, "agent1_1", 30, "agent1_2", currentTime), - new JoinFileDescriptorBo(id, 70, 900, "agent2_1", 20, "agent2_2", currentTime + 5000), - new JoinFileDescriptorBo(id, 60, 800, "agent4_1", 15, "agent4_2", currentTime + 15000), - new JoinFileDescriptorBo(id, 50, 700, "agent3_1", 10, "agent3_2", currentTime + 10000), - new JoinFileDescriptorBo(id, 40, 600, "agent5_1", 5, "agent5_2", currentTime + 20000) - ); - } - -} \ No newline at end of file diff --git a/commons-server/src/test/java/com/navercorp/pinpoint/common/server/bo/codec/stat/join/LoadedClassCountCodecTest.java b/commons-server/src/test/java/com/navercorp/pinpoint/common/server/bo/codec/stat/join/LoadedClassCountCodecTest.java deleted file mode 100644 index 76a1a535d355..000000000000 --- a/commons-server/src/test/java/com/navercorp/pinpoint/common/server/bo/codec/stat/join/LoadedClassCountCodecTest.java +++ /dev/null @@ -1,72 +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.common.server.bo.codec.stat.join; - -import com.navercorp.pinpoint.common.buffer.AutomaticBuffer; -import com.navercorp.pinpoint.common.buffer.Buffer; -import com.navercorp.pinpoint.common.buffer.FixedBuffer; -import com.navercorp.pinpoint.common.server.bo.codec.stat.AgentStatDataPointCodec; -import com.navercorp.pinpoint.common.server.bo.codec.stat.ApplicationStatCodec; -import com.navercorp.pinpoint.common.server.bo.serializer.stat.AgentStatUtils; -import com.navercorp.pinpoint.common.server.bo.serializer.stat.ApplicationStatDecodingContext; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinLoadedClassBo; -import org.junit.jupiter.api.Test; - -import java.util.Date; -import java.util.List; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -public class LoadedClassCountCodecTest { - - @Test - public void encodeAndDecodeTest() { - final String id = "test_app"; - final long currentTime = new Date().getTime(); - final AgentStatDataPointCodec agentStatDataPointCodec = new AgentStatDataPointCodec(); - final ApplicationStatCodec loadedClassCodec = new LoadedClassCodec(agentStatDataPointCodec); - final Buffer encodedValueBuffer = new AutomaticBuffer(); - final List joinLoadedClassBoList = createJoinLoadedClassCountBoList(currentTime); - encodedValueBuffer.putByte(loadedClassCodec.getVersion()); - loadedClassCodec.encodeValues(encodedValueBuffer, joinLoadedClassBoList); - - final Buffer valueBuffer = new FixedBuffer(encodedValueBuffer.getBuffer()); - final long baseTimestamp = AgentStatUtils.getBaseTimestamp(currentTime); - final long timestampDelta = currentTime - baseTimestamp; - final ApplicationStatDecodingContext decodingContext = new ApplicationStatDecodingContext(); - decodingContext.setApplicationId(id); - decodingContext.setBaseTimestamp(baseTimestamp); - decodingContext.setTimestampDelta(timestampDelta); - - assertEquals(valueBuffer.readByte(), loadedClassCodec.getVersion()); - List decodedJoinLoadedClassBoList = loadedClassCodec.decodeValues(valueBuffer, decodingContext); - for (int i = 0; i < decodedJoinLoadedClassBoList.size(); i++) { - assertEquals(decodedJoinLoadedClassBoList.get(i), joinLoadedClassBoList.get(i)); - } - } - - private List createJoinLoadedClassCountBoList(long currentTime) { - final String id = "test_app"; - return List.of( - new JoinLoadedClassBo(id, 80, 900, "agent2_1", 20, "agent2_2", 70, 900, "agent2_1", 20, "agent2_2", currentTime), - new JoinLoadedClassBo(id, 70, 900, "agent2_1", 20, "agent2_2", 70, 900, "agent2_1", 20, "agent2_2", currentTime + 5000), - new JoinLoadedClassBo(id, 60, 800, "agent4_1", 15, "agent4_2", 60, 800, "agent4_1", 15, "agent4_2", currentTime + 15000), - new JoinLoadedClassBo(id, 50, 700, "agent3_1", 10, "agent3_2", 50, 700, "agent3_1", 10, "agent3_2", currentTime + 10000), - new JoinLoadedClassBo(id, 40, 600, "agent5_1", 5, "agent5_2", 40, 600, "agent5_1", 5, "agent5_2", currentTime + 20000) - ); - } -} diff --git a/commons-server/src/test/java/com/navercorp/pinpoint/common/server/bo/codec/stat/join/MemoryCodecTest.java b/commons-server/src/test/java/com/navercorp/pinpoint/common/server/bo/codec/stat/join/MemoryCodecTest.java deleted file mode 100644 index e4efbdcbbaa3..000000000000 --- a/commons-server/src/test/java/com/navercorp/pinpoint/common/server/bo/codec/stat/join/MemoryCodecTest.java +++ /dev/null @@ -1,76 +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.common.server.bo.codec.stat.join; - -import com.navercorp.pinpoint.common.buffer.AutomaticBuffer; -import com.navercorp.pinpoint.common.buffer.Buffer; -import com.navercorp.pinpoint.common.buffer.FixedBuffer; -import com.navercorp.pinpoint.common.server.bo.codec.stat.AgentStatDataPointCodec; -import com.navercorp.pinpoint.common.server.bo.codec.stat.ApplicationStatCodec; -import com.navercorp.pinpoint.common.server.bo.serializer.stat.AgentStatUtils; -import com.navercorp.pinpoint.common.server.bo.serializer.stat.ApplicationStatDecodingContext; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinMemoryBo; -import org.junit.jupiter.api.Test; - -import java.util.Date; -import java.util.List; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * @author minwoo.jung - */ -public class MemoryCodecTest { - - @Test - public void encodeAndDecodeTest() { - final String id = "test_app"; - final long currentTime = new Date().getTime(); - final AgentStatDataPointCodec agentStatDataPointCodec = new AgentStatDataPointCodec(); - final ApplicationStatCodec memoryCodec = new MemoryCodec(agentStatDataPointCodec); - final Buffer encodedValueBuffer = new AutomaticBuffer(); - final List joinMemoryBoList = createJoinMemoryBoList(currentTime); - encodedValueBuffer.putByte(memoryCodec.getVersion()); - memoryCodec.encodeValues(encodedValueBuffer, joinMemoryBoList); - - final Buffer valueBuffer = new FixedBuffer(encodedValueBuffer.getBuffer()); - final long baseTimestamp = AgentStatUtils.getBaseTimestamp(currentTime); - final long timestampDelta = currentTime - baseTimestamp; - final ApplicationStatDecodingContext decodingContext = new ApplicationStatDecodingContext(); - decodingContext.setApplicationId(id); - decodingContext.setBaseTimestamp(baseTimestamp); - decodingContext.setTimestampDelta(timestampDelta); - - assertEquals(valueBuffer.readByte(), memoryCodec.getVersion()); - List decodedJoinMemoryBoList = memoryCodec.decodeValues(valueBuffer, decodingContext); - for (int i = 0; i < decodedJoinMemoryBoList.size(); i++) { - assertEquals(decodedJoinMemoryBoList.get(i), joinMemoryBoList.get(i)); - } - } - - private List createJoinMemoryBoList(long currentTime) { - final String id = "test_app"; - return List.of( - new JoinMemoryBo(id, currentTime, 3000, 2000, 5000, "app_1_1", "app_1_2", 500, 50, 600, "app_1_3", "app_1_4"), - new JoinMemoryBo(id, currentTime + 5000, 4000, 1000, 7000, "app_2_1", "app_2_2", 400, 150, 600, "app_2_3", "app_2_4"), - new JoinMemoryBo(id, currentTime + 10000, 5000, 3000, 8000, "app_3_1", "app_3_2", 200, 100, 200, "app_3_3", "app_3_4"), - new JoinMemoryBo(id, currentTime + 15000, 1000, 100, 3000, "app_4_1", "app_4_2", 100, 900, 1000, "app_4_3", "app_4_4"), - new JoinMemoryBo(id, currentTime + 20000, 2000, 1000, 6000, "app_5_1", "app_5_2", 300, 100, 2900, "app_5_3", "app_5_4") - ); - } - -} \ No newline at end of file diff --git a/commons-server/src/test/java/com/navercorp/pinpoint/common/server/bo/codec/stat/join/ResponseTimeCodecTest.java b/commons-server/src/test/java/com/navercorp/pinpoint/common/server/bo/codec/stat/join/ResponseTimeCodecTest.java deleted file mode 100644 index c89d025003e1..000000000000 --- a/commons-server/src/test/java/com/navercorp/pinpoint/common/server/bo/codec/stat/join/ResponseTimeCodecTest.java +++ /dev/null @@ -1,75 +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.common.server.bo.codec.stat.join; - -import com.navercorp.pinpoint.common.buffer.AutomaticBuffer; -import com.navercorp.pinpoint.common.buffer.Buffer; -import com.navercorp.pinpoint.common.buffer.FixedBuffer; -import com.navercorp.pinpoint.common.server.bo.codec.stat.AgentStatDataPointCodec; -import com.navercorp.pinpoint.common.server.bo.serializer.stat.AgentStatUtils; -import com.navercorp.pinpoint.common.server.bo.serializer.stat.ApplicationStatDecodingContext; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinResponseTimeBo; -import org.junit.jupiter.api.Test; - -import java.util.Date; -import java.util.List; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * @author minwoo.jung - */ -public class ResponseTimeCodecTest { - - @Test - public void encodeAndDecodeTest() { - final String id = "test_app"; - final long currentTime = new Date().getTime(); - final AgentStatDataPointCodec agentStatDataPointCodec = new AgentStatDataPointCodec(); - final ResponseTimeCodec responseTimeCodec = new ResponseTimeCodec(agentStatDataPointCodec); - final Buffer encodedValueBuffer = new AutomaticBuffer(); - final List joinResponseTimeBoList = createJoinResponseTimeBoList(currentTime); - encodedValueBuffer.putByte(responseTimeCodec.getVersion()); - responseTimeCodec.encodeValues(encodedValueBuffer, joinResponseTimeBoList); - - final Buffer valueBuffer = new FixedBuffer(encodedValueBuffer.getBuffer()); - final long baseTimestamp = AgentStatUtils.getBaseTimestamp(currentTime); - final long timestampDelta = currentTime - baseTimestamp; - final ApplicationStatDecodingContext decodingContext = new ApplicationStatDecodingContext(); - decodingContext.setApplicationId(id); - decodingContext.setBaseTimestamp(baseTimestamp); - decodingContext.setTimestampDelta(timestampDelta); - - assertEquals(valueBuffer.readByte(), responseTimeCodec.getVersion()); - List decodedJoinResponseTimeBoList = responseTimeCodec.decodeValues(valueBuffer, decodingContext); - for (int i = 0; i < decodedJoinResponseTimeBoList.size(); i++) { - assertEquals(decodedJoinResponseTimeBoList.get(i), joinResponseTimeBoList.get(i)); - } - } - - private List createJoinResponseTimeBoList(long currentTime) { - final String id = "test_app"; - return List.of( - new JoinResponseTimeBo(id, currentTime, 3000, 2, "app_1_1", 6000, "app_1_2"), - new JoinResponseTimeBo(id, currentTime + 5000, 4000, 200, "app_2_1", 9000, "app_2_2"), - new JoinResponseTimeBo(id, currentTime + 10000, 2000, 20, "app_3_1", 7000, "app_3_2"), - new JoinResponseTimeBo(id, currentTime + 15000, 5000, 20, "app_4_1", 8000, "app_4_2"), - new JoinResponseTimeBo(id, currentTime + 20000, 1000, 10, "app_5_1", 6600, "app_5_2") - ); - } - -} \ No newline at end of file diff --git a/commons-server/src/test/java/com/navercorp/pinpoint/common/server/bo/codec/stat/join/TotalThreadCountCodecTest.java b/commons-server/src/test/java/com/navercorp/pinpoint/common/server/bo/codec/stat/join/TotalThreadCountCodecTest.java deleted file mode 100644 index a02d28feb07e..000000000000 --- a/commons-server/src/test/java/com/navercorp/pinpoint/common/server/bo/codec/stat/join/TotalThreadCountCodecTest.java +++ /dev/null @@ -1,72 +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.common.server.bo.codec.stat.join; - -import com.navercorp.pinpoint.common.buffer.AutomaticBuffer; -import com.navercorp.pinpoint.common.buffer.Buffer; -import com.navercorp.pinpoint.common.buffer.FixedBuffer; -import com.navercorp.pinpoint.common.server.bo.codec.stat.AgentStatDataPointCodec; -import com.navercorp.pinpoint.common.server.bo.codec.stat.ApplicationStatCodec; -import com.navercorp.pinpoint.common.server.bo.serializer.stat.AgentStatUtils; -import com.navercorp.pinpoint.common.server.bo.serializer.stat.ApplicationStatDecodingContext; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinTotalThreadCountBo; -import org.junit.jupiter.api.Test; - -import java.util.Date; -import java.util.List; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -public class TotalThreadCountCodecTest { - - @Test - public void encodeAndDecodeTest() { - final String id = "test_app"; - final long currentTime = new Date().getTime(); - final AgentStatDataPointCodec agentStatDataPointCodec = new AgentStatDataPointCodec(); - final ApplicationStatCodec totalThreadCountCodec = new TotalThreadCountCodec(agentStatDataPointCodec); - final Buffer encodedValueBuffer = new AutomaticBuffer(); - final List joinTotalThreadCountBoList = createJoinTotalThreadCountBoList(currentTime); - encodedValueBuffer.putByte(totalThreadCountCodec.getVersion()); - totalThreadCountCodec.encodeValues(encodedValueBuffer, joinTotalThreadCountBoList); - - final Buffer valueBuffer = new FixedBuffer(encodedValueBuffer.getBuffer()); - final long baseTimestamp = AgentStatUtils.getBaseTimestamp(currentTime); - final long timestampDelta = currentTime - baseTimestamp; - final ApplicationStatDecodingContext decodingContext = new ApplicationStatDecodingContext(); - decodingContext.setApplicationId(id); - decodingContext.setBaseTimestamp(baseTimestamp); - decodingContext.setTimestampDelta(timestampDelta); - - assertEquals(valueBuffer.readByte(), totalThreadCountCodec.getVersion()); - List decodedJoinTotalThreadCountBoList = totalThreadCountCodec.decodeValues(valueBuffer, decodingContext); - for (int i = 0; i < decodedJoinTotalThreadCountBoList.size(); i++) { - assertEquals(decodedJoinTotalThreadCountBoList.get(i), joinTotalThreadCountBoList.get(i)); - } - } - - private List createJoinTotalThreadCountBoList(long currentTime) { - final String id = "test_app"; - return List.of( - new JoinTotalThreadCountBo(id, currentTime, 80, 1000, "agent1_1", 30, "agent1_2"), - new JoinTotalThreadCountBo(id, currentTime + 5000, 70, 900, "agent2_1", 20, "agent2_2"), - new JoinTotalThreadCountBo(id, currentTime + 15000, 60, 800, "agent4_1", 15, "agent4_2"), - new JoinTotalThreadCountBo(id, currentTime + 10000, 50, 700, "agent3_1", 10, "agent3_2"), - new JoinTotalThreadCountBo(id, currentTime + 20000, 40, 600, "agent5_1", 5, "agent5_2") - ); - } -} diff --git a/commons-server/src/test/java/com/navercorp/pinpoint/common/server/bo/codec/stat/join/TransactionCodecTest.java b/commons-server/src/test/java/com/navercorp/pinpoint/common/server/bo/codec/stat/join/TransactionCodecTest.java deleted file mode 100644 index 05f692109ca9..000000000000 --- a/commons-server/src/test/java/com/navercorp/pinpoint/common/server/bo/codec/stat/join/TransactionCodecTest.java +++ /dev/null @@ -1,75 +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.common.server.bo.codec.stat.join; - -import com.navercorp.pinpoint.common.buffer.AutomaticBuffer; -import com.navercorp.pinpoint.common.buffer.Buffer; -import com.navercorp.pinpoint.common.buffer.FixedBuffer; -import com.navercorp.pinpoint.common.server.bo.codec.stat.AgentStatDataPointCodec; -import com.navercorp.pinpoint.common.server.bo.codec.stat.ApplicationStatCodec; -import com.navercorp.pinpoint.common.server.bo.serializer.stat.AgentStatUtils; -import com.navercorp.pinpoint.common.server.bo.serializer.stat.ApplicationStatDecodingContext; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinTransactionBo; -import org.junit.jupiter.api.Test; - -import java.util.Date; -import java.util.List; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * @author minwoo.jung - */ -public class TransactionCodecTest { - @Test - public void encodeValuesTest() { - final String id = "test_app"; - final long currentTime = new Date().getTime(); - ApplicationStatCodec transactionCodec = new TransactionCodec(new AgentStatDataPointCodec()); - final Buffer encodedValueBuffer = new AutomaticBuffer(); - final List joinTransactionBoList = createJoinTransactionBoList(currentTime); - encodedValueBuffer.putByte(transactionCodec.getVersion()); - transactionCodec.encodeValues(encodedValueBuffer, joinTransactionBoList); - - final Buffer valueBuffer = new FixedBuffer(encodedValueBuffer.getBuffer()); - final long baseTimestamp = AgentStatUtils.getBaseTimestamp(currentTime); - final long timestampDelta = currentTime - baseTimestamp; - final ApplicationStatDecodingContext decodingContext = new ApplicationStatDecodingContext(); - decodingContext.setApplicationId(id); - decodingContext.setBaseTimestamp(baseTimestamp); - decodingContext.setTimestampDelta(timestampDelta); - - assertEquals(valueBuffer.readByte(), transactionCodec.getVersion()); - List decodedJoinTransactionBoList = transactionCodec.decodeValues(valueBuffer, decodingContext); - for (int i = 0; i < decodedJoinTransactionBoList.size(); i++) { - assertEquals(decodedJoinTransactionBoList.get(i), joinTransactionBoList.get(i)); - } - } - - private List createJoinTransactionBoList(long currentTime) { - final String id = "test_app"; - return List.of( - new JoinTransactionBo(id, 5000, 150, 10, "app_1_1", 230, "app_1_2", currentTime), - new JoinTransactionBo(id, 10000, 110, 22, "app_2_1", 330, "app_2_2", currentTime + 5000), - new JoinTransactionBo(id, 15000, 120, 24, "app_3_1", 540, "app_3_2", currentTime + 10000), - new JoinTransactionBo(id, 20000, 130, 25, "app_4_1", 560, "app_4_2", currentTime + 15000), - new JoinTransactionBo(id, 25000, 140, 12, "app_5_1", 260, "app_5_2", currentTime + 20000) - ); - } - - -} \ No newline at end of file diff --git a/commons-server/src/test/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinActiveTraceBoTest.java b/commons-server/src/test/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinActiveTraceBoTest.java deleted file mode 100644 index 09f2ec684645..000000000000 --- a/commons-server/src/test/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinActiveTraceBoTest.java +++ /dev/null @@ -1,53 +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.common.server.bo.stat.join; - -import org.junit.jupiter.api.Test; - -import java.util.List; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * @author minwoo.jung - */ -public class JoinActiveTraceBoTest { - - @Test - public void joinActiveTraceBoTest() { - List joinActiveTraceBoList = List.of( - new JoinActiveTraceBo("agent1", 1, (short) 2, 40, 10, "agent1", 70, "agent1", 1496988667231L), - new JoinActiveTraceBo("agent2", 1, (short) 2, 10, 9, "agent2", 71, "agent2", 1496988667231L), - new JoinActiveTraceBo("agent3", 1, (short) 2, 20, 14, "agent3", 88, "agent3", 1496988667231L), - new JoinActiveTraceBo("agent4", 1, (short) 2, 30, 22, "agent4", 10, "agent4", 1496988667231L), - new JoinActiveTraceBo("agent5", 1, (short) 2, 50, 17, "agent5", 99, "agent5", 1496988667231L) - ); - - JoinActiveTraceBo joinActiveTraceBo = JoinActiveTraceBo.joinActiveTraceBoList(joinActiveTraceBoList, 1496988667231L); - assertEquals("agent1", joinActiveTraceBo.getId()); - assertEquals(1496988667231L, joinActiveTraceBo.getTimestamp()); - assertEquals(1, joinActiveTraceBo.getHistogramSchemaType()); - assertEquals(2, joinActiveTraceBo.getVersion()); - assertEquals(new JoinIntFieldBo(30, 9, "agent2", 99, "agent5"), joinActiveTraceBo.getTotalCountJoinValue()); - } - - @Test - public void joinActiveTraceBo2Test() { - JoinActiveTraceBo joinActiveTraceBo = JoinActiveTraceBo.joinActiveTraceBoList(List.of(), 1496988667231L); - assertEquals(joinActiveTraceBo, JoinActiveTraceBo.EMPTY_JOIN_ACTIVE_TRACE_BO); - } -} \ No newline at end of file diff --git a/commons-server/src/test/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinApplicationStatBoTest.java b/commons-server/src/test/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinApplicationStatBoTest.java deleted file mode 100644 index e602243cd4d9..000000000000 --- a/commons-server/src/test/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinApplicationStatBoTest.java +++ /dev/null @@ -1,1462 +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.common.server.bo.stat.join; - -import org.junit.jupiter.api.Test; - -import java.util.Comparator; -import java.util.List; -import java.util.function.BiConsumer; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.fail; - -/** - * @author minwoo.jung - */ -public class JoinApplicationStatBoTest { - - public static final String APPLICATION_ID = "test_app"; - public static final long TIMESTAMP = 14984_6254_5000L; - public static final long TIMESTAMP1 = 14984_6255_0000L; - public static final long TIMESTAMP2 = 14984_6255_5000L; - public static final long TIMESTAMP3 = 14984_6256_5000L; - public static final long TIMESTAMP4 = 14984_6256_0000L; - - @Test - public void joinApplicationStatBoByTimeSliceTest() { - final long currentTime = 1487149800000L; // 18:10:00 15 2 2017 - - List joinApplicationStatBoList = List.of( - createCpu("id1", currentTime, 1), - createCpu("id2", currentTime + 1000, -4), - createCpu("id3", currentTime + 2000, -3), - createCpu("id4", currentTime + 3000, 4), - createCpu("id5", currentTime + 4000, -5) - ); - - JoinApplicationStatBo resultJoinApplicationStatBo = JoinApplicationStatBo.joinApplicationStatBoByTimeSlice(joinApplicationStatBoList); - List joinCpuLoadBoList = resultJoinApplicationStatBo.getJoinCpuLoadBoList(); - joinCpuLoadBoList.sort(Comparator.comparingLong(JoinCpuLoadBo::getTimestamp)); - assertJoinCpuLoadBoList(joinCpuLoadBoList); - } - - - private void assertJoinCpuLoadBoList(List joinCpuLoadBoList) { - assertThat(joinCpuLoadBoList).hasSize(5); - JoinCpuLoadBo joinCpuLoadBo1 = joinCpuLoadBoList.get(0); - assertCpu(joinCpuLoadBo1, "id1", 1487149800000L, - new JoinDoubleFieldBo(48.6, 22.0, "id5_2", 91.0, "id4_1"), - new JoinDoubleFieldBo(78.6, 41.0, "id5_4", 91.0, "id4_3")); - - JoinCpuLoadBo joinCpuLoadBo2 = joinCpuLoadBoList.get(1); - assertCpu(joinCpuLoadBo2, "id1", 1487149805000L, - new JoinDoubleFieldBo(38.6, 35.0, "id5_2", 81.0, "id4_1"), - new JoinDoubleFieldBo(68.6, 35.0, "id5_4", 81.0, "id4_3")); - - JoinCpuLoadBo joinCpuLoadBo3 = joinCpuLoadBoList.get(2); - assertCpu(joinCpuLoadBo3, "id1", 1487149810000L, - new JoinDoubleFieldBo(28.6, 22.0, "id5_2", 71.0, "id4_1"), - new JoinDoubleFieldBo(58.6, 22.0, "id5_4", 71.0, "id4_3")); - - JoinCpuLoadBo joinCpuLoadBo4 = joinCpuLoadBoList.get(3); - assertCpu(joinCpuLoadBo4, "id1", 1487149815000L, - new JoinDoubleFieldBo(18.6, 12.0, "id5_2", 61.0, "id4_1"), - new JoinDoubleFieldBo(38.6, 13.0, "id5_4", 93.0, "id4_3")); - - JoinCpuLoadBo joinCpuLoadBo5 = joinCpuLoadBoList.get(4); - assertCpu(joinCpuLoadBo5, "id1", 1487149820000L, - new JoinDoubleFieldBo(8.6, 2.0, "id5_2", 93.0, "id4_1"), - new JoinDoubleFieldBo(28.6, 3.0, "id5_4", 63.0, "id4_3")); - } - - private void assertCpu(JoinCpuLoadBo joinCpuLoadBo1, String id, long timestamp, JoinDoubleFieldBo jvm, JoinDoubleFieldBo system) { - assertEquals(joinCpuLoadBo1.getId(), id); - assertEquals(joinCpuLoadBo1.getTimestamp(), timestamp); - assertEquals(joinCpuLoadBo1.getJvmCpuLoadJoinValue(), jvm); - assertEquals(joinCpuLoadBo1.getSystemCpuLoadJoinValue(), system); - } - - private JoinApplicationStatBo createCpu(final String id, final long timestamp, final int plus) { - final JoinApplicationStatBo.Builder joinApplicationStatBo = JoinApplicationStatBo.newBuilder(id, timestamp); - createJoinCpuLoadBoList(id, timestamp, plus).forEach(joinApplicationStatBo::addCpuLoad); - joinApplicationStatBo.setStatType(StatType.APP_STST); - return joinApplicationStatBo.build(); - } - - private List createJoinCpuLoadBoList(final String id, final long currentTime, int plus) { - return List.of( - new JoinCpuLoadBo(id, 50 + plus, 87 + plus, id + "_1", 27 + plus, id + "_2", 80 + plus, 87 + plus, id + "_3", 46 + plus, id + "_4", currentTime), - new JoinCpuLoadBo(id, 40 + plus, 77 + plus, id + "_1", 40 + plus, id + "_2", 70 + plus, 77 + plus, id + "_3", 40 + plus, id + "_4", currentTime + 5000), - new JoinCpuLoadBo(id, 30 + plus, 67 + plus, id + "_1", 27 + plus, id + "_2", 60 + plus, 67 + plus, id + "_3", 27 + plus, id + "_4", currentTime + 10000), - new JoinCpuLoadBo(id, 20 + plus, 57 + plus, id + "_1", 17 + plus, id + "_2", 40 + plus, 89 + plus, id + "_3", 18 + plus, id + "_4", currentTime + 15000), - new JoinCpuLoadBo(id, 10 + plus, 89 + plus, id + "_1", 7 + plus, id + "_2", 30 + plus, 59 + plus, id + "_3", 8 + plus, id + "_4", currentTime + 20000) - ); - } - - @Test - public void joinApplicationStatBoByTimeSlice2Test() { - final long currentTime = 1487149800000L; // 18:10:00 15 2 2017 - List joinApplicationStatBoList = List.of( - createMemory("id1", currentTime, 10), - createMemory("id2", currentTime + 1000, -40), - createMemory("id3", currentTime + 2000, -30), - createMemory("id4", currentTime + 3000, 40), - createMemory("id5", currentTime + 4000, -50) - ); - - JoinApplicationStatBo resultJoinApplicationStatBo = JoinApplicationStatBo.joinApplicationStatBoByTimeSlice(joinApplicationStatBoList); - List joinMemoryBoList = resultJoinApplicationStatBo.getJoinMemoryBoList(); - joinMemoryBoList.sort(Comparator.comparingLong(JoinMemoryBo::getTimestamp)); - assertJoinMemoryBoList(joinMemoryBoList); - } - - private void assertJoinMemoryBoList(List joinMemoryBoList) { - assertThat(joinMemoryBoList).hasSize(5); - - JoinMemoryBo joinMemoryBo1 = joinMemoryBoList.get(0); - assertMemory(joinMemoryBo1, "id1", 1487149800000L, - new JoinLongFieldBo(2986L, 1950L, "id5_1", 5040L, "id4_2"), - new JoinLongFieldBo(486L, 0L, "id5_3", 640L, "id4_4")); - - JoinMemoryBo joinMemoryBo2 = joinMemoryBoList.get(1); - assertMemory(joinMemoryBo2, "id1", 1487149805000L, - new JoinLongFieldBo(3986L, 950L, "id5_1", 7040L, "id4_2"), - new JoinLongFieldBo(386L, 100L, "id5_3", 640L, "id4_4")); - - JoinMemoryBo joinMemoryBo3 = joinMemoryBoList.get(2); - assertMemory(joinMemoryBo3, "id1", 1487149810000L, - new JoinLongFieldBo(4986L, 2950L, "id5_1", 8040L, "id4_2"), - new JoinLongFieldBo(186L, 50L, "id5_3", 240L, "id4_4")); - - JoinMemoryBo joinMemoryBo4 = joinMemoryBoList.get(3); - assertMemory(joinMemoryBo4, "id1", 1487149815000L, - new JoinLongFieldBo(986L, 50L, "id5_1", 3040L, "id4_2"), - new JoinLongFieldBo(86L, 850L, "id5_3", 1040L, "id4_4")); - - JoinMemoryBo joinMemoryBo5 = joinMemoryBoList.get(4); - assertMemory(joinMemoryBo5, "id1", 1487149820000L, - new JoinLongFieldBo(1986L, 950L, "id5_1", 6040L, "id4_2"), - new JoinLongFieldBo(286L, 50L, "id5_3", 2940L, "id4_4")); - } - - private void assertMemory(JoinMemoryBo memory, String id, long timestamp, JoinLongFieldBo heap, JoinLongFieldBo nonHeap) { - assertEquals(id, memory.getId()); - assertEquals(timestamp, memory.getTimestamp()); - assertEquals(heap, memory.getHeapUsedJoinValue(), "heap"); - assertEquals(nonHeap, memory.getNonHeapUsedJoinValue(), "nonHeap"); - } - - - private JoinApplicationStatBo createMemory(final String id, final long timestamp, final int plus) { - final JoinApplicationStatBo.Builder joinApplicationStatBo = JoinApplicationStatBo.newBuilder(id, timestamp); - createJoinMemoryBoList(id, timestamp, plus) - .forEach(joinApplicationStatBo::addMemory); - joinApplicationStatBo.setStatType(StatType.APP_STST); - return joinApplicationStatBo.build(); - } - - private List createJoinMemoryBoList(final String id, final long currentTime, int plus) { - return List.of( - new JoinMemoryBo(id, currentTime, 3000 + plus, 2000 + plus, 5000 + plus, id + "_1", id + "_2", 500 + plus, 50 + plus, 600 + plus, id + "_3", id + "_4"), - new JoinMemoryBo(id, currentTime + 5000, 4000 + plus, 1000 + plus, 7000 + plus, id + "_1", id + "_2", 400 + plus, 150 + plus, 600 + plus, id + "_3", id + "_4"), - new JoinMemoryBo(id, currentTime + 10000, 5000 + plus, 3000 + plus, 8000 + plus, id + "_1", id + "_2", 200 + plus, 100 + plus, 200 + plus, id + "_3", id + "_4"), - new JoinMemoryBo(id, currentTime + 15000, 1000 + plus, 100 + plus, 3000 + plus, id + "_1", id + "_2", 100 + plus, 900 + plus, 1000 + plus, id + "_3", id + "_4"), - new JoinMemoryBo(id, currentTime + +20000, 2000 + plus, 1000 + plus, 6000 + plus, id + "_1", id + "_2", 300 + plus, 100 + plus, 2900 + plus, id + "_3", id + "_4") - ); - } - - @Test - public void joinApplicationStatBoByTimeSlice3Test() { - List cpu1 = List.of( - new JoinCpuLoadBo("agent1", 44, 70, "agent1", 30, "agent1", 50, 60, "agent1", 33, "agent1", TIMESTAMP), - new JoinCpuLoadBo("agent1", 33, 40, "agent1", 10, "agent1", 20, 78, "agent1", 12, "agent1", TIMESTAMP1), - new JoinCpuLoadBo("agent1", 55, 60, "agent1", 7, "agent1", 30, 39, "agent1", 30, "agent1", TIMESTAMP2) - ); - - JoinApplicationStatBo join1 = buildApplicationStat(APPLICATION_ID, TIMESTAMP, - JoinApplicationStatBo.Builder::addCpuLoad, cpu1); - - List cpu2 = List.of( - new JoinCpuLoadBo("agent1", 33, 70, "agent1", 30, "agent1", 50, 60, "agent1", 33, "agent1", TIMESTAMP), - new JoinCpuLoadBo("agent1", 22, 40, "agent1", 10, "agent1", 20, 78, "agent1", 12, "agent1", TIMESTAMP1), - new JoinCpuLoadBo("agent1", 11, 60, "agent1", 7, "agent1", 30, 39, "agent1", 30, "agent1", TIMESTAMP2), - new JoinCpuLoadBo("agent1", 77, 60, "agent1", 7, "agent1", 30, 39, "agent1", 30, "agent1", TIMESTAMP4) - ); - - JoinApplicationStatBo join2 = buildApplicationStat(APPLICATION_ID, TIMESTAMP, - JoinApplicationStatBo.Builder::addCpuLoad, cpu2); - - List cpu3 = List.of( - new JoinCpuLoadBo("agent1", 22, 70, "agent1", 30, "agent1", 50, 60, "agent1", 33, "agent1", TIMESTAMP), - new JoinCpuLoadBo("agent1", 11, 40, "agent1", 10, "agent1", 20, 78, "agent1", 12, "agent1", TIMESTAMP1), - new JoinCpuLoadBo("agent1", 88, 60, "agent1", 7, "agent1", 30, 39, "agent1", 30, "agent1", TIMESTAMP3) - ); - - JoinApplicationStatBo join3 = buildApplicationStat(APPLICATION_ID, TIMESTAMP, - JoinApplicationStatBo.Builder::addCpuLoad, cpu3); - - - List joinApplicationStatBoList = List.of(join1, join2, join3); - JoinApplicationStatBo joinApplicationStatBo = JoinApplicationStatBo.joinApplicationStatBoByTimeSlice(joinApplicationStatBoList); - assertEquals(joinApplicationStatBo.getId(), APPLICATION_ID); - assertEquals(joinApplicationStatBo.getTimestamp(), TIMESTAMP); - List joinCpuLoadBoList = joinApplicationStatBo.getJoinCpuLoadBoList(); - joinCpuLoadBoList.sort(Comparator.comparingLong(JoinCpuLoadBo::getTimestamp)); - - assertThat(joinCpuLoadBoList) - .hasSize(5) - .map(JoinCpuLoadBo::getJvmCpuLoadJoinValue) - .map(JoinDoubleFieldBo::getAvg) - .containsExactly(33.0, 22.0, 33.0, 77.0, 88.0); - } - - private JoinApplicationStatBo buildApplicationStat(String applicationId, long timestamp, - BiConsumer consumer, - List loadBos) { - JoinApplicationStatBo.Builder builder = JoinApplicationStatBo.newBuilder(applicationId, timestamp); - for (T loadBo : loadBos) { - consumer.accept(builder, loadBo); - } - return builder.build(); - } - - @Test - public void joinApplicationStatBoByTimeSlice4Test() { - List memory1 = List.of( - new JoinMemoryBo("agent1", TIMESTAMP, 3000, 2000, 5000, "agent1", "agent1", 500, 50, 600, "agent1", "agent1"), - new JoinMemoryBo("agent2", TIMESTAMP1, 4000, 1000, 7000, "agent2", "agent2", 400, 150, 600, "agent2", "agent2"), - new JoinMemoryBo("agent3", TIMESTAMP2, 5000, 3000, 8000, "agent3", "agent3", 200, 100, 200, "agent3", "agent3") - ); - JoinApplicationStatBo join1 = buildApplicationStat(APPLICATION_ID, TIMESTAMP, - JoinApplicationStatBo.Builder::addMemory, memory1); - - List memory2 = List.of( - new JoinMemoryBo("agent1", TIMESTAMP, 4000, 2000, 5000, "agent1", "agent1", 500, 50, 600, "agent1", "agent1"), - new JoinMemoryBo("agent2", TIMESTAMP1, 1000, 1000, 7000, "agent2", "agent2", 400, 150, 600, "agent2", "agent2"), - new JoinMemoryBo("agent3", TIMESTAMP2, 3000, 3000, 8000, "agent3", "agent3", 200, 100, 200, "agent3", "agent3"), - new JoinMemoryBo("agent3", TIMESTAMP4, 8800, 3000, 8000, "agent3", "agent3", 200, 100, 200, "agent3", "agent3") - ); - JoinApplicationStatBo join2 = buildApplicationStat(APPLICATION_ID, TIMESTAMP, - JoinApplicationStatBo.Builder::addMemory, memory2); - - List memory3 = List.of( - new JoinMemoryBo("agent1", TIMESTAMP, 5000, 2000, 5000, "agent1", "agent1", 500, 50, 600, "agent1", "agent1"), - new JoinMemoryBo("agent2", TIMESTAMP1, 1000, 1000, 7000, "agent2", "agent2", 400, 150, 600, "agent2", "agent2"), - new JoinMemoryBo("agent3", TIMESTAMP3, 7800, 3000, 8000, "agent3", "agent3", 200, 100, 200, "agent3", "agent3") - ); - JoinApplicationStatBo join3 = buildApplicationStat(APPLICATION_ID, TIMESTAMP, - JoinApplicationStatBo.Builder::addMemory, memory3); - - List joinApplicationStatBoList = List.of(join1, join2, join3); - - JoinApplicationStatBo joinApplicationStatBo = JoinApplicationStatBo.joinApplicationStatBoByTimeSlice(joinApplicationStatBoList); - assertEquals(joinApplicationStatBo.getId(), APPLICATION_ID); - assertEquals(joinApplicationStatBo.getTimestamp(), TIMESTAMP); - List joinMemoryBoList = joinApplicationStatBo.getJoinMemoryBoList(); - joinMemoryBoList.sort(Comparator.comparingLong(JoinMemoryBo::getTimestamp)); - - assertThat(joinMemoryBoList) - .hasSize(5) - .map(JoinMemoryBo::getHeapUsedJoinValue) - .map(JoinLongFieldBo::getAvg) - .containsExactly(4000L, 2000L, 4000L, 8800L, 7800L); - } - - @Test - public void joinApplicationStatBoByTimeSlice5Test() { - final long currentTime = 1487149800000L; // 18:10:00 15 2 2017 - List sum = List.of( - createTranscation("id1", currentTime, 10), - createTranscation("id2", currentTime + 1000, -40), - createTranscation("id3", currentTime + 2000, -30), - createTranscation("id4", currentTime + 3000, 40), - createTranscation("id5", currentTime + 4000, -50) - ); - - JoinApplicationStatBo resultJoinApplicationStatBo = JoinApplicationStatBo.joinApplicationStatBoByTimeSlice(sum); - List joinTransactionBoList = resultJoinApplicationStatBo.getJoinTransactionBoList(); - joinTransactionBoList.sort(Comparator.comparingLong(JoinTransactionBo::getTimestamp)); - assertJoinTransactionBoList(joinTransactionBoList); - } - - - private JoinApplicationStatBo createTranscation(final String id, final long timestamp, final int plus) { - final JoinApplicationStatBo.Builder joinApplicationStatBo = JoinApplicationStatBo.newBuilder(id, timestamp); - createJoinTransactionBoList(id, timestamp, plus) - .forEach(joinApplicationStatBo::addTransaction); - joinApplicationStatBo.setStatType(StatType.APP_STST); - return joinApplicationStatBo.build(); - } - - private List createJoinTransactionBoList(final String id, final long currentTime, int plus) { - return List.of( - new JoinTransactionBo(id, 5000, 100 + plus, 60 + plus, id + "_1", 200 + plus, id + "_2", currentTime), - new JoinTransactionBo(id, 5000, 300 + plus, 150 + plus, id + "_1", 400 + plus, id + "_2", currentTime + 5000), - new JoinTransactionBo(id, 5000, 200 + plus, 130 + plus, id + "_1", 300 + plus, id + "_2", currentTime + 10000), - new JoinTransactionBo(id, 5000, 400 + plus, 200 + plus, id + "_1", 450 + plus, id + "_2", currentTime + 15000), - new JoinTransactionBo(id, 5000, 350 + plus, 170 + plus, id + "_1", 600 + plus, id + "_2", currentTime + 20000) - ); - } - - - private void assertJoinTransactionBoList(List joinTransactionBoList) { - assertThat(joinTransactionBoList).hasSize(5); - - JoinTransactionBo joinTransactionBo1 = joinTransactionBoList.get(0); - assertTransaction(joinTransactionBo1, "id1", 1487149800000L, - new JoinLongFieldBo(86L, 10L, "id5_1", 240L, "id4_2")); - - JoinTransactionBo joinTransactionBo2 = joinTransactionBoList.get(1); - assertTransaction(joinTransactionBo2, "id1", 1487149805000L, - new JoinLongFieldBo(286L, 100L, "id5_1", 440L, "id4_2")); - - JoinTransactionBo joinTransactionBo3 = joinTransactionBoList.get(2); - assertTransaction(joinTransactionBo3, "id1", 1487149810000L, - new JoinLongFieldBo(186L, 80L, "id5_1", 340L, "id4_2")); - - JoinTransactionBo joinTransactionBo4 = joinTransactionBoList.get(3); - assertTransaction(joinTransactionBo4, "id1", 1487149815000L, - new JoinLongFieldBo(386L, 150L, "id5_1", 490L, "id4_2")); - - JoinTransactionBo joinTransactionBo5 = joinTransactionBoList.get(4); - assertTransaction(joinTransactionBo5, "id1", 1487149820000L, - new JoinLongFieldBo(336L, 120L, "id5_1", 640L, "id4_2")); - } - - private static void assertTransaction(JoinTransactionBo transaction, - String id, long timestamp, JoinLongFieldBo field) { - assertEquals(transaction.getId(), id); - assertEquals(transaction.getTimestamp(), timestamp); - assertEquals(transaction.getTotalCountJoinValue(), field); - } - - - @Test - public void joinApplicationStatBoByTimeSlice6Test() { - List transaction1 = List.of( - new JoinTransactionBo("agent1", 5000, 100, 60, "agent1", 200, "agent1", TIMESTAMP), - new JoinTransactionBo("agent2", 5000, 100, 60, "agent2", 200, "agent2", TIMESTAMP1), - new JoinTransactionBo("agent3", 5000, 100, 60, "agent3", 200, "agent3", TIMESTAMP2) - ); - JoinApplicationStatBo join1 = buildApplicationStat(APPLICATION_ID, TIMESTAMP, - JoinApplicationStatBo.Builder::addTransaction, transaction1); - - List transaction2 = List.of( - new JoinTransactionBo("agent1", 5000, 50, 20, "agent1", 230, "agent1", TIMESTAMP), - new JoinTransactionBo("agent2", 5000, 200, 60, "agent2", 400, "agent2", TIMESTAMP1), - new JoinTransactionBo("agent3", 5000, 500, 10, "agent3", 100, "agent3", TIMESTAMP2), - new JoinTransactionBo("agent3", 5000, 400, 60, "agent3", 500, "agent3", TIMESTAMP4) - ); - JoinApplicationStatBo join2 = buildApplicationStat(APPLICATION_ID, TIMESTAMP, - JoinApplicationStatBo.Builder::addTransaction, transaction2); - - - List transaction3 = List.of( - new JoinTransactionBo("agent1", 5000, 150, 20, "agent1", 230, "agent1", TIMESTAMP), - new JoinTransactionBo("agent2", 5000, 300, 10, "agent2", 400, "agent2", TIMESTAMP1), - new JoinTransactionBo("agent3", 5000, 30, 5, "agent3", 100, "agent3", TIMESTAMP3) - ); - JoinApplicationStatBo join3 = buildApplicationStat(APPLICATION_ID, TIMESTAMP, - JoinApplicationStatBo.Builder::addTransaction, transaction3); - - List joinApplicationStatBoList = List.of(join1, join2, join3); - - JoinApplicationStatBo joinApplicationStatBo = JoinApplicationStatBo.joinApplicationStatBoByTimeSlice(joinApplicationStatBoList); - assertEquals(joinApplicationStatBo.getId(), APPLICATION_ID); - assertEquals(joinApplicationStatBo.getTimestamp(), TIMESTAMP); - List joinTransactionBoList = joinApplicationStatBo.getJoinTransactionBoList(); - joinTransactionBoList.sort(Comparator.comparingLong(JoinTransactionBo::getTimestamp)); - - assertThat(joinTransactionBoList) - .hasSize(5) - .map(JoinTransactionBo::getTotalCountJoinValue) - .map(JoinLongFieldBo::getAvg) - .containsExactly(100L, 200L, 300L, 400L, 30L); - } - - @Test - public void joinApplicationStatBoByTimeSlice7Test() { - final long currentTime = 1487149800000L; // 18:10:00 15 2 2017 - List joinApplicationStatBoList = List.of( - createActiveTrace("id1", currentTime, 10), - createActiveTrace("id2", currentTime + 1000, -40), - createActiveTrace("id3", currentTime + 2000, -30), - createActiveTrace("id4", currentTime + 3000, 40), - createActiveTrace("id5", currentTime + 4000, -50) - ); - JoinApplicationStatBo resultJoinApplicationStatBo = JoinApplicationStatBo.joinApplicationStatBoByTimeSlice(joinApplicationStatBoList); - List joinActiveTraceBoList = resultJoinApplicationStatBo.getJoinActiveTraceBoList(); - joinActiveTraceBoList.sort(Comparator.comparingLong(JoinActiveTraceBo::getTimestamp)); - assertJoinActiveTraceBoList(joinActiveTraceBoList); - } - - @Test - public void joinApplicationStatBoByTimeSlice8Test() { - List active1 = List.of( - new JoinActiveTraceBo("agent1", 1, (short) 2, 100, 60, "agent1", 200, "agent1", TIMESTAMP), - new JoinActiveTraceBo("agent2", 1, (short) 2, 100, 60, "agent1", 200, "agent1", TIMESTAMP1), - new JoinActiveTraceBo("agent3", 1, (short) 2, 100, 60, "agent1", 200, "agent1", TIMESTAMP2) - ); - - JoinApplicationStatBo join1 = buildApplicationStat(APPLICATION_ID, TIMESTAMP, - JoinApplicationStatBo.Builder::addActiveTrace, active1); - - List active2 = List.of( - new JoinActiveTraceBo("agent1", 1, (short) 2, 50, 20, "agent1", 230, "agent1", TIMESTAMP), - new JoinActiveTraceBo("agent2", 1, (short) 2, 200, 60, "agent2", 400, "agent2", TIMESTAMP1), - new JoinActiveTraceBo("agent3", 1, (short) 2, 500, 10, "agent3", 100, "agent3", TIMESTAMP2), - new JoinActiveTraceBo("agent3", 1, (short) 2, 400, 60, "agent3", 500, "agent3", TIMESTAMP4) - ); - JoinApplicationStatBo join2 = buildApplicationStat(APPLICATION_ID, TIMESTAMP, - JoinApplicationStatBo.Builder::addActiveTrace, active2); - - List active3 = List.of( - new JoinActiveTraceBo("agent1", 1, (short) 2, 150, 20, "agent1", 230, "agent1", TIMESTAMP), - new JoinActiveTraceBo("agent2", 1, (short) 2, 300, 10, "agent2", 400, "agent2", TIMESTAMP1), - new JoinActiveTraceBo("agent3", 1, (short) 2, 30, 5, "agent3", 100, "agent3", TIMESTAMP3) - ); - JoinApplicationStatBo join3 = buildApplicationStat(APPLICATION_ID, TIMESTAMP, - JoinApplicationStatBo.Builder::addActiveTrace, active3); - - List joinApplicationStatBoList = List.of(join1, join2, join3); - - JoinApplicationStatBo joinApplicationStatBo = JoinApplicationStatBo.joinApplicationStatBoByTimeSlice(joinApplicationStatBoList); - assertEquals(joinApplicationStatBo.getId(), APPLICATION_ID); - assertEquals(joinApplicationStatBo.getTimestamp(), TIMESTAMP); - List joinActiveTraceBoList = joinApplicationStatBo.getJoinActiveTraceBoList(); - joinActiveTraceBoList.sort(Comparator.comparingLong(JoinActiveTraceBo::getTimestamp)); - - assertThat(joinActiveTraceBoList) - .hasSize(5) - .map(JoinActiveTraceBo::getTotalCountJoinValue) - .map(JoinIntFieldBo::getAvg) - .containsExactly(100, 200, 300, 400, 30); - } - - - private JoinApplicationStatBo createActiveTrace(final String id, final long timestamp, final int plus) { - final JoinApplicationStatBo.Builder joinApplicationStatBo = JoinApplicationStatBo.newBuilder(id, timestamp); - createJoinActiveTraceBoList(id, timestamp, plus) - .forEach(joinApplicationStatBo::addActiveTrace); - joinApplicationStatBo.setStatType(StatType.APP_STST); - return joinApplicationStatBo.build(); - } - - private List createJoinActiveTraceBoList(final String id, final long currentTime, int plus) { - return List.of( - new JoinActiveTraceBo(id, 1, (short) 2, 100 + plus, 60 + plus, id + "_1", 200 + plus, id + "_2", currentTime), - new JoinActiveTraceBo(id, 1, (short) 2, 300 + plus, 150 + plus, id + "_1", 400 + plus, id + "_2", currentTime + 5000), - new JoinActiveTraceBo(id, 1, (short) 2, 200 + plus, 130 + plus, id + "_1", 300 + plus, id + "_2", currentTime + 10000), - new JoinActiveTraceBo(id, 1, (short) 2, 400 + plus, 200 + plus, id + "_1", 450 + plus, id + "_2", currentTime + 15000), - new JoinActiveTraceBo(id, 1, (short) 2, 350 + plus, 170 + plus, id + "_1", 600 + plus, id + "_2", currentTime + 20000) - ); - } - - private void assertJoinActiveTraceBoList(List joinActiveTraceBoList) { - assertThat(joinActiveTraceBoList).hasSize(5); - - JoinActiveTraceBo joinActiveTraceBo1 = joinActiveTraceBoList.get(0); - assertActiveTrace(joinActiveTraceBo1, "id1", 1487149800000L, 1, 2, - new JoinIntFieldBo(86, 10, "id5_1", 240, "id4_2")); - - JoinActiveTraceBo joinActiveTraceBo2 = joinActiveTraceBoList.get(1); - assertActiveTrace(joinActiveTraceBo2, "id1", 1487149805000L, 1, 2, - new JoinIntFieldBo(286, 100, "id5_1", 440, "id4_2")); - - JoinActiveTraceBo joinActiveTraceBo3 = joinActiveTraceBoList.get(2); - assertActiveTrace(joinActiveTraceBo3, "id1", 1487149810000L, 1, 2, - new JoinIntFieldBo(186, 80, "id5_1", 340, "id4_2")); - - JoinActiveTraceBo joinActiveTraceBo4 = joinActiveTraceBoList.get(3); - assertActiveTrace(joinActiveTraceBo4, "id1", 1487149815000L, 1, 2, - new JoinIntFieldBo(386, 150, "id5_1", 490, "id4_2")); - - JoinActiveTraceBo joinActiveTraceBo5 = joinActiveTraceBoList.get(4); - assertActiveTrace(joinActiveTraceBo5, "id1", 1487149820000L, 1, 2, - new JoinIntFieldBo(336, 120, "id5_1", 640, "id4_2")); - } - - private void assertActiveTrace(JoinActiveTraceBo joinActiveTraceBo, - String id, long timestamp, int histogramSchemaType, int version, JoinIntFieldBo intField) { - assertEquals(joinActiveTraceBo.getId(), id); - assertEquals(joinActiveTraceBo.getTimestamp(), timestamp); - assertEquals(joinActiveTraceBo.getHistogramSchemaType(), histogramSchemaType); - assertEquals(joinActiveTraceBo.getVersion(), version); - assertEquals(joinActiveTraceBo.getTotalCountJoinValue(), intField); - } - - @Test - public void joinApplicationStatBoByTimeSlice9Test() { - final long currentTime = 1487149800000L; // 18:10:00 15 2 2017 - List joinApplicationStatBoList = List.of( - createResponseTime("id1", currentTime, 10), - createResponseTime("id2", currentTime + 1000, -40), - createResponseTime("id3", currentTime + 2000, -30), - createResponseTime("id4", currentTime + 3000, 40), - createResponseTime("id5", currentTime + 4000, -50) - ); - - JoinApplicationStatBo resultJoinApplicationStatBo = JoinApplicationStatBo.joinApplicationStatBoByTimeSlice(joinApplicationStatBoList); - List joinResponseTimeBoList = resultJoinApplicationStatBo.getJoinResponseTimeBoList(); - joinResponseTimeBoList.sort(Comparator.comparingLong(JoinResponseTimeBo::getTimestamp)); - - assertJoinResponseTimeBoList(joinResponseTimeBoList); - } - - @Test - public void joinApplicationStatBoByTimeSlice10Test() { - - List response1 = List.of( - new JoinResponseTimeBo("agent1", TIMESTAMP, 100, 60, "agent1", 200, "agent1"), - new JoinResponseTimeBo("agent1", TIMESTAMP1, 100, 60, "agent1", 200, "agent1"), - new JoinResponseTimeBo("agent1", TIMESTAMP2, 100, 60, "agent1", 200, "agent1") - ); - - JoinApplicationStatBo join1 = buildApplicationStat(APPLICATION_ID, TIMESTAMP, - JoinApplicationStatBo.Builder::addResponseTime, response1); - - List response2 = List.of( - new JoinResponseTimeBo("agent1", TIMESTAMP, 50, 20, "agent1", 230, "agent1"), - new JoinResponseTimeBo("agent2", TIMESTAMP1, 200, 60, "agent2", 400, "agent2"), - new JoinResponseTimeBo("agent3", TIMESTAMP2, 500, 10, "agent3", 100, "agent3"), - new JoinResponseTimeBo("agent3", TIMESTAMP4, 400, 60, "agent3", 500, "agent3") - ); - - JoinApplicationStatBo join2 = buildApplicationStat(APPLICATION_ID, TIMESTAMP, - JoinApplicationStatBo.Builder::addResponseTime, response2); - - List response3 = List.of( - new JoinResponseTimeBo("agent1", TIMESTAMP, 150, 20, "agent1", 230, "agent1"), - new JoinResponseTimeBo("agent2", TIMESTAMP1, 300, 10, "agent2", 400, "agent2"), - new JoinResponseTimeBo("agent3", TIMESTAMP3, 30, 5, "agent3", 100, "agent3") - ); - JoinApplicationStatBo join3 = buildApplicationStat(APPLICATION_ID, TIMESTAMP, - JoinApplicationStatBo.Builder::addResponseTime, response3); - - List joinApplicationStatBoList = List.of(join1, join2, join3); - - JoinApplicationStatBo joinApplicationStatBo = JoinApplicationStatBo.joinApplicationStatBoByTimeSlice(joinApplicationStatBoList); - assertEquals(joinApplicationStatBo.getId(), APPLICATION_ID); - assertEquals(joinApplicationStatBo.getTimestamp(), TIMESTAMP); - List joinResponseTimeBoList = joinApplicationStatBo.getJoinResponseTimeBoList(); - joinResponseTimeBoList.sort(Comparator.comparingLong(JoinResponseTimeBo::getTimestamp)); - - assertThat(joinResponseTimeBoList) - .hasSize(5) - .map(response -> response.getResponseTimeJoinValue().getAvg()) - .containsExactly(100L, 200L, 300L, 400L, 30L); - } - - private void assertJoinResponseTimeBoList(List joinResponseTimeBoList) { - assertThat(joinResponseTimeBoList).hasSize(5); - - JoinResponseTimeBo joinResponseTimeBo1 = joinResponseTimeBoList.get(0); - assertEquals(joinResponseTimeBo1.getId(), "id1"); - assertEquals(joinResponseTimeBo1.getTimestamp(), 1487149800000L); - assertEquals(joinResponseTimeBo1.getResponseTimeJoinValue(), new JoinLongFieldBo(286L, 150L, "id5_1", 6040L, "id4_2")); - - JoinResponseTimeBo joinResponseTimeBo2 = joinResponseTimeBoList.get(1); - assertEquals(joinResponseTimeBo2.getId(), "id1"); - assertEquals(joinResponseTimeBo2.getTimestamp(), 1487149805000L); - assertEquals(joinResponseTimeBo2.getResponseTimeJoinValue(), new JoinLongFieldBo(186L, 0L, "id5_1", 7040L, "id4_2")); - - JoinResponseTimeBo joinResponseTimeBo3 = joinResponseTimeBoList.get(2); - assertEquals(joinResponseTimeBo3.getId(), "id1"); - assertEquals(joinResponseTimeBo3.getTimestamp(), 1487149810000L); - assertEquals(joinResponseTimeBo3.getResponseTimeJoinValue(), new JoinLongFieldBo(386L, 250L, "id5_1", 8040L, "id4_2")); - - JoinResponseTimeBo joinResponseTimeBo4 = joinResponseTimeBoList.get(3); - assertEquals(joinResponseTimeBo4.getId(), "id1"); - assertEquals(joinResponseTimeBo4.getTimestamp(), 1487149815000L); - assertEquals(joinResponseTimeBo4.getResponseTimeJoinValue(), new JoinLongFieldBo(486L, 350L, "id5_1", 2040L, "id4_2")); - - JoinResponseTimeBo joinResponseTimeBo5 = joinResponseTimeBoList.get(4); - assertEquals(joinResponseTimeBo5.getId(), "id1"); - assertEquals(joinResponseTimeBo5.getTimestamp(), 1487149820000L); - assertEquals(joinResponseTimeBo5.getResponseTimeJoinValue(), new JoinLongFieldBo(86L, 50L, "id5_1", 9040L, "id4_2")); - } - - - private JoinApplicationStatBo createResponseTime(final String id, final long timestamp, final int plus) { - final JoinApplicationStatBo.Builder joinApplicationStatBo = JoinApplicationStatBo.newBuilder(id, timestamp); - createJoinResponseTimeList(id, timestamp, plus).forEach(joinApplicationStatBo::addResponseTime); - joinApplicationStatBo.setStatType(StatType.APP_STST); - return joinApplicationStatBo.build(); - } - - private List createJoinResponseTimeList(String id, long currentTime, int plus) { - return List.of( - new JoinResponseTimeBo(id, currentTime, 300 + plus, 200 + plus, id + "_1", 6000 + plus, id + "_2"), - new JoinResponseTimeBo(id, currentTime + 5000, 200 + plus, 50 + plus, id + "_1", 7000 + plus, id + "_2"), - new JoinResponseTimeBo(id, currentTime + 10000, 400 + plus, 300 + plus, id + "_1", 8000 + plus, id + "_2"), - new JoinResponseTimeBo(id, currentTime + 15000, 500 + plus, 400 + plus, id + "_1", 2000 + plus, id + "_2"), - new JoinResponseTimeBo(id, currentTime + 20000, 100 + plus, 100 + plus, id + "_1", 9000 + plus, id + "_2") - ); - } - - @Test - public void joinApplicationStatBoByTimeSlice11Test() { - final long currentTime = 1487149800000L; // 18:10:00 15 2 2017 - - List joinApplicationStatBoList = List.of( - createDataSource("id1", currentTime, 10), - createDataSource("id2", currentTime + 1000, -40), - createDataSource("id3", currentTime + 2000, -30), - createDataSource("id4", currentTime + 3000, 40), - createDataSource("id5", currentTime + 4000, -50) - ); - - JoinApplicationStatBo resultJoinApplicationStatBo = JoinApplicationStatBo.joinApplicationStatBoByTimeSlice(joinApplicationStatBoList); - List joinDataSourceListBoList = resultJoinApplicationStatBo.getJoinDataSourceListBoList(); - joinDataSourceListBoList.sort(Comparator.comparingLong(JoinDataSourceListBo::getTimestamp)); - - assertJoinDataSourceListBoList(joinDataSourceListBoList); - } - - @Test - public void joinApplicationStatBoByTimeSlice12Test() { - - List joinDataSourceBoList1 = List.of(new JoinDataSourceBo((short) 1000, "jdbc:mysql", 100, 60, "agent1", 200, "agent1")); - - List datasource1 = List.of( - new JoinDataSourceListBo("agent1", joinDataSourceBoList1, TIMESTAMP), - new JoinDataSourceListBo("agent1", joinDataSourceBoList1, TIMESTAMP1), - new JoinDataSourceListBo("agent1", joinDataSourceBoList1, TIMESTAMP2) - ); - JoinApplicationStatBo join1 = buildApplicationStat(APPLICATION_ID, TIMESTAMP, - JoinApplicationStatBo.Builder::addDataSourceList, datasource1); - - - List joinDataSourceBoList2_1 = List.of(new JoinDataSourceBo((short) 1000, "jdbc:mysql", 50, 20, "agent1", 230, "agent1")); - JoinDataSourceListBo joinResponseTimeBo2_1 = new JoinDataSourceListBo("agent1", joinDataSourceBoList2_1, TIMESTAMP); - - List joinDataSourceBoList2_2 = List.of(new JoinDataSourceBo((short) 1000, "jdbc:mysql", 200, 60, "agent2", 400, "agent2")); - JoinDataSourceListBo joinResponseTimeBo2_2 = new JoinDataSourceListBo("agent2", joinDataSourceBoList2_2, TIMESTAMP1); - - List joinDataSourceBoList2_3 = List.of(new JoinDataSourceBo((short) 1000, "jdbc:mysql", 500, 10, "agent3", 100, "agent3")); - JoinDataSourceListBo joinResponseTimeBo2_3 = new JoinDataSourceListBo("agent3", joinDataSourceBoList2_3, TIMESTAMP2); - - List joinDataSourceBoList2_4 = List.of(new JoinDataSourceBo((short) 1000, "jdbc:mysql", 400, 60, "agent3", 500, "agent3")); - JoinDataSourceListBo joinResponseTimeBo2_4 = new JoinDataSourceListBo("agent3", joinDataSourceBoList2_4, TIMESTAMP4); - - JoinApplicationStatBo join2 = buildApplicationStat(APPLICATION_ID, TIMESTAMP, - JoinApplicationStatBo.Builder::addDataSourceList, - List.of(joinResponseTimeBo2_1, joinResponseTimeBo2_2, joinResponseTimeBo2_3, joinResponseTimeBo2_4)); - - - List joinDataSourceBoList3_1 = List.of(new JoinDataSourceBo((short) 1000, "jdbc:mysql", 150, 20, "agent1", 230, "agent1")); - JoinDataSourceListBo joinResponseTimeBo3_1 = new JoinDataSourceListBo("agent1", joinDataSourceBoList3_1, TIMESTAMP); - List joinDataSourceBoList3_2 = List.of(new JoinDataSourceBo((short) 1000, "jdbc:mysql", 300, 10, "agent2", 400, "agent2")); - JoinDataSourceListBo joinResponseTimeBo3_2 = new JoinDataSourceListBo("agent2", joinDataSourceBoList3_2, TIMESTAMP1); - List joinDataSourceBoList3_3 = List.of(new JoinDataSourceBo((short) 1000, "jdbc:mysql", 30, 5, "agent2", 100, "agent2")); - JoinDataSourceListBo joinResponseTimeBo3_3 = new JoinDataSourceListBo("agent3", joinDataSourceBoList3_3, TIMESTAMP3); - - JoinApplicationStatBo join3 = buildApplicationStat(APPLICATION_ID, TIMESTAMP, - JoinApplicationStatBo.Builder::addDataSourceList, - List.of(joinResponseTimeBo3_1, joinResponseTimeBo3_2, joinResponseTimeBo3_3)); - - List joinApplicationStatBoList = List.of(join1, join2, join3); - - JoinApplicationStatBo joinApplicationStatBo = JoinApplicationStatBo.joinApplicationStatBoByTimeSlice(joinApplicationStatBoList); - assertEquals(joinApplicationStatBo.getId(), APPLICATION_ID); - assertEquals(joinApplicationStatBo.getTimestamp(), TIMESTAMP); - List joinDataSourceListBoList = joinApplicationStatBo.getJoinDataSourceListBoList(); - joinDataSourceListBoList.sort(Comparator.comparingLong(JoinDataSourceListBo::getTimestamp)); - - assertThat(joinDataSourceListBoList) - .hasSize(5) - .flatMap(JoinDataSourceListBo::getJoinDataSourceBoList) - .map(JoinDataSourceBo::getActiveConnectionSizeJoinValue) - .map(JoinIntFieldBo::getAvg) - .containsExactly(100, 200, 300, 400, 30); - } - - private void assertJoinDataSourceListBoList(List joinDataSourceListBoList) { - assertThat(joinDataSourceListBoList).hasSize(5); - - JoinDataSourceListBo joinDataSourceListBo1 = joinDataSourceListBoList.get(0); - assertEquals(joinDataSourceListBo1.getId(), "id1"); - assertEquals(joinDataSourceListBo1.getTimestamp(), 1487149800000L); - List joinDataSourceBoList1 = joinDataSourceListBo1.getJoinDataSourceBoList(); - assertThat(joinDataSourceBoList1).hasSize(2); - JoinDataSourceBo joinDataSourceBo1_1 = joinDataSourceBoList1.get(0); - assertEquals(joinDataSourceBo1_1.getServiceTypeCode(), 1000); - assertEquals(joinDataSourceBo1_1.getUrl(), "jdbc:mysql"); - assertEquals(new JoinIntFieldBo(286, 200, "agent_id_1_-50", 640, "agent_id_6_40"), joinDataSourceBo1_1.getActiveConnectionSizeJoinValue()); - - JoinDataSourceBo joinDataSourceBo1_2 = joinDataSourceBoList1.get(1); - assertEquals(joinDataSourceBo1_2.getServiceTypeCode(), 2000); - assertEquals(joinDataSourceBo1_2.getUrl(), "jdbc:mssql"); - assertEquals(new JoinIntFieldBo(386, 300, "agent_id_1_-50", 740, "agent_id_6_40"), joinDataSourceBo1_2.getActiveConnectionSizeJoinValue()); - - JoinDataSourceListBo joinDataSourceListBo2 = joinDataSourceListBoList.get(1); - assertEquals(joinDataSourceListBo2.getId(), "id1"); - assertEquals(joinDataSourceListBo2.getTimestamp(), 1487149805000L); - List joinDataSourceBoList2 = joinDataSourceListBo2.getJoinDataSourceBoList(); - assertThat(joinDataSourceBoList2).hasSize(2); - JoinDataSourceBo joinDataSourceBo2_1 = joinDataSourceBoList2.get(0); - assertEquals(joinDataSourceBo2_1.getServiceTypeCode(), 1000); - assertEquals(joinDataSourceBo2_1.getUrl(), "jdbc:mysql"); - assertEquals(new JoinIntFieldBo(186, 0, "agent_id_2_-50", 740, "agent_id_7_40"), joinDataSourceBo2_1.getActiveConnectionSizeJoinValue()); - - JoinDataSourceBo joinDataSourceBo2_2 = joinDataSourceBoList2.get(1); - assertEquals(joinDataSourceBo2_2.getServiceTypeCode(), 2000); - assertEquals(joinDataSourceBo2_2.getUrl(), "jdbc:mssql"); - assertEquals(new JoinIntFieldBo(286, 100, "agent_id_2_-50", 840, "agent_id_7_40"), joinDataSourceBo2_2.getActiveConnectionSizeJoinValue()); - - JoinDataSourceListBo joinDataSourceListBo3 = joinDataSourceListBoList.get(2); - assertEquals(joinDataSourceListBo3.getId(), "id1"); - assertEquals(joinDataSourceListBo3.getTimestamp(), 1487149810000L); - List joinDataSourceBoList3 = joinDataSourceListBo3.getJoinDataSourceBoList(); - assertThat(joinDataSourceBoList3).hasSize(2); - JoinDataSourceBo joinDataSourceBo3_1 = joinDataSourceBoList3.get(0); - assertEquals(joinDataSourceBo3_1.getServiceTypeCode(), 1000); - assertEquals(joinDataSourceBo3_1.getUrl(), "jdbc:mysql"); - assertEquals(new JoinIntFieldBo(486, 100, "agent_id_3_-50", 940, "agent_id_8_40"), joinDataSourceBo3_1.getActiveConnectionSizeJoinValue()); - - JoinDataSourceBo joinDataSourceBo3_2 = joinDataSourceBoList3.get(1); - assertEquals(joinDataSourceBo3_2.getServiceTypeCode(), 2000); - assertEquals(joinDataSourceBo3_2.getUrl(), "jdbc:mssql"); - assertEquals(new JoinIntFieldBo(586, 200, "agent_id_3_-50", 1040, "agent_id_8_40"), joinDataSourceBo3_2.getActiveConnectionSizeJoinValue()); - - JoinDataSourceListBo joinDataSourceListBo4 = joinDataSourceListBoList.get(3); - assertEquals(joinDataSourceListBo4.getId(), "id1"); - assertEquals(joinDataSourceListBo4.getTimestamp(), 1487149815000L); - List joinDataSourceBoList4 = joinDataSourceListBo4.getJoinDataSourceBoList(); - assertThat(joinDataSourceBoList4).hasSize(2); - JoinDataSourceBo joinDataSourceBo4_1 = joinDataSourceBoList4.get(0); - assertEquals(joinDataSourceBo4_1.getServiceTypeCode(), 1000); - assertEquals(joinDataSourceBo4_1.getUrl(), "jdbc:mysql"); - assertEquals(new JoinIntFieldBo(386, 500, "agent_id_4_-50", 640, "agent_id_9_40"), joinDataSourceBo4_1.getActiveConnectionSizeJoinValue()); - - JoinDataSourceBo joinDataSourceBo4_2 = joinDataSourceBoList4.get(1); - assertEquals(joinDataSourceBo4_2.getServiceTypeCode(), 2000); - assertEquals(joinDataSourceBo4_2.getUrl(), "jdbc:mssql"); - assertEquals(new JoinIntFieldBo(486, 600, "agent_id_4_-50", 740, "agent_id_9_40"), joinDataSourceBo4_2.getActiveConnectionSizeJoinValue()); - - JoinDataSourceListBo joinDataSourceListBo5 = joinDataSourceListBoList.get(4); - assertEquals(joinDataSourceListBo5.getId(), "id1"); - assertEquals(joinDataSourceListBo5.getTimestamp(), 1487149820000L); - List joinDataSourceBoList5 = joinDataSourceListBo5.getJoinDataSourceBoList(); - assertThat(joinDataSourceBoList5).hasSize(2); - JoinDataSourceBo joinDataSourceBo5_1 = joinDataSourceBoList5.get(0); - assertEquals(joinDataSourceBo5_1.getServiceTypeCode(), 1000); - assertEquals(joinDataSourceBo5_1.getUrl(), "jdbc:mysql"); - assertEquals(new JoinIntFieldBo(86, 700, "agent_id_5_-50", 840, "agent_id_10_40"), joinDataSourceBo5_1.getActiveConnectionSizeJoinValue()); - - JoinDataSourceBo joinDataSourceBo5_2 = joinDataSourceBoList5.get(1); - assertEquals(joinDataSourceBo5_2.getServiceTypeCode(), 2000); - assertEquals(joinDataSourceBo5_2.getUrl(), "jdbc:mssql"); - assertEquals(new JoinIntFieldBo(186, 800, "agent_id_5_-50", 940, "agent_id_10_40"), joinDataSourceBo5_2.getActiveConnectionSizeJoinValue()); - } - - - private JoinApplicationStatBo createDataSource(final String id, final long timestamp, final int plus) { - final JoinApplicationStatBo.Builder joinApplicationStatBo = JoinApplicationStatBo.newBuilder(id, timestamp); - createJoinDataSourceListBoList(id, timestamp, plus) - .forEach(joinApplicationStatBo::addDataSourceList); - joinApplicationStatBo.setStatType(StatType.APP_STST); - return joinApplicationStatBo.build(); - } - - private List createJoinDataSourceListBoList(String id, long currentTime, int plus) { - - List joinDataSourceBoList1 = List.of( - new JoinDataSourceBo((short) 1000, "jdbc:mysql", 300 + plus, 250 + plus, "agent_id_1_" + plus, 600 + plus, "agent_id_6_" + plus), - new JoinDataSourceBo((short) 2000, "jdbc:mssql", 400 + plus, 350 + plus, "agent_id_1_" + plus, 700 + plus, "agent_id_6_" + plus) - ); - JoinDataSourceListBo joinDataSourceListBo1 = new JoinDataSourceListBo(id, joinDataSourceBoList1, currentTime); - - List joinDataSourceBoList2 = List.of( - new JoinDataSourceBo((short) 1000, "jdbc:mysql", 200 + plus, 50 + plus, "agent_id_2_" + plus, 700 + plus, "agent_id_7_" + plus), - new JoinDataSourceBo((short) 2000, "jdbc:mssql", 300 + plus, 150 + plus, "agent_id_2_" + plus, 800 + plus, "agent_id_7_" + plus) - ); - JoinDataSourceListBo joinDataSourceListBo2 = new JoinDataSourceListBo(id, joinDataSourceBoList2, currentTime + 5000); - - List joinDataSourceBoList3 = List.of( - new JoinDataSourceBo((short) 1000, "jdbc:mysql", 500 + plus, 150 + plus, "agent_id_3_" + plus, 900 + plus, "agent_id_8_" + plus), - new JoinDataSourceBo((short) 2000, "jdbc:mssql", 600 + plus, 250 + plus, "agent_id_3_" + plus, 1000 + plus, "agent_id_8_" + plus) - ); - JoinDataSourceListBo joinDataSourceListBo3 = new JoinDataSourceListBo(id, joinDataSourceBoList3, currentTime + 10000); - - List joinDataSourceBoList4 = List.of( - new JoinDataSourceBo((short) 1000, "jdbc:mysql", 400 + plus, 550 + plus, "agent_id_4_" + plus, 600 + plus, "agent_id_9_" + plus), - new JoinDataSourceBo((short) 2000, "jdbc:mssql", 500 + plus, 650 + plus, "agent_id_4_" + plus, 700 + plus, "agent_id_9_" + plus) - ); - JoinDataSourceListBo joinDataSourceListBo4 = new JoinDataSourceListBo(id, joinDataSourceBoList4, currentTime + 15000); - - List joinDataSourceBoList5 = List.of( - new JoinDataSourceBo((short) 1000, "jdbc:mysql", 100 + plus, 750 + plus, "agent_id_5_" + plus, 800 + plus, "agent_id_10_" + plus), - new JoinDataSourceBo((short) 2000, "jdbc:mssql", 200 + plus, 850 + plus, "agent_id_5_" + plus, 900 + plus, "agent_id_10_" + plus) - ); - JoinDataSourceListBo joinDataSourceListBo5 = new JoinDataSourceListBo(id, joinDataSourceBoList5, currentTime + 20000); - - return List.of(joinDataSourceListBo1, joinDataSourceListBo2, joinDataSourceListBo3, joinDataSourceListBo4, joinDataSourceListBo5); - } - - - @Test - public void joinApplicationStatBoByTimeSlice13Test() { - final long currentTime = 1487149800000L; // 18:10:00 15 2 2017 - List joinApplicationStatBoList = List.of( - createJoinApplicationStatBo7("id1", currentTime, 10), - createJoinApplicationStatBo7("id2", currentTime + 1000, -40), - createJoinApplicationStatBo7("id3", currentTime + 2000, -30), - createJoinApplicationStatBo7("id4", currentTime + 3000, 40), - createJoinApplicationStatBo7("id5", currentTime + 4000, -50) - ); - - JoinApplicationStatBo resultJoinApplicationStatBo = JoinApplicationStatBo.joinApplicationStatBoByTimeSlice(joinApplicationStatBoList); - List joinFileDescriptorBoList = resultJoinApplicationStatBo.getJoinFileDescriptorBoList(); - joinFileDescriptorBoList.sort(Comparator.comparingLong(JoinFileDescriptorBo::getTimestamp)); - assertJoinFileDescriptorBoList(joinFileDescriptorBoList); - } - - @Test - public void joinApplicationStatBoByTimeSlice14Test() { - List file1 = List.of( - new JoinFileDescriptorBo("agent1", 440, 700, "agent1", 300, "agent1", TIMESTAMP), - new JoinFileDescriptorBo("agent1", 330, 400, "agent1", 100, "agent1", TIMESTAMP1), - new JoinFileDescriptorBo("agent1", 550, 600, "agent1", 70, "agent1", TIMESTAMP2) - ); - JoinApplicationStatBo join1 = buildApplicationStat(APPLICATION_ID, TIMESTAMP, - JoinApplicationStatBo.Builder::addFileDescriptor, file1); - - - List file2 = List.of( - new JoinFileDescriptorBo("agent1", 330, 700, "agent1", 300, "agent1", TIMESTAMP), - new JoinFileDescriptorBo("agent1", 220, 400, "agent1", 100, "agent1", TIMESTAMP1), - new JoinFileDescriptorBo("agent1", 110, 600, "agent1", 70, "agent1", TIMESTAMP2), - new JoinFileDescriptorBo("agent1", 770, 600, "agent1", 70, "agent1", TIMESTAMP4) - ); - JoinApplicationStatBo join2 = buildApplicationStat(APPLICATION_ID, TIMESTAMP, - JoinApplicationStatBo.Builder::addFileDescriptor, file2); - - - List file3 = List.of( - new JoinFileDescriptorBo("agent1", 220, 700, "agent1", 300, "agent1", TIMESTAMP), - new JoinFileDescriptorBo("agent1", 110, 400, "agent1", 100, "agent1", TIMESTAMP1), - new JoinFileDescriptorBo("agent1", 880, 600, "agent1", 70, "agent1", TIMESTAMP3) - ); - JoinApplicationStatBo join3 = buildApplicationStat(APPLICATION_ID, TIMESTAMP, - JoinApplicationStatBo.Builder::addFileDescriptor, file3); - - List joinApplicationStatBoList = List.of(join1, join2, join3); - - JoinApplicationStatBo joinApplicationStatBo = JoinApplicationStatBo.joinApplicationStatBoByTimeSlice(joinApplicationStatBoList); - assertEquals(joinApplicationStatBo.getId(), APPLICATION_ID); - assertEquals(joinApplicationStatBo.getTimestamp(), TIMESTAMP); - List joinFileDescriptorBoList = joinApplicationStatBo.getJoinFileDescriptorBoList(); - joinFileDescriptorBoList.sort(Comparator.comparingLong(JoinFileDescriptorBo::getTimestamp)); - - assertThat(joinFileDescriptorBoList) - .hasSize(5) - .map(JoinFileDescriptorBo::getOpenFdCountJoinValue) - .map(JoinLongFieldBo::getAvg) - .containsExactly(330L, 220L, 330L, 770L, 880L); - } - - - private void assertJoinFileDescriptorBoList(List joinFileDescriptorBoList) { - assertThat(joinFileDescriptorBoList).hasSize(5); - - JoinFileDescriptorBo joinFileDescriptorBo1 = joinFileDescriptorBoList.get(0); - assertFile(joinFileDescriptorBo1, "id1", 1487149800000L, - new JoinLongFieldBo(486L, 220L, "id5_2", 910L, "id4_1")); - - JoinFileDescriptorBo joinFileDescriptorBo2 = joinFileDescriptorBoList.get(1); - assertFile(joinFileDescriptorBo2, "id1", 1487149805000L, - new JoinLongFieldBo(386L, 350L, "id5_2", 810L, "id4_1")); - - JoinFileDescriptorBo joinFileDescriptorBo3 = joinFileDescriptorBoList.get(2); - assertFile(joinFileDescriptorBo3, "id1", 1487149810000L, - new JoinLongFieldBo(286L, 220L, "id5_2", 710L, "id4_1")); - - JoinFileDescriptorBo joinFileDescriptorBo4 = joinFileDescriptorBoList.get(3); - assertFile(joinFileDescriptorBo4, "id1", 1487149815000L, - new JoinLongFieldBo(186L, 120L, "id5_2", 610L, "id4_1")); - - JoinFileDescriptorBo joinFileDescriptorBo5 = joinFileDescriptorBoList.get(4); - assertFile(joinFileDescriptorBo5, "id1", 1487149820000L, - new JoinLongFieldBo(86L, 20L, "id5_2", 930L, "id4_1")); - } - - private static void assertFile(JoinFileDescriptorBo file, String id, long timestamp, JoinLongFieldBo longField) { - assertEquals(file.getId(), id); - assertEquals(file.getTimestamp(), timestamp); - assertEquals(file.getOpenFdCountJoinValue(), longField); - } - - private JoinApplicationStatBo createJoinApplicationStatBo7(final String id, final long timestamp, final int plus) { - final JoinApplicationStatBo.Builder joinApplicationStatBo = JoinApplicationStatBo.newBuilder(id, timestamp); - createJoinFileDescriptorBoList(id, timestamp, plus) - .forEach(joinApplicationStatBo::addFileDescriptor); - joinApplicationStatBo.setStatType(StatType.APP_STST); - return joinApplicationStatBo.build(); - } - - private List createJoinFileDescriptorBoList(final String id, final long currentTime, int plus) { - return List.of( - new JoinFileDescriptorBo(id, 500 + plus, 870 + plus, id + "_1", 270 + plus, id + "_2", currentTime), - new JoinFileDescriptorBo(id, 400 + plus, 770 + plus, id + "_1", 400 + plus, id + "_2", currentTime + 5000), - new JoinFileDescriptorBo(id, 300 + plus, 670 + plus, id + "_1", 270 + plus, id + "_2", currentTime + 10000), - new JoinFileDescriptorBo(id, 200 + plus, 570 + plus, id + "_1", 170 + plus, id + "_2", currentTime + 15000), - new JoinFileDescriptorBo(id, 100 + plus, 890 + plus, id + "_1", 70 + plus, id + "_2", currentTime + 20000) - ); - } - - @Test - public void joinApplicationStatBoByTimeSlice15Test() { - final long currentTime = 1487149800000L; // 18:10:00 15 2 2017 - List joinApplicationStatBoList = List.of( - createDirectBuffer("id1", currentTime, 10), - createDirectBuffer("id2", currentTime + 1000, -40), - createDirectBuffer("id3", currentTime + 2000, -30), - createDirectBuffer("id4", currentTime + 3000, 40), - createDirectBuffer("id5", currentTime + 4000, -50) - ); - JoinApplicationStatBo resultJoinApplicationStatBo = JoinApplicationStatBo.joinApplicationStatBoByTimeSlice(joinApplicationStatBoList); - List joinDirectBufferBoList = resultJoinApplicationStatBo.getJoinDirectBufferBoList(); - joinDirectBufferBoList.sort(Comparator.comparingLong(JoinDirectBufferBo::getTimestamp)); - assertJoinDirectBufferBoList(joinDirectBufferBoList); - } - - @Test - public void joinApplicationStatBoByTimeSlice16Test() { - List buffer1 = List.of( - new JoinDirectBufferBo("agent1", 440, 700, "agent1", 300, "agent1", 440, 700, "agent1", 300, "agent1", 440, 700, "agent1", 300, "agent1", 440, 700, "agent1", 300, "agent1", TIMESTAMP), - new JoinDirectBufferBo("agent1", 330, 400, "agent1", 100, "agent1", 330, 400, "agent1", 100, "agent1", 330, 400, "agent1", 100, "agent1", 330, 400, "agent1", 100, "agent1", TIMESTAMP1), - new JoinDirectBufferBo("agent1", 550, 600, "agent1", 70, "agent1", 550, 600, "agent1", 70, "agent1", 550, 600, "agent1", 70, "agent1", 550, 600, "agent1", 70, "agent1", TIMESTAMP2) - ); - JoinApplicationStatBo join1 = buildApplicationStat(APPLICATION_ID, TIMESTAMP, - JoinApplicationStatBo.Builder::addDirectBuffer, buffer1); - - List buffer2 = List.of( - new JoinDirectBufferBo("agent1", 330, 700, "agent1", 300, "agent1", 330, 700, "agent1", 300, "agent1", 330, 700, "agent1", 300, "agent1", 330, 700, "agent1", 300, "agent1", TIMESTAMP), - new JoinDirectBufferBo("agent1", 220, 400, "agent1", 100, "agent1", 220, 400, "agent1", 100, "agent1", 220, 400, "agent1", 100, "agent1", 220, 400, "agent1", 100, "agent1", TIMESTAMP1), - new JoinDirectBufferBo("agent1", 110, 600, "agent1", 70, "agent1", 110, 600, "agent1", 70, "agent1", 110, 600, "agent1", 70, "agent1", 110, 600, "agent1", 70, "agent1", TIMESTAMP2), - new JoinDirectBufferBo("agent1", 770, 600, "agent1", 70, "agent1", 770, 600, "agent1", 70, "agent1", 770, 600, "agent1", 70, "agent1", 770, 600, "agent1", 70, "agent1", TIMESTAMP4) - ); - JoinApplicationStatBo join2 = buildApplicationStat(APPLICATION_ID, TIMESTAMP, - JoinApplicationStatBo.Builder::addDirectBuffer, buffer2); - - List buffer3 = List.of( - new JoinDirectBufferBo("agent1", 220, 700, "agent1", 300, "agent1", 220, 700, "agent1", 300, "agent1", 220, 700, "agent1", 300, "agent1", 220, 700, "agent1", 300, "agent1", TIMESTAMP), - new JoinDirectBufferBo("agent1", 110, 400, "agent1", 100, "agent1", 110, 400, "agent1", 100, "agent1", 110, 400, "agent1", 100, "agent1", 110, 400, "agent1", 100, "agent1", TIMESTAMP1), - new JoinDirectBufferBo("agent1", 880, 600, "agent1", 70, "agent1", 880, 600, "agent1", 70, "agent1", 880, 600, "agent1", 70, "agent1", 880, 600, "agent1", 70, "agent1", TIMESTAMP3) - ); - JoinApplicationStatBo join3 = buildApplicationStat(APPLICATION_ID, TIMESTAMP, - JoinApplicationStatBo.Builder::addDirectBuffer, buffer3); - - List joinApplicationStatBoList = List.of(join1, join2, join3); - - JoinApplicationStatBo joinApplicationStatBo = JoinApplicationStatBo.joinApplicationStatBoByTimeSlice(joinApplicationStatBoList); - assertEquals(joinApplicationStatBo.getId(), APPLICATION_ID); - assertEquals(joinApplicationStatBo.getTimestamp(), TIMESTAMP); - List joinDirectBufferBoList = joinApplicationStatBo.getJoinDirectBufferBoList(); - joinDirectBufferBoList.sort(Comparator.comparingLong(JoinDirectBufferBo::getTimestamp)); - - assertThat(joinDirectBufferBoList).hasSize(5); - - assertThat(joinDirectBufferBoList) - .map(JoinDirectBufferBo::getDirectCountJoinValue) - .map(AbstractJoinFieldBo::getAvg) - .containsExactly(330L, 220L, 330L, 770L, 880L); - - assertThat(joinDirectBufferBoList) - .map(JoinDirectBufferBo::getDirectMemoryUsedJoinValue) - .map(AbstractJoinFieldBo::getAvg) - .containsExactly(330L, 220L, 330L, 770L, 880L); - - assertThat(joinDirectBufferBoList) - .map(JoinDirectBufferBo::getMappedCountJoinValue) - .map(AbstractJoinFieldBo::getAvg) - .containsExactly(330L, 220L, 330L, 770L, 880L); - - assertThat(joinDirectBufferBoList) - .map(JoinDirectBufferBo::getMappedMemoryUsedJoinValue) - .map(AbstractJoinFieldBo::getAvg) - .containsExactly(330L, 220L, 330L, 770L, 880L); - - } - - - private void assertJoinDirectBufferBoList(List joinDirectBufferBoList) { - assertThat(joinDirectBufferBoList).hasSize(5); - //1 - JoinDirectBufferBo joinDirectBufferBo1 = joinDirectBufferBoList.get(0); - assertMemory(joinDirectBufferBo1, 1487149800000L, - new JoinLongFieldBo(486L, 220L, "id5_2", 910L, "id4_1"), - new JoinLongFieldBo(486L, 220L, "id5_2", 910L, "id4_1"), - new JoinLongFieldBo(486L, 220L, "id5_2", 910L, "id4_1"), - new JoinLongFieldBo(486L, 220L, "id5_2", 910L, "id4_1")); - - //2 - JoinDirectBufferBo joinDirectBufferBo2 = joinDirectBufferBoList.get(1); - assertMemory(joinDirectBufferBo2, 1487149805000L, - new JoinLongFieldBo(386L, 350L, "id5_2", 810L, "id4_1"), - new JoinLongFieldBo(386L, 350L, "id5_2", 810L, "id4_1"), - new JoinLongFieldBo(386L, 350L, "id5_2", 810L, "id4_1"), - new JoinLongFieldBo(386L, 350L, "id5_2", 810L, "id4_1")); - - //3 - JoinDirectBufferBo joinDirectBufferBo3 = joinDirectBufferBoList.get(2); - assertMemory(joinDirectBufferBo3, 1487149810000L, - new JoinLongFieldBo(286L, 220L, "id5_2", 710L, "id4_1"), - new JoinLongFieldBo(286L, 220L, "id5_2", 710L, "id4_1"), - new JoinLongFieldBo(286L, 220L, "id5_2", 710L, "id4_1"), - new JoinLongFieldBo(286L, 220L, "id5_2", 710L, "id4_1")); - - //4 - JoinDirectBufferBo joinDirectBufferBo4 = joinDirectBufferBoList.get(3); - assertMemory(joinDirectBufferBo4, 1487149815000L, - new JoinLongFieldBo(186L, 120L, "id5_2", 610L, "id4_1"), - new JoinLongFieldBo(186L, 120L, "id5_2", 610L, "id4_1"), - new JoinLongFieldBo(186L, 120L, "id5_2", 610L, "id4_1"), - new JoinLongFieldBo(186L, 120L, "id5_2", 610L, "id4_1")); - - //5 - JoinDirectBufferBo joinDirectBufferBo5 = joinDirectBufferBoList.get(4); - assertMemory(joinDirectBufferBo5, 1487149820000L, - new JoinLongFieldBo(86L, 20L, "id5_2", 930L, "id4_1"), - new JoinLongFieldBo(86L, 20L, "id5_2", 930L, "id4_1"), - new JoinLongFieldBo(86L, 20L, "id5_2", 930L, "id4_1"), - new JoinLongFieldBo(86L, 20L, "id5_2", 930L, "id4_1")); - } - - private void assertMemory(JoinDirectBufferBo memory, long timestamp, JoinLongFieldBo directCount, JoinLongFieldBo directUsed, JoinLongFieldBo mappedCount, JoinLongFieldBo mappedUsed) { - assertEquals(memory.getId(), "id1"); - assertEquals(memory.getTimestamp(), timestamp); - assertEquals(memory.getDirectCountJoinValue(), directCount); - assertEquals(memory.getDirectMemoryUsedJoinValue(), directUsed); - assertEquals(memory.getMappedCountJoinValue(), mappedCount); - assertEquals(memory.getMappedMemoryUsedJoinValue(), mappedUsed); - } - - private JoinApplicationStatBo createDirectBuffer(final String id, final long timestamp, final int plus) { - final JoinApplicationStatBo.Builder joinApplicationStatBo = JoinApplicationStatBo.newBuilder(id, timestamp); - joinApplicationStatBo.setStatType(StatType.APP_STST); - createJoinDirectBufferBoList(id, timestamp, plus) - .forEach(joinApplicationStatBo::addDirectBuffer); - return joinApplicationStatBo.build(); - } - - private List createJoinDirectBufferBoList(final String id, final long currentTime, int plus) { - return List.of( - new JoinDirectBufferBo(id, 500 + plus, 870 + plus, id + "_1", 270 + plus, id + "_2", 500 + plus, 870 + plus, id + "_1", 270 + plus, id + "_2", 500 + plus, 870 + plus, id + "_1", 270 + plus, id + "_2", 500 + plus, 870 + plus, id + "_1", 270 + plus, id + "_2", currentTime), - new JoinDirectBufferBo(id, 400 + plus, 770 + plus, id + "_1", 400 + plus, id + "_2", 400 + plus, 770 + plus, id + "_1", 400 + plus, id + "_2", 400 + plus, 770 + plus, id + "_1", 400 + plus, id + "_2", 400 + plus, 770 + plus, id + "_1", 400 + plus, id + "_2", currentTime + 5000), - new JoinDirectBufferBo(id, 300 + plus, 670 + plus, id + "_1", 270 + plus, id + "_2", 300 + plus, 670 + plus, id + "_1", 270 + plus, id + "_2", 300 + plus, 670 + plus, id + "_1", 270 + plus, id + "_2", 300 + plus, 670 + plus, id + "_1", 270 + plus, id + "_2", currentTime + 10000), - new JoinDirectBufferBo(id, 200 + plus, 570 + plus, id + "_1", 170 + plus, id + "_2", 200 + plus, 570 + plus, id + "_1", 170 + plus, id + "_2", 200 + plus, 570 + plus, id + "_1", 170 + plus, id + "_2", 200 + plus, 570 + plus, id + "_1", 170 + plus, id + "_2", currentTime + 15000), - new JoinDirectBufferBo(id, 100 + plus, 890 + plus, id + "_1", 70 + plus, id + "_2", 100 + plus, 890 + plus, id + "_1", 70 + plus, id + "_2", 100 + plus, 890 + plus, id + "_1", 70 + plus, id + "_2", 100 + plus, 890 + plus, id + "_1", 70 + plus, id + "_2", currentTime + 20000) - ); - } - - @Test - public void createJoinApplicationStatBoTest() { - - JoinAgentStatBo.Builder builder = JoinAgentStatBo.newBuilder("Agent", Long.MIN_VALUE, TIMESTAMP3); - List.of( - new JoinCpuLoadBo("agent1", 44, 70, "agent1", 30, "agent1", 50, 60, "agent1", 33, "agent1", TIMESTAMP3), - new JoinCpuLoadBo("agent1", 33, 40, "agent1", 10, "agent1", 20, 78, "agent1", 12, "agent1", 1498462570000L), - new JoinCpuLoadBo("agent1", 55, 60, "agent1", 7, "agent1", 30, 39, "agent1", 30, "agent1", 1498462575000L), - new JoinCpuLoadBo("agent1", 11, 80, "agent1", 8, "agent1", 10, 50, "agent1", 14, "agent1", 1498462580000L), - new JoinCpuLoadBo("agent1", 22, 70, "agent1", 12, "agent1", 40, 99, "agent1", 50, "agent1", 1498462585000L) - ).forEach(builder::addCpuLoadBo); - - List.of( - new JoinMemoryBo("agent1", TIMESTAMP3, 3000, 2000, 5000, "agent1", "agent1", 500, 50, 600, "agent1", "agent1"), - new JoinMemoryBo("agent1", 1498462570000L, 4000, 1000, 7000, "agent1", "agent1", 400, 150, 600, "agent1", "agent1"), - new JoinMemoryBo("agent1", 1498462575000L, 5000, 3000, 8000, "agent1", "agent1", 200, 100, 200, "agent1", "agent1"), - new JoinMemoryBo("agent1", 1498462580000L, 1000, 100, 3000, "agent1", "agent1", 100, 900, 1000, "agent1", "agent1"), - new JoinMemoryBo("agent1", 1498462585000L, 2000, 1000, 6000, "agent1", "agent1", 300, 100, 2900, "agent1", "agent1") - ).forEach(builder::addMemory); - - List.of( - new JoinTransactionBo("agent1", 5000, 150, 20, "agent1", 230, "agent1", TIMESTAMP3), - new JoinTransactionBo("agent2", 5000, 300, 10, "agent2", 400, "agent2", 1498462570000L), - new JoinTransactionBo("agent3", 5000, 30, 5, "agent3", 100, "agent3", 1498462575000L), - new JoinTransactionBo("agent4", 5000, 30, 5, "agent4", 100, "agent4", 1498462580000L), - new JoinTransactionBo("agent5", 5000, 30, 5, "agent5", 100, "agent5", 1498462585000L) - ).forEach(builder::addTransaction); - - List.of( - new JoinActiveTraceBo("agent1", 1, (short) 2, 30, 15, "app_1_1", 40, "app_1_2", TIMESTAMP3), - new JoinActiveTraceBo("agent1", 1, (short) 2, 30, 15, "app_1_1", 40, "app_1_2", 1498462570000L), - new JoinActiveTraceBo("agent1", 1, (short) 2, 30, 15, "app_1_1", 40, "app_1_2", 1498462575000L), - new JoinActiveTraceBo("agent1", 1, (short) 2, 30, 15, "app_1_1", 40, "app_1_2", 1498462580000L), - new JoinActiveTraceBo("agent1", 1, (short) 2, 30, 15, "app_1_1", 40, "app_1_2", 1498462585000L) - ).forEach(builder::addActiveTrace); - - List.of( - new JoinResponseTimeBo("agent1", TIMESTAMP3, 3000, 2, "app_1_1", 6000, "app_1_2"), - new JoinResponseTimeBo("agent1", 1498462570000L, 4000, 200, "app_2_1", 9000, "app_2_2"), - new JoinResponseTimeBo("agent1", 1498462575000L, 2000, 20, "app_3_1", 7000, "app_3_2"), - new JoinResponseTimeBo("agent1", 1498462580000L, 5000, 20, "app_4_1", 8000, "app_4_2"), - new JoinResponseTimeBo("agent1", 1498462585000L, 1000, 10, "app_5_1", 6600, "app_5_2") - ).forEach(builder::addResponseTime); - - List joinDataSourceBoList1 = List.of( - new JoinDataSourceBo((short) 1000, "jdbc:mysql", 300, 250, "agent_id_1", 600, "agent_id_6"), - new JoinDataSourceBo((short) 2000, "jdbc:mssql", 400, 350, "agent_id_1", 700, "agent_id_6") - ); - JoinDataSourceListBo joinDataSourceListBo1 = new JoinDataSourceListBo("agent1", joinDataSourceBoList1, TIMESTAMP3); - - List joinDataSourceBoList2 = List.of( - new JoinDataSourceBo((short) 1000, "jdbc:mysql", 200, 50, "agent_id_2", 700, "agent_id_7"), - new JoinDataSourceBo((short) 2000, "jdbc:mssql", 300, 150, "agent_id_2", 800, "agent_id_7") - ); - JoinDataSourceListBo joinDataSourceListBo2 = new JoinDataSourceListBo("agent1", joinDataSourceBoList2, 1498462570000L); - - List joinDataSourceBoList3 = List.of( - new JoinDataSourceBo((short) 1000, "jdbc:mysql", 500, 150, "agent_id_3", 900, "agent_id_8"), - new JoinDataSourceBo((short) 2000, "jdbc:mssql", 600, 250, "agent_id_3", 1000, "agent_id_8") - ); - JoinDataSourceListBo joinDataSourceListBo3 = new JoinDataSourceListBo("agent1", joinDataSourceBoList3, 1498462575000L); - - List joinDataSourceBoList4 = List.of( - new JoinDataSourceBo((short) 1000, "jdbc:mysql", 400, 550, "agent_id_4", 600, "agent_id_9"), - new JoinDataSourceBo((short) 2000, "jdbc:mssql", 500, 650, "agent_id_4", 700, "agent_id_9") - ); - JoinDataSourceListBo joinDataSourceListBo4 = new JoinDataSourceListBo("agent1", joinDataSourceBoList4, 1498462580000L); - - List joinDataSourceBoList5 = List.of( - new JoinDataSourceBo((short) 1000, "jdbc:mysql", 100, 750, "agent_id_5", 800, "agent_id_10"), - new JoinDataSourceBo((short) 2000, "jdbc:mssql", 200, 850, "agent_id_5", 900, "agent_id_10") - ); - JoinDataSourceListBo joinDataSourceListBo5 = new JoinDataSourceListBo("agent1", joinDataSourceBoList5, 1498462585000L); - - List.of(joinDataSourceListBo1, joinDataSourceListBo2, joinDataSourceListBo3, joinDataSourceListBo4, joinDataSourceListBo5) - .forEach(builder::addDataSourceListBo); - - List.of( - new JoinFileDescriptorBo("agent1", 44, 70, "agent1", 30, "agent1", TIMESTAMP3), - new JoinFileDescriptorBo("agent1", 33, 40, "agent1", 10, "agent1", 1498462570000L), - new JoinFileDescriptorBo("agent1", 55, 60, "agent1", 7, "agent1", 1498462575000L), - new JoinFileDescriptorBo("agent1", 11, 80, "agent1", 8, "agent1", 1498462580000L), - new JoinFileDescriptorBo("agent1", 22, 70, "agent1", 12, "agent1", 1498462585000L) - ).forEach(builder::addFileDescriptor); - - List.of( - new JoinDirectBufferBo("agent1", 44, 70, "agent1", 30, "agent1" - , 44, 70, "agent1", 30, "agent1" - , 44, 70, "agent1", 30, "agent1" - , 44, 70, "agent1", 30, "agent1" - , TIMESTAMP3), - new JoinDirectBufferBo("agent2", 33, 40, "agent2", 10, "agent2" - , 33, 40, "agent2", 10, "agent2" - , 33, 40, "agent2", 10, "agent2" - , 33, 40, "agent2", 10, "agent2" - , 1498462570000L), - new JoinDirectBufferBo("agent3", 55, 60, "agent3", 7, "agent3" - , 55, 60, "agent3", 7, "agent3" - , 55, 60, "agent3", 7, "agent3" - , 55, 60, "agent3", 7, "agent3" - , 1498462575000L), - new JoinDirectBufferBo("agent4", 11, 80, "agent4", 8, "agent4" - , 11, 80, "agent4", 8, "agent4" - , 11, 80, "agent4", 8, "agent4" - , 11, 80, "agent4", 8, "agent4" - , 1498462580000L), - new JoinDirectBufferBo("agent5", 22, 70, "agent5", 12, "agent5" - , 22, 70, "agent5", 12, "agent5" - , 22, 70, "agent5", 12, "agent5" - , 22, 70, "agent5", 12, "agent5" - , 1498462585000L) - ).forEach(builder::addDirectBuffer); - - JoinAgentStatBo agentStatBo = builder.build(); - List joinApplicationStatBoList = JoinApplicationStatBo.createJoinApplicationStatBo(APPLICATION_ID, agentStatBo, 60000); - assertThat(joinApplicationStatBoList).hasSize(1); - JoinApplicationStatBo joinApplicationStatBo = joinApplicationStatBoList.get(0); - assertEquals(joinApplicationStatBo.getId(), APPLICATION_ID); - - assertHasSize(joinApplicationStatBo, 5); - } - - @Test - public void createJoinApplicationStatBo2Test() { - JoinAgentStatBo.Builder builder = JoinAgentStatBo.newBuilder("Agent", Long.MIN_VALUE, TIMESTAMP); - - List.of( - new JoinCpuLoadBo("agent1", 44, 70, "agent1", 30, "agent1", 50, 60, "agent1", 33, "agent1", TIMESTAMP), - new JoinCpuLoadBo("agent1", 33, 40, "agent1", 10, "agent1", 20, 78, "agent1", 12, "agent1", TIMESTAMP1), - new JoinCpuLoadBo("agent1", 55, 60, "agent1", 7, "agent1", 30, 39, "agent1", 30, "agent1", TIMESTAMP2), - new JoinCpuLoadBo("agent1", 11, 80, "agent1", 8, "agent1", 10, 50, "agent1", 14, "agent1", TIMESTAMP4), - new JoinCpuLoadBo("agent1", 22, 70, "agent1", 12, "agent1", 40, 99, "agent1", 50, "agent1", TIMESTAMP3) - ).forEach(builder::addCpuLoadBo); - - List.of( - new JoinMemoryBo("agent1", TIMESTAMP, 3000, 2000, 5000, "agent1", "agent1", 500, 50, 600, "agent1", "agent1"), - new JoinMemoryBo("agent1", TIMESTAMP1, 4000, 1000, 7000, "agent1", "agent1", 400, 150, 600, "agent1", "agent1"), - new JoinMemoryBo("agent1", TIMESTAMP2, 5000, 3000, 8000, "agent1", "agent1", 200, 100, 200, "agent1", "agent1"), - new JoinMemoryBo("agent1", TIMESTAMP4, 1000, 100, 3000, "agent1", "agent1", 100, 900, 1000, "agent1", "agent1"), - new JoinMemoryBo("agent1", TIMESTAMP3, 2000, 1000, 6000, "agent1", "agent1", 300, 100, 2900, "agent1", "agent1") - ).forEach(builder::addMemory); - - List.of( - new JoinTransactionBo("agent1", 5000, 150, 20, "agent1", 230, "agent1", TIMESTAMP), - new JoinTransactionBo("agent2", 5000, 300, 10, "agent2", 400, "agent1", TIMESTAMP1), - new JoinTransactionBo("agent3", 5000, 30, 5, "agent3", 100, "agent3", TIMESTAMP2), - new JoinTransactionBo("agent4", 5000, 30, 5, "agent4", 100, "agent4", TIMESTAMP4), - new JoinTransactionBo("agent5", 5000, 30, 5, "agent5", 100, "agent5", TIMESTAMP3) - ).forEach(builder::addTransaction); - - List.of( - new JoinActiveTraceBo("agent1", 1, (short) 2, 30, 15, "app_1_1", 40, "app_1_2", TIMESTAMP), - new JoinActiveTraceBo("agent1", 1, (short) 2, 30, 15, "app_1_1", 40, "app_1_2", TIMESTAMP1), - new JoinActiveTraceBo("agent1", 1, (short) 2, 30, 15, "app_1_1", 40, "app_1_2", TIMESTAMP2), - new JoinActiveTraceBo("agent1", 1, (short) 2, 30, 15, "app_1_1", 40, "app_1_2", TIMESTAMP4), - new JoinActiveTraceBo("agent1", 1, (short) 2, 30, 15, "app_1_1", 40, "app_1_2", TIMESTAMP3) - ).forEach(builder::addActiveTrace); - - List.of( - new JoinResponseTimeBo("agent1", TIMESTAMP, 3000, 2, "app_1_1", 6000, "app_1_2"), - new JoinResponseTimeBo("agent1", TIMESTAMP1, 4000, 200, "app_2_1", 9000, "app_2_2"), - new JoinResponseTimeBo("agent1", TIMESTAMP2, 2000, 20, "app_3_1", 7000, "app_3_2"), - new JoinResponseTimeBo("agent1", TIMESTAMP4, 5000, 20, "app_4_1", 8000, "app_4_2"), - new JoinResponseTimeBo("agent1", TIMESTAMP3, 1000, 10, "app_5_1", 6600, "app_5_2") - ).forEach(builder::addResponseTime); - - - List joinDataSourceBoList1 = List.of( - new JoinDataSourceBo((short) 1000, "jdbc:mysql", 300, 250, "agent_id_1", 600, "agent_id_6"), - new JoinDataSourceBo((short) 2000, "jdbc:mssql", 400, 350, "agent_id_1", 700, "agent_id_6") - ); - JoinDataSourceListBo joinDataSourceListBo1 = new JoinDataSourceListBo("agent1", joinDataSourceBoList1, TIMESTAMP); - - List joinDataSourceBoList2 = List.of( - new JoinDataSourceBo((short) 1000, "jdbc:mysql", 200, 50, "agent_id_2", 700, "agent_id_7"), - new JoinDataSourceBo((short) 2000, "jdbc:mssql", 300, 150, "agent_id_2", 800, "agent_id_7") - ); - JoinDataSourceListBo joinDataSourceListBo2 = new JoinDataSourceListBo("agent1", joinDataSourceBoList2, TIMESTAMP1); - - List joinDataSourceBoList3 = List.of( - new JoinDataSourceBo((short) 1000, "jdbc:mysql", 500, 150, "agent_id_3", 900, "agent_id_8"), - new JoinDataSourceBo((short) 2000, "jdbc:mssql", 600, 250, "agent_id_3", 1000, "agent_id_8") - ); - JoinDataSourceListBo joinDataSourceListBo3 = new JoinDataSourceListBo("agent1", joinDataSourceBoList3, TIMESTAMP2); - - List joinDataSourceBoList4 = List.of( - new JoinDataSourceBo((short) 1000, "jdbc:mysql", 400, 550, "agent_id_4", 600, "agent_id_9"), - new JoinDataSourceBo((short) 2000, "jdbc:mssql", 500, 650, "agent_id_4", 700, "agent_id_9") - ); - JoinDataSourceListBo joinDataSourceListBo4 = new JoinDataSourceListBo("agent1", joinDataSourceBoList4, TIMESTAMP4); - - List joinDataSourceBoList5 = List.of( - new JoinDataSourceBo((short) 1000, "jdbc:mysql", 100, 750, "agent_id_5", 800, "agent_id_10"), - new JoinDataSourceBo((short) 2000, "jdbc:mssql", 200, 850, "agent_id_5", 900, "agent_id_10") - ); - JoinDataSourceListBo joinDataSourceListBo5 = new JoinDataSourceListBo("agent1", joinDataSourceBoList5, TIMESTAMP3); - - List.of(joinDataSourceListBo1, joinDataSourceListBo2, joinDataSourceListBo3, joinDataSourceListBo4, joinDataSourceListBo5) - .forEach(builder::addDataSourceListBo); - - List.of( - new JoinFileDescriptorBo("agent1", 44, 70, "agent1", 30, "agent1", TIMESTAMP), - new JoinFileDescriptorBo("agent1", 33, 40, "agent1", 10, "agent1", TIMESTAMP1), - new JoinFileDescriptorBo("agent1", 55, 60, "agent1", 7, "agent1", TIMESTAMP2), - new JoinFileDescriptorBo("agent1", 11, 80, "agent1", 8, "agent1", TIMESTAMP4), - new JoinFileDescriptorBo("agent1", 22, 70, "agent1", 12, "agent1", TIMESTAMP3) - ).forEach(builder::addFileDescriptor); - - List.of( - new JoinDirectBufferBo("agent1", 44, 70, "agent1", 30, "agent1" - , 44, 70, "agent1", 30, "agent1" - , 44, 70, "agent1", 30, "agent1" - , 44, 70, "agent1", 30, "agent1" - , TIMESTAMP), - new JoinDirectBufferBo("agent1", 33, 40, "agent1", 10, "agent1" - , 33, 40, "agent1", 10, "agent1" - , 33, 40, "agent1", 10, "agent1" - , 33, 40, "agent1", 10, "agent1" - , TIMESTAMP1), - new JoinDirectBufferBo("agent1", 55, 60, "agent1", 7, "agent1" - , 55, 60, "agent1", 7, "agent1" - , 55, 60, "agent1", 7, "agent1" - , 55, 60, "agent1", 7, "agent1" - , TIMESTAMP2), - new JoinDirectBufferBo("agent1", 11, 80, "agent1", 8, "agent1" - , 11, 80, "agent1", 8, "agent1" - , 11, 80, "agent1", 8, "agent1" - , 11, 80, "agent1", 8, "agent1" - , TIMESTAMP4), - new JoinDirectBufferBo("agent1", 22, 70, "agent1", 12, "agent1" - , 22, 70, "agent1", 12, "agent1" - , 22, 70, "agent1", 12, "agent1" - , 22, 70, "agent1", 12, "agent1" - , TIMESTAMP3) - ).forEach(builder::addDirectBuffer); - - JoinAgentStatBo statBo = builder.build(); - List joinApplicationStatBoList = JoinApplicationStatBo.createJoinApplicationStatBo(APPLICATION_ID, statBo, 60000); - assertThat(joinApplicationStatBoList).hasSize(2); - for (JoinApplicationStatBo joinApplicationStatBo : joinApplicationStatBoList) { - assertEquals(joinApplicationStatBo.getId(), APPLICATION_ID); - if (joinApplicationStatBo.getTimestamp() == TIMESTAMP4) { - assertHasSize(joinApplicationStatBo, 2); - } else if (joinApplicationStatBo.getTimestamp() == 1498462500000L) { - assertHasSize(joinApplicationStatBo, 3); - } else { - fail(); - } - } - } - - private void assertHasSize(JoinApplicationStatBo joinApplicationStatBo, int expected) { - assertThat(joinApplicationStatBo.getJoinCpuLoadBoList()).hasSize(expected); - assertThat(joinApplicationStatBo.getJoinMemoryBoList()).hasSize(expected); - assertThat(joinApplicationStatBo.getJoinTransactionBoList()).hasSize(expected); - assertThat(joinApplicationStatBo.getJoinActiveTraceBoList()).hasSize(expected); - assertThat(joinApplicationStatBo.getJoinResponseTimeBoList()).hasSize(expected); - assertThat(joinApplicationStatBo.getJoinDataSourceListBoList()).hasSize(expected); - assertThat(joinApplicationStatBo.getJoinFileDescriptorBoList()).hasSize(expected); - assertThat(joinApplicationStatBo.getJoinDirectBufferBoList()).hasSize(expected); - } - - @Test - public void createJoinApplicationStatBo3Test() { - JoinAgentStatBo.Builder builder = JoinAgentStatBo.newBuilder("Agent", Long.MIN_VALUE, TIMESTAMP); - - List.of( - new JoinCpuLoadBo("agent1", 44, 70, "agent1", 30, "agent1", 50, 60, "agent1", 33, "agent1", TIMESTAMP), - new JoinCpuLoadBo("agent1", 33, 40, "agent1", 10, "agent1", 20, 78, "agent1", 12, "agent1", TIMESTAMP1), - new JoinCpuLoadBo("agent1", 55, 60, "agent1", 7, "agent1", 30, 39, "agent1", 30, "agent1", TIMESTAMP2), - new JoinCpuLoadBo("agent1", 11, 80, "agent1", 8, "agent1", 10, 50, "agent1", 14, "agent1", TIMESTAMP4), - new JoinCpuLoadBo("agent1", 22, 70, "agent1", 12, "agent1", 40, 99, "agent1", 50, "agent1", TIMESTAMP3) - ).forEach(builder::addCpuLoadBo); - - List.of( - new JoinMemoryBo("agent1", TIMESTAMP, 3000, 2000, 5000, "agent1", "agent1", 500, 50, 600, "agent1", "agent1"), - new JoinMemoryBo("agent1", TIMESTAMP1, 4000, 1000, 7000, "agent1", "agent1", 400, 150, 600, "agent1", "agent1"), - new JoinMemoryBo("agent1", TIMESTAMP2, 5000, 3000, 8000, "agent1", "agent1", 200, 100, 200, "agent1", "agent1"), - new JoinMemoryBo("agent1", TIMESTAMP4, 1000, 100, 3000, "agent1", "agent1", 100, 900, 1000, "agent1", "agent1"), - new JoinMemoryBo("agent1", TIMESTAMP3, 2000, 1000, 6000, "agent1", "agent1", 300, 100, 2900, "agent1", "agent1") - ).forEach(builder::addMemory); - - List.of( - new JoinTransactionBo("agent1", 5000, 150, 20, "agent1", 230, "agent1", TIMESTAMP), - new JoinTransactionBo("agent2", 5000, 300, 10, "agent2", 400, "agent2", TIMESTAMP1), - new JoinTransactionBo("agent3", 5000, 30, 5, "agent3", 100, "agent3", TIMESTAMP2), - new JoinTransactionBo("agent4", 5000, 30, 5, "agent4", 100, "agent4", TIMESTAMP4), - new JoinTransactionBo("agent5", 5000, 30, 5, "agent5", 100, "agent5", TIMESTAMP3) - ).forEach(builder::addTransaction); - - List.of( - new JoinActiveTraceBo("agent1", 1, (short) 2, 30, 15, "app_1_1", 40, "app_1_2", TIMESTAMP), - new JoinActiveTraceBo("agent1", 1, (short) 2, 30, 15, "app_1_1", 40, "app_1_2", TIMESTAMP1), - new JoinActiveTraceBo("agent1", 1, (short) 2, 30, 15, "app_1_1", 40, "app_1_2", TIMESTAMP2), - new JoinActiveTraceBo("agent1", 1, (short) 2, 30, 15, "app_1_1", 40, "app_1_2", TIMESTAMP4), - new JoinActiveTraceBo("agent1", 1, (short) 2, 30, 15, "app_1_1", 40, "app_1_2", TIMESTAMP3) - ).forEach(builder::addActiveTrace); - - List.of( - new JoinResponseTimeBo("agent1", TIMESTAMP, 3000, 2, "app_1_1", 6000, "app_1_2"), - new JoinResponseTimeBo("agent1", TIMESTAMP1, 4000, 200, "app_2_1", 9000, "app_2_2"), - new JoinResponseTimeBo("agent1", TIMESTAMP2, 2000, 20, "app_3_1", 7000, "app_3_2"), - new JoinResponseTimeBo("agent1", TIMESTAMP4, 5000, 20, "app_4_1", 8000, "app_4_2"), - new JoinResponseTimeBo("agent1", TIMESTAMP3, 1000, 10, "app_5_1", 6600, "app_5_2") - ).forEach(builder::addResponseTime); - - List joinDataSourceBoList1 = List.of( - new JoinDataSourceBo((short) 1000, "jdbc:mysql", 300, 250, "agent_id_1", 600, "agent_id_6"), - new JoinDataSourceBo((short) 2000, "jdbc:mssql", 400, 350, "agent_id_1", 700, "agent_id_6") - ); - JoinDataSourceListBo joinDataSourceListBo1 = new JoinDataSourceListBo("agent1", joinDataSourceBoList1, TIMESTAMP); - - List joinDataSourceBoList2 = List.of( - new JoinDataSourceBo((short) 1000, "jdbc:mysql", 200, 50, "agent_id_2", 700, "agent_id_7"), - new JoinDataSourceBo((short) 2000, "jdbc:mssql", 300, 150, "agent_id_2", 800, "agent_id_7") - ); - JoinDataSourceListBo joinDataSourceListBo2 = new JoinDataSourceListBo("agent1", joinDataSourceBoList2, TIMESTAMP1); - - List joinDataSourceBoList3 = List.of( - new JoinDataSourceBo((short) 1000, "jdbc:mysql", 500, 150, "agent_id_3", 900, "agent_id_8"), - new JoinDataSourceBo((short) 2000, "jdbc:mssql", 600, 250, "agent_id_3", 1000, "agent_id_8") - ); - JoinDataSourceListBo joinDataSourceListBo3 = new JoinDataSourceListBo("agent1", joinDataSourceBoList3, TIMESTAMP2); - - List joinDataSourceBoList4 = List.of( - new JoinDataSourceBo((short) 1000, "jdbc:mysql", 400, 550, "agent_id_4", 600, "agent_id_9"), - new JoinDataSourceBo((short) 2000, "jdbc:mssql", 500, 650, "agent_id_4", 700, "agent_id_9") - ); - JoinDataSourceListBo joinDataSourceListBo4 = new JoinDataSourceListBo("agent1", joinDataSourceBoList4, TIMESTAMP4); - - List joinDataSourceBoList5 = List.of( - new JoinDataSourceBo((short) 1000, "jdbc:mysql", 100, 750, "agent_id_5", 800, "agent_id_10"), - new JoinDataSourceBo((short) 2000, "jdbc:mssql", 200, 850, "agent_id_5", 900, "agent_id_10") - ); - JoinDataSourceListBo joinDataSourceListBo5 = new JoinDataSourceListBo("agent1", joinDataSourceBoList5, TIMESTAMP3); - - List.of(joinDataSourceListBo1, joinDataSourceListBo2, joinDataSourceListBo3, joinDataSourceListBo4, joinDataSourceListBo5) - .forEach(builder::addDataSourceListBo); - - List.of( - new JoinFileDescriptorBo("agent1", 44, 70, "agent1", 30, "agent1", TIMESTAMP), - new JoinFileDescriptorBo("agent1", 33, 40, "agent1", 10, "agent1", TIMESTAMP1), - new JoinFileDescriptorBo("agent1", 55, 60, "agent1", 7, "agent1", TIMESTAMP2), - new JoinFileDescriptorBo("agent1", 11, 80, "agent1", 8, "agent1", TIMESTAMP4), - new JoinFileDescriptorBo("agent1", 22, 70, "agent1", 12, "agent1", TIMESTAMP3) - ).forEach(builder::addFileDescriptor); - - List.of( - new JoinDirectBufferBo("agent1", 44, 70, "agent1", 30, "agent1" - , 44, 70, "agent1", 30, "agent1" - , 44, 70, "agent1", 30, "agent1" - , 44, 70, "agent1", 30, "agent1" - , TIMESTAMP), - new JoinDirectBufferBo("agent1", 33, 40, "agent1", 10, "agent1" - , 33, 40, "agent1", 10, "agent1" - , 33, 40, "agent1", 10, "agent1" - , 33, 40, "agent1", 10, "agent1" - , TIMESTAMP1), - new JoinDirectBufferBo("agent1", 55, 60, "agent1", 7, "agent1" - , 55, 60, "agent1", 7, "agent1" - , 55, 60, "agent1", 7, "agent1" - , 55, 60, "agent1", 7, "agent1" - , TIMESTAMP2), - new JoinDirectBufferBo("agent1", 11, 80, "agent1", 8, "agent1" - , 11, 80, "agent1", 8, "agent1" - , 11, 80, "agent1", 8, "agent1" - , 11, 80, "agent1", 8, "agent1" - , TIMESTAMP4), - new JoinDirectBufferBo("agent1", 22, 70, "agent1", 12, "agent1" - , 22, 70, "agent1", 12, "agent1" - , 22, 70, "agent1", 12, "agent1" - , 22, 70, "agent1", 12, "agent1" - , TIMESTAMP3) - ).forEach(builder::addDirectBuffer); - - List joinApplicationStatBoList = JoinApplicationStatBo.createJoinApplicationStatBo(APPLICATION_ID, builder.build(), 10000); - assertThat(joinApplicationStatBoList).hasSize(3); - for (JoinApplicationStatBo joinApplicationStatBo : joinApplicationStatBoList) { - assertEquals(joinApplicationStatBo.getId(), APPLICATION_ID); - if (joinApplicationStatBo.getTimestamp() == TIMESTAMP4) { - assertHasSize(joinApplicationStatBo, 2); - } else if (joinApplicationStatBo.getTimestamp() == 1498462540000L) { - assertHasSize(joinApplicationStatBo, 1); - } else if (joinApplicationStatBo.getTimestamp() == TIMESTAMP1) { - assertHasSize(joinApplicationStatBo, 2); - } else { - fail(); - } - } - } - -} - - diff --git a/commons-server/src/test/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinCpuLoadBoTest.java b/commons-server/src/test/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinCpuLoadBoTest.java deleted file mode 100644 index db7c175cf55d..000000000000 --- a/commons-server/src/test/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinCpuLoadBoTest.java +++ /dev/null @@ -1,51 +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.common.server.bo.stat.join; - -import org.junit.jupiter.api.Test; - -import java.util.List; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * @author minwoo.jung - */ -public class JoinCpuLoadBoTest { - @Test - public void joinCpuLoadBoList() { - List joinCpuLoadBoList = List.of( - new JoinCpuLoadBo("agent1", 44, 70, "agent1", 30, "agent1", 50, 60, "agent1", 33, "agent1", 1496988667231L), - new JoinCpuLoadBo("agent2", 33, 40, "agent2", 10, "agent2", 20, 78, "agent2", 12, "agent2", 1496988667231L), - new JoinCpuLoadBo("agent3", 55, 60, "agent3", 7, "agent3", 30, 39, "agent3", 30, "agent3", 1496988667231L), - new JoinCpuLoadBo("agent4", 11, 80, "agent4", 8, "agent4", 10, 50, "agent4", 14, "agent4", 1496988667231L), - new JoinCpuLoadBo("agent5", 22, 70, "agent5", 12, "agent5", 40, 99, "agent5", 50, "agent5", 1496988667231L) - ); - - JoinCpuLoadBo joinCpuLoadBo = JoinCpuLoadBo.joinCpuLoadBoList(joinCpuLoadBoList, 1496988667231L); - assertEquals(joinCpuLoadBo.getId(), "agent1"); - assertEquals(joinCpuLoadBo.getTimestamp(), 1496988667231L); - assertEquals(joinCpuLoadBo.getJvmCpuLoadJoinValue(), new JoinDoubleFieldBo((double) 33, (double) 7, "agent3", (double) 80, "agent4")); - assertEquals(joinCpuLoadBo.getSystemCpuLoadJoinValue(), new JoinDoubleFieldBo((double) 30, (double) 12, "agent2", (double) 99, "agent5")); - } - - @Test - public void joinCpuLoadBo2List() { - JoinCpuLoadBo joinCpuLoadBo = JoinCpuLoadBo.joinCpuLoadBoList(List.of(), 1496988667231L); - assertEquals(joinCpuLoadBo, JoinCpuLoadBo.EMPTY_JOIN_CPU_LOAD_BO); - } -} \ No newline at end of file diff --git a/commons-server/src/test/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinDataSourceBoTest.java b/commons-server/src/test/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinDataSourceBoTest.java deleted file mode 100644 index 8228e6a94332..000000000000 --- a/commons-server/src/test/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinDataSourceBoTest.java +++ /dev/null @@ -1,55 +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.common.server.bo.stat.join; - -import org.junit.jupiter.api.Test; - -import java.util.List; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * @author minwoo.jung - */ -public class JoinDataSourceBoTest { - - @Test - public void joinDataSourceBoListTest() { - - List joinDataSourceBoList = List.of( - new JoinDataSourceBo((short) 1000, "jdbc:mysql", 30, 25, "agent_id_1", 60, "agent_id_6"), - new JoinDataSourceBo((short) 1000, "jdbc:mysql", 20, 5, "agent_id_2", 30, "agent_id_7"), - new JoinDataSourceBo((short) 1000, "jdbc:mysql", 10, 25, "agent_id_3", 50, "agent_id_8"), - new JoinDataSourceBo((short) 1000, "jdbc:mysql", 40, 4, "agent_id_4", 70, "agent_id_9"), - new JoinDataSourceBo((short) 1000, "jdbc:mysql", 50, 25, "agent_id_5", 80, "agent_id_10") - ); - - JoinDataSourceBo joinDataSourceBo = JoinDataSourceBo.joinDataSourceBoList(joinDataSourceBoList); - - assertEquals(joinDataSourceBo.getServiceTypeCode(), 1000); - assertEquals(joinDataSourceBo.getUrl(), "jdbc:mysql"); - assertEquals(new JoinIntFieldBo(30, 4, "agent_id_4", 80, "agent_id_10"), joinDataSourceBo.getActiveConnectionSizeJoinValue()); - } - - @Test - public void joinDataSourceBoList2Test() { - JoinDataSourceBo joinDataSourceBo = JoinDataSourceBo.joinDataSourceBoList(List.of()); - - assertEquals(joinDataSourceBo, JoinDataSourceBo.EMPTY_JOIN_DATA_SOURCE_BO); - } - -} \ No newline at end of file diff --git a/commons-server/src/test/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinDataSourceListBoTest.java b/commons-server/src/test/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinDataSourceListBoTest.java deleted file mode 100644 index e86f123eea52..000000000000 --- a/commons-server/src/test/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinDataSourceListBoTest.java +++ /dev/null @@ -1,105 +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.common.server.bo.stat.join; - -import org.junit.jupiter.api.Test; - -import java.util.ArrayList; -import java.util.Comparator; -import java.util.List; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * @author minwoo.jung - */ -public class JoinDataSourceListBoTest { - - @Test - public void joinDataSourceListBoListTest() { - final String id = "test_app"; - final long currentTime = System.currentTimeMillis(); - final List joinDataSourceListBoList = createJoinDataSourceListBoList(id, currentTime); - final JoinDataSourceListBo joinDataSourceListBo = JoinDataSourceListBo.joinDataSourceListBoList(joinDataSourceListBoList, currentTime); - - assertEquals(joinDataSourceListBo.getId(), id); - assertEquals(joinDataSourceListBo.getTimestamp(), currentTime); - List joinDataSourceBoList = joinDataSourceListBo.getJoinDataSourceBoList(); - joinDataSourceBoList.sort(Comparator.comparingInt(JoinDataSourceBo::getServiceTypeCode)); - - assertThat(joinDataSourceBoList).hasSize(5); - - JoinDataSourceBo joinDataSourceBo1 = joinDataSourceBoList.get(0); - assertEquals(joinDataSourceBo1.getServiceTypeCode(), 1000); - assertEquals(joinDataSourceBo1.getUrl(), "jdbc:mysql"); - assertEquals(new JoinIntFieldBo(60, 35, "agent_id_1_10", 110, "agent_id_6_50"), joinDataSourceBo1.getActiveConnectionSizeJoinValue()); - - JoinDataSourceBo joinDataSourceBo2 = joinDataSourceBoList.get(1); - assertEquals(joinDataSourceBo2.getServiceTypeCode(), 2000); - assertEquals(joinDataSourceBo2.getUrl(), "jdbc:mssql"); - assertEquals(new JoinIntFieldBo(50, 15, "agent_id_2_10", 80, "agent_id_7_50"), joinDataSourceBo2.getActiveConnectionSizeJoinValue()); - - JoinDataSourceBo joinDataSourceBo3 = joinDataSourceBoList.get(2); - assertEquals(joinDataSourceBo3.getServiceTypeCode(), 3000); - assertEquals(joinDataSourceBo3.getUrl(), "jdbc:postgre"); - assertEquals(new JoinIntFieldBo(40, 35, "agent_id_3_10", 100, "agent_id_8_50"), joinDataSourceBo3.getActiveConnectionSizeJoinValue()); - - JoinDataSourceBo joinDataSourceBo4 = joinDataSourceBoList.get(3); - assertEquals(joinDataSourceBo4.getServiceTypeCode(), 4000); - assertEquals(joinDataSourceBo4.getUrl(), "jdbc:oracle"); - assertEquals(new JoinIntFieldBo(70, 20, "agent_id_4_10", 120, "agent_id_9_50"), joinDataSourceBo4.getActiveConnectionSizeJoinValue()); - - JoinDataSourceBo joinDataSourceBo5 = joinDataSourceBoList.get(4); - assertEquals(joinDataSourceBo5.getServiceTypeCode(), 5000); - assertEquals(joinDataSourceBo5.getUrl(), "jdbc:cubrid"); - assertEquals(new JoinIntFieldBo(80, 35, "agent_id_5_10", 130, "agent_id_10_50"), joinDataSourceBo5.getActiveConnectionSizeJoinValue()); - } - - @Test - public void joinDataSourceListBoList2Test() { - final String id = "test_app"; - final long currentTime = System.currentTimeMillis(); - final List joinDataSourceListBoList = new ArrayList<>(0); - final JoinDataSourceListBo joinDataSourceListBo = JoinDataSourceListBo.joinDataSourceListBoList(joinDataSourceListBoList, currentTime); - assertEquals(joinDataSourceListBo, JoinDataSourceListBo.EMPTY_JOIN_DATA_SOURCE_LIST_BO); - } - - - private List createJoinDataSourceListBoList(String id, long currentTime) { - return List.of( - new JoinDataSourceListBo(id, createJoinDataSourceBoList(10), currentTime), - new JoinDataSourceListBo(id, createJoinDataSourceBoList(20), currentTime), - new JoinDataSourceListBo(id, createJoinDataSourceBoList(30), currentTime), - new JoinDataSourceListBo(id, createJoinDataSourceBoList(40), currentTime), - new JoinDataSourceListBo(id, createJoinDataSourceBoList(50), currentTime) - ); - } - - private List createJoinDataSourceBoList(int plus) { - return List.of( - new JoinDataSourceBo((short) 1000, "jdbc:mysql", 30 + plus, 25 + plus, "agent_id_1_" + plus, 60 + plus, "agent_id_6_" + plus), - new JoinDataSourceBo((short) 2000, "jdbc:mssql", 20 + plus, 5 + plus, "agent_id_2_" + plus, 30 + plus, "agent_id_7_" + plus), - new JoinDataSourceBo((short) 3000, "jdbc:postgre", 10 + plus, 25 + plus, "agent_id_3_" + plus, 50 + plus, "agent_id_8_" + plus), - new JoinDataSourceBo((short) 4000, "jdbc:oracle", 40 + plus, 10 + plus, "agent_id_4_" + plus, 70 + plus, "agent_id_9_" + plus), - new JoinDataSourceBo((short) 5000, "jdbc:cubrid", 50 + plus, 25 + plus, "agent_id_5_" + plus, 80 + plus, "agent_id_10_" + plus) - ); - - } - - -} \ No newline at end of file diff --git a/commons-server/src/test/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinDirectBufferBoTest.java b/commons-server/src/test/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinDirectBufferBoTest.java deleted file mode 100644 index e2bb7d3bb188..000000000000 --- a/commons-server/src/test/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinDirectBufferBoTest.java +++ /dev/null @@ -1,75 +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.common.server.bo.stat.join; - -import org.junit.jupiter.api.Test; - -import java.util.List; - -import static org.junit.jupiter.api.Assertions.assertEquals; - - -/** - * @author minwoo.jung - */ -public class JoinDirectBufferBoTest { - @Test - public void joinDirectBufferBoList() { - List joinDirectBufferBoList = List.of( - new JoinDirectBufferBo("agent1", 33, 70, "agent1", 30, "agent1" - , 33, 70, "agent1", 30, "agent1" - , 33, 70, "agent1", 30, "agent1" - , 33, 70, "agent1", 30, "agent1" - , 1496988667231L), - new JoinDirectBufferBo("agent2", 33, 40, "agent2", 10, "agent2" - , 33, 40, "agent2", 10, "agent2" - , 33, 40, "agent2", 10, "agent2" - , 33, 40, "agent2", 10, "agent2" - , 1496988667231L), - new JoinDirectBufferBo("agent3", 54, 60, "agent3", 7, "agent3" - , 54, 60, "agent3", 7, "agent3" - , 54, 60, "agent3", 7, "agent3" - , 54, 60, "agent3", 7, "agent3" - , 1496988667231L), - new JoinDirectBufferBo("agent4", 11, 80, "agent4", 8, "agent4" - , 11, 80, "agent4", 8, "agent4" - , 11, 80, "agent4", 8, "agent4" - , 11, 80, "agent4", 8, "agent4" - , 1496988667231L), - new JoinDirectBufferBo("agent5", 22, 70, "agent5", 12, "agent5" - , 22, 70, "agent5", 12, "agent5" - , 22, 70, "agent5", 12, "agent5" - , 22, 70, "agent5", 12, "agent5" - , 1496988667231L) - ); - - - JoinDirectBufferBo joinDirectBufferBo = JoinDirectBufferBo.joinDirectBufferBoList(joinDirectBufferBoList, 1496988667231L); - assertEquals(joinDirectBufferBo.getId(), "agent1"); - assertEquals(joinDirectBufferBo.getTimestamp(), 1496988667231L); - assertEquals(joinDirectBufferBo.getDirectCountJoinValue(), new JoinLongFieldBo(30L, 7L, "agent3", 80L, "agent4")); - assertEquals(joinDirectBufferBo.getDirectMemoryUsedJoinValue(), new JoinLongFieldBo(30L, 7L, "agent3", 80L, "agent4")); - assertEquals(joinDirectBufferBo.getMappedCountJoinValue(), new JoinLongFieldBo(30L, 7L, "agent3", 80L, "agent4")); - assertEquals(joinDirectBufferBo.getMappedMemoryUsedJoinValue(), new JoinLongFieldBo(30L, 7L, "agent3", 80L, "agent4")); - } - - @Test - public void joinDirectBufferBo2List() { - JoinDirectBufferBo joinDirectBufferBo = JoinDirectBufferBo.joinDirectBufferBoList(List.of(), 1496988667231L); - assertEquals(joinDirectBufferBo, JoinDirectBufferBo.EMPTY_JOIN_DIRECT_BUFFER_BO); - } -} \ No newline at end of file diff --git a/commons-server/src/test/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinFileDescriptorBoTest.java b/commons-server/src/test/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinFileDescriptorBoTest.java deleted file mode 100644 index f248600da869..000000000000 --- a/commons-server/src/test/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinFileDescriptorBoTest.java +++ /dev/null @@ -1,50 +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.common.server.bo.stat.join; - -import org.junit.jupiter.api.Test; - -import java.util.List; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * @author minwoo.jung - */ -public class JoinFileDescriptorBoTest { - @Test - public void joinFileDescriptorBoList() { - List joinFileDescriptorBoList = List.of( - new JoinFileDescriptorBo("agent1", 33, 70, "agent1", 30, "agent1", 1496988667231L), - new JoinFileDescriptorBo("agent2", 33, 40, "agent2", 10, "agent2", 1496988667231L), - new JoinFileDescriptorBo("agent3", 54, 60, "agent3", 7, "agent3", 1496988667231L), - new JoinFileDescriptorBo("agent4", 11, 80, "agent4", 8, "agent4", 1496988667231L), - new JoinFileDescriptorBo("agent5", 22, 70, "agent5", 12, "agent5", 1496988667231L) - ); - - JoinFileDescriptorBo joinFileDescriptorBo = JoinFileDescriptorBo.joinFileDescriptorBoList(joinFileDescriptorBoList, 1496988667231L); - assertEquals(joinFileDescriptorBo.getId(), "agent1"); - assertEquals(joinFileDescriptorBo.getTimestamp(), 1496988667231L); - assertEquals(new JoinLongFieldBo(30L, 7L, "agent3", 80L, "agent4"), joinFileDescriptorBo.getOpenFdCountJoinValue()); - } - - @Test - public void joinFileDescriptorBo2List() { - JoinFileDescriptorBo joinFileDescriptorBo = JoinFileDescriptorBo.joinFileDescriptorBoList(List.of(), 1496988667231L); - assertEquals(joinFileDescriptorBo, JoinFileDescriptorBo.EMPTY_JOIN_FILE_DESCRIPTOR_BO); - } -} \ No newline at end of file diff --git a/commons-server/src/test/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinLoadedClassBoTest.java b/commons-server/src/test/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinLoadedClassBoTest.java deleted file mode 100644 index b309a37f8e87..000000000000 --- a/commons-server/src/test/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinLoadedClassBoTest.java +++ /dev/null @@ -1,48 +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.common.server.bo.stat.join; - -import org.junit.jupiter.api.Test; - -import java.util.List; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -public class JoinLoadedClassBoTest { - @Test - public void joinLoadedClassBoListTest() { - List joinLoadedClassBoList = List.of( - new JoinLoadedClassBo("agent1", 35, 10, "agent1", 67, "agent1", 35, 10, "agent1", 67, "agent1", 1496988667231L), - new JoinLoadedClassBo("agent2", 39, 2, "agent2", 164, "agent2", 39, 2, "agent2", 164, "agent2", 1496988667231L), - new JoinLoadedClassBo("agent3", 52, 1, "agent3", 236, "agent3", 52, 1, "agent3", 236, "agent3", 1496988667231L), - new JoinLoadedClassBo("agent4", 1, 0, "agent4", 2, "agent4", 1, 0, "agent4", 2, "agent4", 1496988667231L), - new JoinLoadedClassBo("agent5", 3, 4, "agent5", 5, "agent5", 3, 4, "agent5", 5, "agent5", 1496988667231L) - ); - - JoinLoadedClassBo joinLoadedClassBo = JoinLoadedClassBo.joinLoadedClassBoList(joinLoadedClassBoList, 1496988668231L); - assertEquals("agent1", joinLoadedClassBo.getId()); - assertEquals(1496988668231L, joinLoadedClassBo.getTimestamp()); - assertEquals(new JoinLongFieldBo(26L, 2L, "agent4", 10L, "agent1"), joinLoadedClassBo.getLoadedClassJoinValue()); - assertEquals(new JoinLongFieldBo(26L, 2L, "agent4", 10L, "agent1"), joinLoadedClassBo.getUnloadedClassJoinValue()); - } - - @Test - public void joinLoadedClassBoList2Test() { - JoinLoadedClassBo joinLoadedClassBo = JoinLoadedClassBo.joinLoadedClassBoList(List.of(), 1496988668231L); - assertEquals(joinLoadedClassBo, JoinLoadedClassBo.EMPTY_JOIN_LOADED_CLASS_BO); - } -} diff --git a/commons-server/src/test/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinMemoryBoTest.java b/commons-server/src/test/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinMemoryBoTest.java deleted file mode 100644 index 5e1166e94d94..000000000000 --- a/commons-server/src/test/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinMemoryBoTest.java +++ /dev/null @@ -1,53 +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.common.server.bo.stat.join; - -import org.junit.jupiter.api.Test; - -import java.util.List; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * @author minwoo.jung - */ -public class JoinMemoryBoTest { - @Test - public void joinMemoryBoListTest() { - List joinMemoryBoList = List.of( - new JoinMemoryBo("agent1", 1496988667231L, 3000, 2000, 5000, "agent1", "agent1", 500, 50, 600, "agent1", "agent1"), - new JoinMemoryBo("agent2", 1496988667231L, 4000, 1000, 7000, "agent2", "agent2", 400, 150, 600, "agent2", "agent2"), - new JoinMemoryBo("agent3", 1496988667231L, 5000, 3000, 8000, "agent3", "agent3", 200, 100, 200, "agent3", "agent3"), - new JoinMemoryBo("agent4", 1496988667231L, 1000, 100, 3000, "agent4", "agent4", 100, 900, 1000, "agent4", "agent4"), - new JoinMemoryBo("agent5", 1496988667231L, 2000, 1000, 6000, "agent5", "agent5", 300, 100, 2900, "agent5", "agent5") - ); - - JoinMemoryBo joinMemoryBo = JoinMemoryBo.joinMemoryBoList(joinMemoryBoList, 1496988667231L); - assertEquals("agent1", joinMemoryBo.getId()); - assertEquals(1496988667231L, joinMemoryBo.getTimestamp()); - - assertEquals(joinMemoryBo.getHeapUsedJoinValue(), new JoinLongFieldBo(3000L, 100L, "agent4", 8000L, "agent3")); - assertEquals(joinMemoryBo.getNonHeapUsedJoinValue(), new JoinLongFieldBo(300L, 50L, "agent1", 2900L, "agent5")); - } - - @Test - public void joinMemoryBoList2Test() { - JoinMemoryBo joinMemoryBo = JoinMemoryBo.joinMemoryBoList(List.of(), 1496988667231L); - assertEquals(joinMemoryBo, JoinMemoryBo.EMPTY_JOIN_MEMORY_BO); - } - -} \ No newline at end of file diff --git a/commons-server/src/test/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinResponseTimeBoTest.java b/commons-server/src/test/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinResponseTimeBoTest.java deleted file mode 100644 index c80958e11fcd..000000000000 --- a/commons-server/src/test/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinResponseTimeBoTest.java +++ /dev/null @@ -1,53 +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.common.server.bo.stat.join; - -import org.junit.jupiter.api.Test; - -import java.util.List; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * @author minwoo.jung - */ -public class JoinResponseTimeBoTest { - - @Test - public void joinResponseTimeBoListTest() { - long time = 1496988667231L; - List joinResponseTimeBoList = List.of( - new JoinResponseTimeBo("agent1", time, 3000, 2, "agent1", 6000, "agent1"), - new JoinResponseTimeBo("agent2", time, 4000, 200, "agent2", 9000, "agent2"), - new JoinResponseTimeBo("agent3", time, 2000, 20, "agent3", 7000, "agent3"), - new JoinResponseTimeBo("agent4", time, 5000, 20, "agent4", 8000, "agent4"), - new JoinResponseTimeBo("agent5", time, 1000, 10, "agent5", 6600, "agent5") - ); - - JoinResponseTimeBo joinResponseTimeBo = JoinResponseTimeBo.joinResponseTimeBoList(joinResponseTimeBoList, time); - assertEquals("agent1", joinResponseTimeBo.getId()); - assertEquals(time, joinResponseTimeBo.getTimestamp()); - assertEquals(new JoinLongFieldBo(3000L, 2L, "agent1", 9000L, "agent2"), joinResponseTimeBo.getResponseTimeJoinValue()); - } - - @Test - public void joinResponseTimeBoList2Test() { - JoinResponseTimeBo joinResponseTimeBo = JoinResponseTimeBo.joinResponseTimeBoList(List.of(), 1496988667231L); - assertEquals(joinResponseTimeBo, JoinResponseTimeBo.EMPTY_JOIN_RESPONSE_TIME_BO); - } - -} \ No newline at end of file diff --git a/commons-server/src/test/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinTotalThreadCountBoTest.java b/commons-server/src/test/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinTotalThreadCountBoTest.java deleted file mode 100644 index 9fdb7430be22..000000000000 --- a/commons-server/src/test/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinTotalThreadCountBoTest.java +++ /dev/null @@ -1,47 +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.common.server.bo.stat.join; - -import org.junit.jupiter.api.Test; - -import java.util.List; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -public class JoinTotalThreadCountBoTest { - @Test - public void joinTotalThreadCountBoList() { - List joinTotalThreadCountBoList = List.of( - new JoinTotalThreadCountBo("agent1", 1496988667231L, 35, 10, "agent1", 67, "agent1"), - new JoinTotalThreadCountBo("agent2", 1496988667231L, 39, 2, "agent2", 164, "agent2"), - new JoinTotalThreadCountBo("agent3", 1496988667231L, 52, 1, "agent3", 236, "agent3"), - new JoinTotalThreadCountBo("agent4", 1496988667231L, 1, 0, "agent4", 2, "agent4"), - new JoinTotalThreadCountBo("agent5", 1496988667231L, 3, 4, "agent5", 5, "agent5") - ); - - JoinTotalThreadCountBo joinTotalThreadCountBo = JoinTotalThreadCountBo.joinTotalThreadCountBoList(joinTotalThreadCountBoList, 1496988668231L); - assertEquals("agent1", joinTotalThreadCountBo.getId()); - assertEquals(1496988668231L, joinTotalThreadCountBo.getTimestamp()); - assertEquals(new JoinLongFieldBo(26L, 0L, "agent4", 236L, "agent3"), joinTotalThreadCountBo.getTotalThreadCountJoinValue()); - } - - @Test - public void joinTotalThreadCountBoList2Test() { - JoinTotalThreadCountBo joinTotalThreadCountBo = JoinTotalThreadCountBo.joinTotalThreadCountBoList(List.of(), 1496988668231L); - assertEquals(joinTotalThreadCountBo, JoinTotalThreadCountBo.EMPTY_TOTAL_THREAD_COUNT_BO); - } -} diff --git a/commons-server/src/test/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinTransactionBoTest.java b/commons-server/src/test/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinTransactionBoTest.java deleted file mode 100644 index 8f54bb09352c..000000000000 --- a/commons-server/src/test/java/com/navercorp/pinpoint/common/server/bo/stat/join/JoinTransactionBoTest.java +++ /dev/null @@ -1,52 +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.common.server.bo.stat.join; - -import org.junit.jupiter.api.Test; - -import java.util.List; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * @author minwoo.jung - */ -public class JoinTransactionBoTest { - - @Test - public void joinTransactionBoListTest() { - List joinTransactionBoList = List.of( - new JoinTransactionBo("agent1", 5000, 150, 12, "agent1", 230, "agent1", 1496988667231L), - new JoinTransactionBo("agent2", 5000, 110, 40, "agent2", 240, "agent2", 1496988667231L), - new JoinTransactionBo("agent3", 5000, 120, 50, "agent3", 130, "agent3", 1496988667231L), - new JoinTransactionBo("agent4", 5000, 130, 60, "agent4", 630, "agent4", 1496988667231L), - new JoinTransactionBo("agent5", 5000, 140, 11, "agent5", 230, "agent5", 1496988667231L) - ); - - JoinTransactionBo joinTransactionBo = JoinTransactionBo.joinTransactionBoList(joinTransactionBoList, 1496988667231L); - assertEquals("agent1", joinTransactionBo.getId()); - assertEquals(1496988667231L, joinTransactionBo.getTimestamp()); - assertEquals(5000, joinTransactionBo.getCollectInterval()); - assertEquals(new JoinLongFieldBo(130L, 11L, "agent5", 630L, "agent4"), joinTransactionBo.getTotalCountJoinValue()); - } - - @Test - public void joinTransactionBoList2Test() { - JoinTransactionBo joinTransactionBo = JoinTransactionBo.joinTransactionBoList(List.of(), 1496988667231L); - assertEquals(joinTransactionBo, JoinTransactionBo.EMPTY_JOIN_TRANSACTION_BO); - } -} \ No newline at end of file diff --git a/flink/pom.xml b/flink/pom.xml index 799a45a4dc88..1c80378e844d 100644 --- a/flink/pom.xml +++ b/flink/pom.xml @@ -1,12 +1,12 @@ - - org.slf4j - slf4j-api - - - org.apache.logging.log4j - log4j-slf4j2-impl - test - - - org.apache.logging.log4j - log4j-core - test - - - org.apache.logging.log4j - log4j-api - - - - - io.dropwizard.metrics - metrics-core - - - io.dropwizard.metrics - metrics-jvm - - - io.dropwizard.metrics - metrics-servlets - - - org.springframework - spring-test - test - - - org.apache.maven.plugins - maven-shade-plugin - ${plugin.shade.version} - - - build-first - package - - shade - - - true - job - - - META-INF/spring.handlers - - - META-INF/spring.schemas - - - com.navercorp.pinpoint.flink.StatStreamingVer2Job - - - - - com.navercorp.pinpoint:pinpoint-web - - META-INF/resources/**/* - - - - pinpoint-flink-job-${project.version} - - - - - - com.spotify - docker-maven-plugin - 1.2.2 - - ${docker.repository.name}/pinpoint-flink - ${basedir} - - ${project.version} - latest - - - \ No newline at end of file diff --git a/flink/src/main/java/com/navercorp/pinpoint/flink/Bootstrap.java b/flink/src/main/java/com/navercorp/pinpoint/flink/Bootstrap.java deleted file mode 100644 index 21aba5664b2d..000000000000 --- a/flink/src/main/java/com/navercorp/pinpoint/flink/Bootstrap.java +++ /dev/null @@ -1,201 +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.flink; - -import com.navercorp.pinpoint.collector.receiver.thrift.TCPReceiverBean; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinStatBo; -import com.navercorp.pinpoint.common.util.IOUtils; -import com.navercorp.pinpoint.flink.cluster.FlinkServerRegister; -import com.navercorp.pinpoint.flink.config.FlinkProperties; -import com.navercorp.pinpoint.flink.dao.hbase.ApplicationMetricDao; -import com.navercorp.pinpoint.flink.dao.hbase.StatisticsDao; -import com.navercorp.pinpoint.flink.dao.hbase.StatisticsDaoInterceptor; -import com.navercorp.pinpoint.flink.function.ApplicationStatBoWindowInterceptor; -import com.navercorp.pinpoint.flink.process.ApplicationCache; -import com.navercorp.pinpoint.flink.process.TBaseFlatMapper; -import com.navercorp.pinpoint.flink.process.TBaseFlatMapperInterceptor; -import com.navercorp.pinpoint.flink.receiver.AgentStatHandler; -import com.navercorp.pinpoint.flink.receiver.TcpDispatchHandler; -import com.navercorp.pinpoint.flink.receiver.TcpSourceFunction; -import com.navercorp.pinpoint.flink.vo.RawData; -import org.apache.flink.streaming.api.environment.LocalStreamEnvironment; -import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment; -import org.apache.flink.streaming.api.functions.source.SourceFunction.SourceContext; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; -import org.springframework.context.ApplicationContext; -import org.springframework.context.annotation.AnnotationConfigApplicationContext; - -import java.io.Closeable; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -/** - * @author minwoo.jung - */ -public class Bootstrap { - private static final Logger logger = LogManager.getLogger(Bootstrap.class); - private static final String SPRING_PROFILE = "spring.profiles.active"; - private static final String PINPOINT_PROFILE = "pinpoint.profiles.active"; - - private volatile static Bootstrap instance; - - private final StatisticsDao statisticsDao; - - private final ApplicationContext applicationContext; - - private final TBaseFlatMapper tbaseFlatMapper; - private final FlinkProperties flinkProperties; - private final TcpDispatchHandler tcpDispatchHandler; - private final TcpSourceFunction tcpSourceFunction; - private final ApplicationCache applicationCache; - - private final List> applicationMetricDaoList; - - private final TBaseFlatMapperInterceptor tBaseFlatMapperInterceptor; - private final StatisticsDaoInterceptor statisticsDaoInterceptor; - private final ApplicationStatBoWindowInterceptor applicationStatBoWindowInterceptor; - private final AgentStatHandler agentStatHandler; - - private Bootstrap() { - applicationContext = new AnnotationConfigApplicationContext(FlinkModule.class); - - tbaseFlatMapper = applicationContext.getBean("tbaseFlatMapper", TBaseFlatMapper.class); - flinkProperties = applicationContext.getBean("flinkProperties", FlinkProperties.class); - tcpDispatchHandler = applicationContext.getBean("tcpDispatchHandler", TcpDispatchHandler.class); - tcpSourceFunction = applicationContext.getBean("tcpSourceFunction", TcpSourceFunction.class); - applicationCache = applicationContext.getBean("applicationCache", ApplicationCache.class); - statisticsDao = applicationContext.getBean("statisticsDao", StatisticsDao.class); - - this.applicationMetricDaoList = getApplicationMetricDao(); - - tBaseFlatMapperInterceptor = applicationContext.getBean("tBaseFlatMapperInterceptor", TBaseFlatMapperInterceptor.class); - statisticsDaoInterceptor = applicationContext.getBean("statisticsDaoInterceptor", StatisticsDaoInterceptor.class); - applicationStatBoWindowInterceptor = applicationContext.getBean("applicationStatBoWindowInterceptor", ApplicationStatBoWindowInterceptor.class); - agentStatHandler = applicationContext.getBean("agentStatHandler", AgentStatHandler.class); - } - - @SuppressWarnings("unchecked") - private List> getApplicationMetricDao() { - Map metricDaoMap = applicationContext.getBeansOfType(ApplicationMetricDao.class); - - metricDaoMap.forEach((beanName, applicationMetricDao) -> logger.info("ApplicationMetricDao BeanName:{}", beanName)); - - List values = new ArrayList<>(metricDaoMap.values()); - return (List>) (List) values; - } - - public static Bootstrap getInstance(Map jobParameters) { - synchronized(Bootstrap.class) { - if (instance == null) { - instance = buildBootstrap(jobParameters); - } - return instance; - } - } - - private static Bootstrap buildBootstrap(Map jobParameters) { - String profiles = jobParameters.getOrDefault(SPRING_PROFILE, "local"); - System.setProperty(PINPOINT_PROFILE, profiles); - Bootstrap bootstrap = new Bootstrap(); - logger.info("Initialized bootstrap: jobParameters=" + jobParameters); - return bootstrap; - } - - public static void close() { - synchronized(Bootstrap.class) { - if (instance == null) { - logger.warn("Invalid attempt of closing bootstrap: bootstrap is not initialized yet"); - return; - } - logger.info("Closing bootstrap: {}", instance); - final ApplicationContext applicationContext = instance.getApplicationContext(); - if (applicationContext instanceof Closeable closeable) { - logger.info("Closing an instance of ApplicationContext: {}", applicationContext); - IOUtils.closeQuietly(closeable); - } else { - logger.warn("Invalid type of applicationContext was found: {}", applicationContext); - } - instance = null; - logger.info("Closed bootstrap: {}", instance); - } - } - - public ApplicationContext getApplicationContext() { - return applicationContext; - } - - public StatisticsDao getStatisticsDao() { - return statisticsDao; - } - - public List> getApplicationMetricDaoList() { - return applicationMetricDaoList; - } - - public TBaseFlatMapper getTbaseFlatMapper() { - return tbaseFlatMapper; - } - - public ApplicationCache getApplicationCache() { - return applicationCache; - } - - public FlinkProperties getFlinkProperties() { - return flinkProperties; - } - - public StreamExecutionEnvironment createStreamExecutionEnvironment() { - if (flinkProperties.isLocalforFlinkStreamExecutionEnvironment()) { - LocalStreamEnvironment localEnvironment = StreamExecutionEnvironment.createLocalEnvironment(); - localEnvironment.setParallelism(1); - return localEnvironment; - } else { - return StreamExecutionEnvironment.getExecutionEnvironment(); - } - } - - public void setStatHandlerTcpDispatchHandler(SourceContext sourceContext) { - agentStatHandler.addSourceContext(sourceContext); - tcpDispatchHandler.setSimpletHandler(agentStatHandler); - } - - public FlinkServerRegister initFlinkServerRegister() { - return applicationContext.getBean("flinkServerRegister", FlinkServerRegister.class); - } - - public void initTcpReceiver() { - // lazy init - applicationContext.getBean("tcpReceiver", TCPReceiverBean.class); - } - - public TcpSourceFunction getTcpSourceFunction() { - return tcpSourceFunction; - } - - public TBaseFlatMapperInterceptor getTbaseFlatMapperInterceptor() { - return tBaseFlatMapperInterceptor; - } - - public StatisticsDaoInterceptor getStatisticsDaoInterceptor() { - return statisticsDaoInterceptor; - } - - public ApplicationStatBoWindowInterceptor getApplicationStatBoWindowInterceptor() { - return applicationStatBoWindowInterceptor; - } -} \ No newline at end of file diff --git a/flink/src/main/java/com/navercorp/pinpoint/flink/FlinkModule.java b/flink/src/main/java/com/navercorp/pinpoint/flink/FlinkModule.java deleted file mode 100644 index 2eb097076d43..000000000000 --- a/flink/src/main/java/com/navercorp/pinpoint/flink/FlinkModule.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright 2023 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.flink; - -import com.navercorp.pinpoint.collector.config.HbaseAsyncConfiguration; -import com.navercorp.pinpoint.common.hbase.HadoopResourceCleanerRegistry; -import com.navercorp.pinpoint.common.hbase.config.DistributorConfiguration; -import com.navercorp.pinpoint.common.hbase.config.HbaseMultiplexerProperties; -import com.navercorp.pinpoint.common.hbase.config.HbaseTemplateConfiguration; -import com.navercorp.pinpoint.common.server.cluster.zookeeper.config.ClusterConfigurationFactory; -import com.navercorp.pinpoint.common.server.hbase.config.HbaseClientConfiguration; -import com.navercorp.pinpoint.flink.cache.FlinkCacheConfiguration; -import com.navercorp.pinpoint.flink.config.FlinkExecutorConfiguration; -import com.navercorp.pinpoint.flink.dao.hbase.ApplicationDaoConfiguration; -import com.navercorp.pinpoint.flink.hbase.Hbase2HadoopResourceCleanerRegistry; -import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Import; -import org.springframework.context.annotation.ImportResource; -import org.springframework.context.annotation.PropertySource; - -@Configuration -@ComponentScan(basePackages = { - "com.navercorp.pinpoint.common.server.util" -}) -@ImportResource({ - "classpath:applicationContext-flink.xml", - "classpath:applicationContext-flink-extend.xml", -}) -@Import({ - PropertyPlaceholderAutoConfiguration.class, - FlinkCacheConfiguration.class, - ApplicationDaoConfiguration.class, - FlinkExecutorConfiguration.class, - HbaseClientConfiguration.class, - HbaseTemplateConfiguration.class, - ClusterConfigurationFactory.class, - HbaseAsyncConfiguration.class, - DistributorConfiguration.class, -}) -@PropertySource(name = "FlinkModule", value = { - "classpath:profiles/${pinpoint.profiles.active:local}/hbase.properties", - "classpath:profiles/${pinpoint.profiles.active:local}/pinpoint-flink.properties" -}) -public class FlinkModule { - @Bean - public HadoopResourceCleanerRegistry hbase2HadoopResourceCleanerRegistry() { - return new Hbase2HadoopResourceCleanerRegistry(); - } - - @Bean - @ConfigurationProperties(prefix = "hbase.client.async") - public HbaseMultiplexerProperties hbaseMultiplexerProperties() { - return new HbaseMultiplexerProperties(); - } -} diff --git a/flink/src/main/java/com/navercorp/pinpoint/flink/StatStreamingVer2Job.java b/flink/src/main/java/com/navercorp/pinpoint/flink/StatStreamingVer2Job.java deleted file mode 100644 index 15e71c2a2cb2..000000000000 --- a/flink/src/main/java/com/navercorp/pinpoint/flink/StatStreamingVer2Job.java +++ /dev/null @@ -1,112 +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.flink; - -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinApplicationStatBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinStatBo; -import com.navercorp.pinpoint.flink.function.ApplicationStatBoWindow; -import org.apache.flink.api.common.eventtime.WatermarkStrategy; -import org.apache.flink.api.java.tuple.Tuple3; -import org.apache.flink.api.java.utils.ParameterTool; -import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment; -import org.apache.flink.streaming.api.windowing.assigners.TumblingEventTimeWindows; -import org.apache.flink.streaming.api.windowing.time.Time; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -import java.io.Serializable; -import java.time.Duration; - -/** - * @author minwoo.jung - * @author youngjin.kim2 - */ -public class StatStreamingVer2Job implements Serializable { - private static final Logger logger = LogManager.getLogger(StatStreamingVer2Job.class); - - private static final String JOB_NAME = "Aggregation Stat Data"; - - public static void main(String[] args) throws Exception { - final ParameterTool paramTool = ParameterTool.fromArgs(args); - new StatStreamingVer2Job().start(paramTool); - } - - public void start(ParameterTool paramTool) throws Exception { - logger.info("Starting '{}' job with job parameter: {}", JOB_NAME, paramTool.toMap()); - final Bootstrap bootstrap = Bootstrap.getInstance(paramTool.toMap()); - final FlowParameters flowParams = new FlowParameters(paramTool); - final StreamExecutionEnvironment env = bootstrap.createStreamExecutionEnvironment(); - env.getConfig().setGlobalJobParameters(paramTool); - env - .addSource(bootstrap.getTcpSourceFunction()).name("TcpSourceFunction") - .flatMap(bootstrap.getTbaseFlatMapper()).name("TBaseFlatMapper") - .filter(el -> el.f1 instanceof JoinApplicationStatBo).name("OnlyJoinApplicationStatBo") - .assignTimestampsAndWatermarks(WatermarkStrategy - .>forBoundedOutOfOrderness(flowParams.getOutOfOrderness()) - .withIdleness(flowParams.getIdleness()) - .withTimestampAssigner((el, t) -> el.f2)) - .keyBy(el -> el.f0) - .window(TumblingEventTimeWindows.of(flowParams.getWindowSize())) - .allowedLateness(flowParams.getAllowedLateness()) - .apply(new ApplicationStatBoWindow()).name("ApplicationStatBoWindow") - .addSink(bootstrap.getStatisticsDao()).name("StatisticsDao"); - env.execute(JOB_NAME); - } - - private static class FlowParameters { - - private static final int DEFAULT_OUT_OF_ORDERNESS_MILLIS = 0; - private static final int DEFAULT_IDLENESS_MILLIS = 10000; - private static final int DEFAULT_WINDOW_SIZE_MILLIS = ApplicationStatBoWindow.WINDOW_SIZE; - private static final int DEFAULT_ALLOWED_LATENESS_MILLIS = ApplicationStatBoWindow.ALLOWED_LATENESS; - - private static final String PARAM_PREFIX = "pinpoint.flink."; - private static final String PARAM_OUT_OF_ORDERNESS = PARAM_PREFIX + "outOfOrdernessMillis"; - private static final String PARAM_IDLENESS = PARAM_PREFIX + "idlenessMillis"; - private static final String PARAM_WINDOW_SIZE = PARAM_PREFIX + "windowSizeMillis"; - private static final String PARAM_ALLOWED_LATENESS = PARAM_PREFIX + "allowedLatenessMillis"; - - private final int outOfOrdernessMillis; - private final int idlenessMillis; - private final int windowSizeMillis; - private final int allowedLatenessMillis; - - FlowParameters(ParameterTool params) { - this.outOfOrdernessMillis = params.getInt(PARAM_OUT_OF_ORDERNESS, DEFAULT_OUT_OF_ORDERNESS_MILLIS); - this.idlenessMillis = params.getInt(PARAM_IDLENESS, DEFAULT_IDLENESS_MILLIS); - this.windowSizeMillis = params.getInt(PARAM_WINDOW_SIZE, DEFAULT_WINDOW_SIZE_MILLIS); - this.allowedLatenessMillis = params.getInt(PARAM_ALLOWED_LATENESS, DEFAULT_ALLOWED_LATENESS_MILLIS); - } - - Duration getOutOfOrderness() { - return Duration.ofMillis(outOfOrdernessMillis); - } - - Duration getIdleness() { - return Duration.ofMillis(idlenessMillis); - } - - Time getWindowSize() { - return Time.milliseconds(windowSizeMillis); - } - - Time getAllowedLateness() { - return Time.milliseconds(allowedLatenessMillis); - } - - } - -} diff --git a/flink/src/main/java/com/navercorp/pinpoint/flink/cache/FlinkCacheConfiguration.java b/flink/src/main/java/com/navercorp/pinpoint/flink/cache/FlinkCacheConfiguration.java deleted file mode 100644 index 75bf94f603d1..000000000000 --- a/flink/src/main/java/com/navercorp/pinpoint/flink/cache/FlinkCacheConfiguration.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2021 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.flink.cache; - -import com.github.benmanes.caffeine.cache.Caffeine; -import org.springframework.cache.CacheManager; -import org.springframework.cache.annotation.EnableCaching; -import org.springframework.cache.caffeine.CaffeineCacheManager; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Primary; - -import java.util.concurrent.TimeUnit; - -@Configuration -@EnableCaching -public class FlinkCacheConfiguration { - - public static final String APPLICATION_ID_CACHE_NAME = "applicationId"; - - @Bean - @Primary - public CacheManager cacheManager() { - CaffeineCacheManager cacheManager = new CaffeineCacheManager(); - cacheManager.setCaffeine(Caffeine.newBuilder() - .expireAfterWrite(600, TimeUnit.SECONDS) - .initialCapacity(200) - .maximumSize(1000)); - return cacheManager; - } - - @Bean - public CacheManager applicationId() { - CaffeineCacheManager caffeineCacheManager = new CaffeineCacheManager(APPLICATION_ID_CACHE_NAME); - caffeineCacheManager.setCaffeine(Caffeine.newBuilder() - .expireAfterWrite(600, TimeUnit.SECONDS) - .initialCapacity(500) - .maximumSize(10000)); - return caffeineCacheManager; - } -} diff --git a/flink/src/main/java/com/navercorp/pinpoint/flink/cluster/FlinkServerRegister.java b/flink/src/main/java/com/navercorp/pinpoint/flink/cluster/FlinkServerRegister.java deleted file mode 100644 index 7d0d77cb596c..000000000000 --- a/flink/src/main/java/com/navercorp/pinpoint/flink/cluster/FlinkServerRegister.java +++ /dev/null @@ -1,227 +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.flink.cluster; - -import com.navercorp.pinpoint.common.server.cluster.zookeeper.CreateNodeMessage; -import com.navercorp.pinpoint.common.server.cluster.zookeeper.CuratorZookeeperClient; -import com.navercorp.pinpoint.common.server.cluster.zookeeper.ZookeeperClient; -import com.navercorp.pinpoint.common.server.cluster.zookeeper.ZookeeperEventWatcher; -import com.navercorp.pinpoint.common.util.NetUtils; -import com.navercorp.pinpoint.flink.cluster.zookeeper.PushZNodeJob; -import com.navercorp.pinpoint.flink.cluster.zookeeper.ZookeeperClusterDataManagerHelper; -import com.navercorp.pinpoint.flink.config.FlinkProperties; -import com.navercorp.pinpoint.rpc.util.ClassUtils; -import com.navercorp.pinpoint.rpc.util.TimerFactory; -import jakarta.annotation.PostConstruct; -import jakarta.annotation.PreDestroy; -import org.apache.curator.utils.ZKPaths; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; -import org.apache.zookeeper.WatchedEvent; -import org.apache.zookeeper.Watcher.Event.EventType; -import org.apache.zookeeper.Watcher.Event.KeeperState; -import org.jboss.netty.util.HashedWheelTimer; -import org.jboss.netty.util.Timeout; -import org.jboss.netty.util.Timer; - -import java.net.InetAddress; -import java.util.Objects; -import java.util.concurrent.TimeUnit; - -/** - * @author minwoo.jung - */ -public class FlinkServerRegister implements ZookeeperEventWatcher { - - private final Logger logger = LogManager.getLogger(this.getClass()); - private final String connectAddress; - private final int sessionTimeout; - private final boolean clusterEnable; - - private final PushFlinkNodeJob pushFlinkNodeJob; - - private ZookeeperClient client; - private ZookeeperClusterDataManagerHelper clusterDataManager; - - private Timer timer; - - public FlinkServerRegister(FlinkProperties flinkProperties) { - Objects.requireNonNull(flinkProperties, "flinkConfiguration"); - this.clusterEnable = flinkProperties.isFlinkClusterEnable(); - this.connectAddress = flinkProperties.getFlinkClusterZookeeperAddress(); - this.sessionTimeout = flinkProperties.getFlinkClusterSessionTimeout(); - String zookeeperPath = flinkProperties.getFlinkZNodePath(); - - String zNodeName = getRepresentationLocalV4Ip() + ":" + flinkProperties.getFlinkClusterTcpPort(); - String zNodeFullPath = ZKPaths.makePath(zookeeperPath, zNodeName); - - CreateNodeMessage createNodeMessage = new CreateNodeMessage(zNodeFullPath, new byte[0]); - int retryInterval = flinkProperties.getFlinkRetryInterval(); - this.pushFlinkNodeJob = new PushFlinkNodeJob(createNodeMessage, retryInterval); - } - - @PostConstruct - public void start() throws Exception { - if (!clusterEnable) { - logger.info("pinpoint flink cluster disable."); - return; - } - - this.timer = createTimer(); - this.client = new CuratorZookeeperClient(connectAddress, sessionTimeout, this); - this.clusterDataManager = new ZookeeperClusterDataManagerHelper(client); - this.client.connect(); - - registerFlinkNode(); - } - - private String getRepresentationLocalV4Ip() { - String ip = NetUtils.getLocalV4Ip(); - - if (!ip.equals(NetUtils.LOOPBACK_ADDRESS_V4)) { - return ip; - } - - // local ip addresses with all LOOPBACK addresses removed - for (final String candidate: NetUtils.getLocalV4IpList()) { - try { - if (InetAddress.getByName(candidate).isReachable(5)) { - return candidate; - } - } catch (Exception ignored) {} - } - - return NetUtils.LOOPBACK_ADDRESS_V4; - } - - @PreDestroy - public void stop() { - if (!clusterEnable) { - logger.info("pinpoint flink cluster disable."); - return; - } - - if (timer != null) { - timer.stop(); - } - - if (client != null) { - this.client.close(); - } - } - - // Retry upon failure (1-min retry period) - // not too much overhead, just logging - public void registerFlinkNode() { - logger.info("registerFlinkNode() started. create UniqPath={}.", pushFlinkNodeJob.createNodeMessage.getNodePath()); - - // successful even for scheduler registration completion - if (isDisconnected()) { - logger.info("Zookeeper is Disconnected."); - return; - } - - if (!clusterDataManager.pushZNode(pushFlinkNodeJob.getCreateNodeMessage())) { - timer.newTimeout(pushFlinkNodeJob, pushFlinkNodeJob.getRetryInterval(), TimeUnit.MILLISECONDS); - } - - } - - @Override - public void process(WatchedEvent event) { - logger.info("Handle Zookeeper Event({}) started.", event); - - KeeperState state = event.getState(); - EventType eventType = event.getType(); - - if (state == KeeperState.SyncConnected) { - // when this happens, ephemeral node disappears - // reconnects automatically, and process gets notified for all events - if (eventType == EventType.NodeChildrenChanged) { - logger.info("zookeeper Event occurs : NodeChildrenChanged event"); - } else if (eventType == EventType.NodeDeleted) { - logger.info("zookeeper Event occurs : NodeDeleted"); - } else if (eventType == EventType.NodeDataChanged) { - logger.info("zookeeper Event occurs : NodeDataChanged"); - } - } - logger.info("Handle Zookeeper Event({}) completed.", event); - } - - @Override - public boolean handleDisconnected() { - return true; - } - - @Override - public boolean handleConnected() { - if (clusterDataManager.pushZNode(pushFlinkNodeJob.getCreateNodeMessage())) { - return true; - } else { - timer.newTimeout(pushFlinkNodeJob, pushFlinkNodeJob.getRetryInterval(), TimeUnit.MILLISECONDS); - return false; - } - } - - private Timer createTimer() { - HashedWheelTimer timer = TimerFactory.createHashedWheelTimer("Pinpoint-Flink-Cluster-Timer", 100, TimeUnit.MILLISECONDS, 512); - timer.start(); - return timer; - } - - public boolean isDisconnected() { - return !client.isConnected(); - } - - class PushFlinkNodeJob implements PushZNodeJob { - private final CreateNodeMessage createNodeMessage; - private final int retryInterval; - - public PushFlinkNodeJob(CreateNodeMessage createNodeMessage, int retryInterval) { - this.createNodeMessage = Objects.requireNonNull(createNodeMessage, "createNodeMessage"); - this.retryInterval = retryInterval; - } - - @Override - public void run(Timeout timeout) throws Exception { - logger.info("Reserved {} started.", ClassUtils.simpleClassName(this)); - - if (isDisconnected()) { - return; - } - - if (!clusterDataManager.pushZNode(getCreateNodeMessage())) { - timer.newTimeout(this, getRetryInterval(), TimeUnit.MILLISECONDS); - } - } - - @Override - public CreateNodeMessage getCreateNodeMessage() { - return createNodeMessage; - } - - @Override - public int getRetryInterval() { - return retryInterval; - } - - @Override - public String toString() { - return ClassUtils.simpleClassName(this) + ", createNodeMessage=" + getCreateNodeMessage(); - } - } - -} diff --git a/flink/src/main/java/com/navercorp/pinpoint/flink/cluster/zookeeper/PushZNodeJob.java b/flink/src/main/java/com/navercorp/pinpoint/flink/cluster/zookeeper/PushZNodeJob.java deleted file mode 100644 index e43c959f118f..000000000000 --- a/flink/src/main/java/com/navercorp/pinpoint/flink/cluster/zookeeper/PushZNodeJob.java +++ /dev/null @@ -1,30 +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.flink.cluster.zookeeper; - -import com.navercorp.pinpoint.common.server.cluster.zookeeper.CreateNodeMessage; -import org.jboss.netty.util.TimerTask; - -/** - * @author minwoo.jung - */ -public interface PushZNodeJob extends TimerTask { - - CreateNodeMessage getCreateNodeMessage(); - - int getRetryInterval(); - -} diff --git a/flink/src/main/java/com/navercorp/pinpoint/flink/cluster/zookeeper/ZookeeperClusterDataManagerHelper.java b/flink/src/main/java/com/navercorp/pinpoint/flink/cluster/zookeeper/ZookeeperClusterDataManagerHelper.java deleted file mode 100644 index 376e010bf417..000000000000 --- a/flink/src/main/java/com/navercorp/pinpoint/flink/cluster/zookeeper/ZookeeperClusterDataManagerHelper.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright 2014 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.flink.cluster.zookeeper; - -import com.navercorp.pinpoint.common.server.cluster.zookeeper.CreateNodeMessage; -import com.navercorp.pinpoint.common.server.cluster.zookeeper.ZookeeperClient; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -import java.util.Objects; - -/** - * @author Taejin Koo - */ -public class ZookeeperClusterDataManagerHelper { - - private final Logger logger = LogManager.getLogger(this.getClass()); - private final ZookeeperClient client; - - public ZookeeperClusterDataManagerHelper(ZookeeperClient client) { - this.client = Objects.requireNonNull(client, "client"); - } - - public boolean pushZNode(CreateNodeMessage createNodeMessage) { - Objects.requireNonNull(createNodeMessage, "createNodeMessage"); - - try { - String nodePath = createNodeMessage.getNodePath(); - client.createPath(nodePath); - client.createOrSetNode(createNodeMessage); - logger.info("Register Zookeeper node UniqPath = {}.", nodePath); - return true; - } catch (Exception e) { - logger.warn(e.getMessage(), e); - } - return false; - } - -} diff --git a/flink/src/main/java/com/navercorp/pinpoint/flink/config/DataReceiverProperties.java b/flink/src/main/java/com/navercorp/pinpoint/flink/config/DataReceiverProperties.java deleted file mode 100644 index 8708894eb99f..000000000000 --- a/flink/src/main/java/com/navercorp/pinpoint/flink/config/DataReceiverProperties.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright 2021 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.flink.config; - -import com.navercorp.pinpoint.common.server.config.AnnotationVisitor; -import com.navercorp.pinpoint.common.server.config.LoggingEvent; -import com.navercorp.pinpoint.common.util.Assert; -import jakarta.annotation.PostConstruct; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; -import org.springframework.beans.factory.annotation.Value; - -/** - * @author Taejin Koo - */ -public class DataReceiverProperties { - private final Logger logger = LogManager.getLogger(getClass()); - - @Value("${flink.receiver.base.ip:0.0.0.0}") - private String bindIp; - - @Value("${flink.receiver.base.port:9994}") - private int bindPort; - - - public DataReceiverProperties() { - } - - - - @PostConstruct - public void log() { - logger.info("{}", this); - AnnotationVisitor visitor = new AnnotationVisitor<>(Value.class); - visitor.visit(this, new LoggingEvent(logger)); - - validate(); - } - - private void validate() { - Assert.isTrue(bindPort > 0, "bindPort must be greater than 0"); - } - - public String getBindIp() { - return bindIp; - } - - - public int getBindPort() { - return bindPort; - } - - - @Override - public String toString() { - final StringBuilder sb = new StringBuilder("AgentBaseDataReceiverProperties{"); - sb.append("bindIp='").append(bindIp).append('\''); - sb.append(", bindPort=").append(bindPort); - sb.append('}'); - return sb.toString(); - } -} \ No newline at end of file diff --git a/flink/src/main/java/com/navercorp/pinpoint/flink/config/FlinkExecutorConfiguration.java b/flink/src/main/java/com/navercorp/pinpoint/flink/config/FlinkExecutorConfiguration.java deleted file mode 100644 index ba16f080e2f9..000000000000 --- a/flink/src/main/java/com/navercorp/pinpoint/flink/config/FlinkExecutorConfiguration.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright 2023 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.flink.config; - -import com.navercorp.pinpoint.collector.monitor.MonitoredThreadPoolExecutorFactoryProvider; -import com.navercorp.pinpoint.collector.monitor.MonitoringExecutors; -import com.navercorp.pinpoint.common.server.executor.ExecutorCustomizer; -import com.navercorp.pinpoint.common.server.executor.ThreadPoolExecutorCustomizer; -import com.navercorp.pinpoint.common.server.thread.MonitoringExecutorProperties; -import com.navercorp.pinpoint.common.server.util.CallerUtils; -import org.springframework.beans.factory.FactoryBean; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.scheduling.concurrent.ThreadPoolExecutorFactoryBean; -import org.springframework.validation.annotation.Validated; - -import java.util.concurrent.ExecutorService; -import java.util.concurrent.ThreadPoolExecutor; - -@Configuration -public class FlinkExecutorConfiguration { - - @Bean - public ExecutorCustomizer flinkExecutorCustomizer() { - return new ThreadPoolExecutorCustomizer(); - } - - @Bean - public MonitoringExecutors flnkMonitoringExecutors( - @Autowired(required = false) MonitoredThreadPoolExecutorFactoryProvider provider - ) { - ExecutorCustomizer customizer = flinkExecutorCustomizer(); - return new MonitoringExecutors(customizer, provider); - } - - - @Bean - @Validated - @ConfigurationProperties("flink.receiver.base.worker") - public MonitoringExecutorProperties flinkWorkerExecutorProperties() { - return new MonitoringExecutorProperties(); - } - - @Bean - public FactoryBean flinkWorker(MonitoringExecutors executors) { - String beanName = CallerUtils.getCallerMethodName(); - MonitoringExecutorProperties properties = flinkWorkerExecutorProperties(); - properties.setLogRate(1); - ThreadPoolExecutorFactoryBean factoryBean = executors.newExecutorFactoryBean(properties, beanName); - factoryBean.setRejectedExecutionHandler(new ThreadPoolExecutor.DiscardPolicy()); - return factoryBean; - } -} diff --git a/flink/src/main/java/com/navercorp/pinpoint/flink/config/FlinkProperties.java b/flink/src/main/java/com/navercorp/pinpoint/flink/config/FlinkProperties.java deleted file mode 100644 index 7509b2847666..000000000000 --- a/flink/src/main/java/com/navercorp/pinpoint/flink/config/FlinkProperties.java +++ /dev/null @@ -1,111 +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.flink.config; - -import com.navercorp.pinpoint.common.server.cluster.zookeeper.ZookeeperClusterProperties; -import com.navercorp.pinpoint.common.server.config.AnnotationVisitor; -import com.navercorp.pinpoint.common.server.config.LoggingEvent; -import jakarta.annotation.PostConstruct; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Component; - -import java.util.Arrays; -import java.util.List; - -/** - * @author minwoo.jung - */ -@Component -public class FlinkProperties { - private final Logger logger = LogManager.getLogger(FlinkProperties.class); - - @Qualifier("flinkClusterProperties") - @Autowired - private ZookeeperClusterProperties clusterProperties; - - @Value("${flink.cluster.zookeeper.retry.interval:60000}") - private int flinkRetryInterval; - - @Value("${flink.cluster.tcp.port:19994}") - private int flinkClusterTcpPort; - - @Value("${flink.StreamExecutionEnvironment:server}") - private String flinkStreamExecutionEnvironment; - - @Value("${collector.l4.ip:}") - private String[] l4IpList = new String[0]; - - public FlinkProperties() { - } - - public boolean isFlinkClusterEnable() { - return clusterProperties.isEnable(); - } - - public String getFlinkClusterZookeeperAddress() { - return clusterProperties.getAddress(); - } - - public String getFlinkZNodePath() { - return clusterProperties.getFlinkZNodePath(); - } - - public int getFlinkClusterTcpPort() { - return flinkClusterTcpPort; - } - - public int getFlinkClusterSessionTimeout() { - return clusterProperties.getSessionTimeout(); - } - - public int getFlinkRetryInterval() { - return flinkRetryInterval; - } - - public boolean isLocalforFlinkStreamExecutionEnvironment() { - return "local".equals(flinkStreamExecutionEnvironment); - } - - public List getL4IpList() { - return List.of(l4IpList); - } - - @PostConstruct - public void log() { - this.logger.info("{}", logger); - AnnotationVisitor annotationVisitor = new AnnotationVisitor<>(Value.class); - annotationVisitor.visit(this, new LoggingEvent(this.logger)); - } - - - @Override - public String toString() { - return "FlinkConfiguration{" + - "flinkClusterEnable=" + isFlinkClusterEnable() + - ", flinkClusterZookeeperAddress='" + getFlinkClusterZookeeperAddress() + '\'' + - ", flinkZNodePath='" + getFlinkZNodePath() + '\'' + - ", flinkClusterSessionTimeout=" + getFlinkClusterSessionTimeout() + - ", flinkRetryInterval=" + flinkRetryInterval + - ", flinkClusterTcpPort=" + flinkClusterTcpPort + - ", flinkStreamExecutionEnvironment='" + flinkStreamExecutionEnvironment + '\'' + - ", l4IpList=" + Arrays.toString(l4IpList) + - '}'; - } -} diff --git a/flink/src/main/java/com/navercorp/pinpoint/flink/dao/hbase/ApplicationDaoConfiguration.java b/flink/src/main/java/com/navercorp/pinpoint/flink/dao/hbase/ApplicationDaoConfiguration.java deleted file mode 100644 index b78ddc2db212..000000000000 --- a/flink/src/main/java/com/navercorp/pinpoint/flink/dao/hbase/ApplicationDaoConfiguration.java +++ /dev/null @@ -1,104 +0,0 @@ -package com.navercorp.pinpoint.flink.dao.hbase; - -import com.navercorp.pinpoint.common.hbase.HbaseTable; -import com.navercorp.pinpoint.common.hbase.TableNameProvider; -import com.navercorp.pinpoint.common.hbase.async.HbasePutWriter; -import com.navercorp.pinpoint.common.server.bo.serializer.stat.ApplicationStatHbaseOperationFactory; -import com.navercorp.pinpoint.common.server.bo.serializer.stat.join.ApplicationStatSerializer; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinActiveTraceBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinApplicationStatBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinCpuLoadBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinDataSourceListBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinDirectBufferBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinFileDescriptorBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinLoadedClassBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinMemoryBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinResponseTimeBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinStatBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinTotalThreadCountBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinTransactionBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.StatType; -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 ApplicationDaoConfiguration { - - private final HbaseTable tableName = HbaseTable.APPLICATION_STAT_AGGRE; - private final ApplicationStatHbaseOperationFactory operations; - private final TableNameProvider tableNameProvider; - private final HbasePutWriter putWriter; - - public ApplicationDaoConfiguration(HbasePutWriter putWriter, - ApplicationStatHbaseOperationFactory operations, - TableNameProvider tableNameProvider) { - this.putWriter = Objects.requireNonNull(putWriter, "putWriter"); - this.operations = Objects.requireNonNull(operations, "operations"); - this.tableNameProvider = Objects.requireNonNull(tableNameProvider, "tableNameProvider"); - } - - private ApplicationMetricDao newApplicationMetricDao(StatType statType, - Function> appStatFunction, - ApplicationStatSerializer serializer) { - Objects.requireNonNull(statType, "statType"); - Objects.requireNonNull(appStatFunction, "appStatFunction"); - Objects.requireNonNull(serializer, "serializer"); - - return new DefaultApplicationMetricDao<>(statType, appStatFunction, - serializer, tableName, putWriter, operations, tableNameProvider); - } - - @Bean - public ApplicationMetricDao getActiveTraceDao(ApplicationStatSerializer serializer) { - return newApplicationMetricDao(StatType.APP_ACTIVE_TRACE_COUNT, JoinApplicationStatBo::getJoinActiveTraceBoList, serializer); - } - - @Bean - public ApplicationMetricDao getCpuLoadDao(ApplicationStatSerializer serializer) { - return newApplicationMetricDao(StatType.APP_CPU_LOAD, JoinApplicationStatBo::getJoinCpuLoadBoList, serializer); - } - - @Bean - public ApplicationMetricDao getDataSourceDao(ApplicationStatSerializer serializer) { - return newApplicationMetricDao(StatType.APP_DATA_SOURCE, JoinApplicationStatBo::getJoinDataSourceListBoList, serializer); - } - - @Bean - public ApplicationMetricDao getDirectBufferDao(ApplicationStatSerializer serializer) { - return newApplicationMetricDao(StatType.APP_DIRECT_BUFFER, JoinApplicationStatBo::getJoinDirectBufferBoList, serializer); - } - - @Bean - public ApplicationMetricDao getFileDescriptorDao(ApplicationStatSerializer serializer) { - return newApplicationMetricDao(StatType.APP_FILE_DESCRIPTOR, JoinApplicationStatBo::getJoinFileDescriptorBoList, serializer); - } - - @Bean - public ApplicationMetricDao getLoadedClassDao(ApplicationStatSerializer serializer) { - return newApplicationMetricDao(StatType.APP_LOADED_CLASS, JoinApplicationStatBo::getJoinLoadedClassBoList, serializer); - } - - @Bean - public ApplicationMetricDao getMemoryDao(ApplicationStatSerializer serializer) { - return newApplicationMetricDao(StatType.APP_MEMORY_USED, JoinApplicationStatBo::getJoinMemoryBoList, serializer); - } - - @Bean - public ApplicationMetricDao getResponseTimeDao(ApplicationStatSerializer serializer) { - return newApplicationMetricDao(StatType.APP_RESPONSE_TIME, JoinApplicationStatBo::getJoinResponseTimeBoList, serializer); - } - - @Bean - public ApplicationMetricDao getTotalThreadCountDao(ApplicationStatSerializer serializer) { - return newApplicationMetricDao(StatType.APP_TOTAL_THREAD_COUNT, JoinApplicationStatBo::getJoinTotalThreadCountBoList, serializer); - } - - @Bean - public ApplicationMetricDao getTransactionDao(ApplicationStatSerializer serializer) { - return newApplicationMetricDao(StatType.APP_TRANSACTION_COUNT, JoinApplicationStatBo::getJoinTransactionBoList, serializer); - } -} diff --git a/flink/src/main/java/com/navercorp/pinpoint/flink/dao/hbase/ApplicationMetricDao.java b/flink/src/main/java/com/navercorp/pinpoint/flink/dao/hbase/ApplicationMetricDao.java deleted file mode 100644 index 429734d2656f..000000000000 --- a/flink/src/main/java/com/navercorp/pinpoint/flink/dao/hbase/ApplicationMetricDao.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.navercorp.pinpoint.flink.dao.hbase; - -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinApplicationStatBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinStatBo; - -import java.util.List; - -public interface ApplicationMetricDao { - void insert(String id, long timestamp, List joinStatBoList); - - void insert(JoinApplicationStatBo joinApplicationStatBo); -} diff --git a/flink/src/main/java/com/navercorp/pinpoint/flink/dao/hbase/DefaultApplicationMetricDao.java b/flink/src/main/java/com/navercorp/pinpoint/flink/dao/hbase/DefaultApplicationMetricDao.java deleted file mode 100644 index 177fc66c256d..000000000000 --- a/flink/src/main/java/com/navercorp/pinpoint/flink/dao/hbase/DefaultApplicationMetricDao.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.navercorp.pinpoint.flink.dao.hbase; - -import com.navercorp.pinpoint.common.hbase.HbaseTable; -import com.navercorp.pinpoint.common.hbase.TableNameProvider; -import com.navercorp.pinpoint.common.hbase.async.HbasePutWriter; -import com.navercorp.pinpoint.common.server.bo.serializer.stat.ApplicationStatHbaseOperationFactory; -import com.navercorp.pinpoint.common.server.bo.serializer.stat.join.ApplicationStatSerializer; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinApplicationStatBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinStatBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.StatType; -import com.navercorp.pinpoint.common.server.util.DateTimeFormatUtils; -import org.apache.hadoop.hbase.TableName; -import org.apache.hadoop.hbase.client.Put; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -import java.util.List; -import java.util.Objects; -import java.util.function.Function; - -public class DefaultApplicationMetricDao implements ApplicationMetricDao { - protected final Logger logger = LogManager.getLogger(this.getClass()); - - private final StatType statType; - private final Function> appStatFunction; - private final ApplicationStatSerializer serializer; - - private final HbaseTable tableName; - private final HbasePutWriter putWriter; - private final ApplicationStatHbaseOperationFactory operations; - private final TableNameProvider tableNameProvider; - - public DefaultApplicationMetricDao(StatType statType, - Function> appStatFunction, - ApplicationStatSerializer serializer, - - HbaseTable tableName, - HbasePutWriter putWriter, - ApplicationStatHbaseOperationFactory operations, - TableNameProvider tableNameProvider) { - this.statType = Objects.requireNonNull(statType, "statType"); - this.appStatFunction = Objects.requireNonNull(appStatFunction, "dataPointFunction"); - this.serializer = Objects.requireNonNull(serializer, "activeTraceSerializer"); - - this.tableName = Objects.requireNonNull(tableName, "tableName"); - this.putWriter = Objects.requireNonNull(putWriter, "putWriter"); - this.operations = Objects.requireNonNull(operations, "operations"); - this.tableNameProvider = Objects.requireNonNull(tableNameProvider, "tableNameProvider"); - } - - public void insert(String id, long timestamp, List appStatBoList) { - Objects.requireNonNull(id, "id"); - Objects.requireNonNull(appStatBoList, "appStatBoList"); - - if (logger.isDebugEnabled()) { - logger.debug("[insert] {} : ({})", DateTimeFormatUtils.format(timestamp), appStatBoList); - } - List activeTracePuts = operations.createPuts(id, appStatBoList, statType, serializer); - if (activeTracePuts.isEmpty()) { - return; - } - TableName applicationStatAggreTableName = tableNameProvider.getTableName(tableName); - this.putWriter.put(applicationStatAggreTableName, activeTracePuts); - } - - @Override - public void insert(JoinApplicationStatBo applicationStatBo) { - Objects.requireNonNull(applicationStatBo, "applicationStatBo"); - - List statBo = appStatFunction.apply(applicationStatBo); - insert(applicationStatBo.getId(), applicationStatBo.getTimestamp(), statBo); - } -} diff --git a/flink/src/main/java/com/navercorp/pinpoint/flink/dao/hbase/DefaultStatisticsDaoInterceptor.java b/flink/src/main/java/com/navercorp/pinpoint/flink/dao/hbase/DefaultStatisticsDaoInterceptor.java deleted file mode 100644 index bb62b4d57537..000000000000 --- a/flink/src/main/java/com/navercorp/pinpoint/flink/dao/hbase/DefaultStatisticsDaoInterceptor.java +++ /dev/null @@ -1,33 +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.flink.dao.hbase; - -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinStatBo; -import org.apache.flink.api.java.tuple.Tuple3; - -/** - * @author minwoo.jung - */ -public class DefaultStatisticsDaoInterceptor implements StatisticsDaoInterceptor { - - @Override - public void before(Tuple3 statData) { - } - - @Override - public void after() { - } -} \ No newline at end of file diff --git a/flink/src/main/java/com/navercorp/pinpoint/flink/dao/hbase/StatisticsDao.java b/flink/src/main/java/com/navercorp/pinpoint/flink/dao/hbase/StatisticsDao.java deleted file mode 100644 index 3227ca1f6b02..000000000000 --- a/flink/src/main/java/com/navercorp/pinpoint/flink/dao/hbase/StatisticsDao.java +++ /dev/null @@ -1,101 +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.flink.dao.hbase; - -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinAgentStatBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinApplicationStatBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinStatBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.StatType; -import com.navercorp.pinpoint.flink.Bootstrap; -import org.apache.flink.api.common.ExecutionConfig; -import org.apache.flink.api.java.tuple.Tuple3; -import org.apache.flink.configuration.Configuration; -import org.apache.flink.streaming.api.functions.sink.RichSinkFunction; -import org.apache.flink.streaming.api.functions.sink.SinkFunction; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -/** - * @author minwoo.jung - */ -public class StatisticsDao extends RichSinkFunction> { - private final static Logger logger = LogManager.getLogger(StatisticsDao.class); - - private static final long serialVersionUID = 1L; - - private transient ApplicationMetricDao[] applicationMetricDaoList; - private transient StatisticsDaoInterceptor statisticsDaoInterceptor; - - @Override - public void open(Configuration parameters) throws Exception { - ExecutionConfig.GlobalJobParameters globalJobParameters = getRuntimeContext().getExecutionConfig().getGlobalJobParameters(); - Bootstrap bootstrap = Bootstrap.getInstance(globalJobParameters.toMap()); - applicationMetricDaoList = bootstrap.getApplicationMetricDaoList().toArray(new ApplicationMetricDao[0]); - statisticsDaoInterceptor = bootstrap.getStatisticsDaoInterceptor(); - } - - @Override - public void invoke(Tuple3 statData, SinkFunction.Context context) throws Exception { - statisticsDaoInterceptor.before(statData); - - try { - JoinStatBo joinStatBo = statData.f1; - if (joinStatBo instanceof JoinAgentStatBo joinAgentStatBo) { - if (logger.isDebugEnabled()) { - logger.debug("JoinAgentStatBo insert data : {}", joinStatBo); - } - insertJoinAgentStatBo(joinAgentStatBo); - } else if (joinStatBo instanceof JoinApplicationStatBo) { -// logger.info("JoinApplicationStatBo insert data : " + joinStatBo); - insertJoinApplicationStatBo((JoinApplicationStatBo) joinStatBo); - } - } finally { - statisticsDaoInterceptor.after(); - } - } - - private void insertJoinApplicationStatBo(JoinApplicationStatBo appMetric) { - if (appMetric.getStatType() == StatType.APP_STST_AGGRE) { -// logger.info("insert application aggre : " + new Date(joinApplicationStatBo.getTimestamp()) + " ("+ joinApplicationStatBo.getApplicationId() + " )"); - } else { - for (ApplicationMetricDao dao : applicationMetricDaoList) { - dao.insert(appMetric); - } - } - } - - private void insertJoinAgentStatBo(JoinAgentStatBo joinAgentStatBo) { -// logger.info("insert agent data : " + new Date(joinAgentStatBo.getTimestamp())); -// String rowKey = joinAgentStatBo.getAgentId() + "_" + AgentStatType.CPU_LOAD.getRawTypeCode() +"_" + joinAgentStatBo.getTimestamp(); -// Put put = new Put(rowKey.getBytes()); -// -// final Buffer valueBuffer = new AutomaticBuffer(); -// JoinCpuLoadBo joinCpuLoadBo = joinAgentStatBo.getJoinCpuLoadBoList().get(0); -// valueBuffer.putByte(joinCpuLoadBo.getVersion()); -// valueBuffer.putDouble(joinCpuLoadBo.getJvmCpuLoad()); -// valueBuffer.putDouble(joinCpuLoadBo.getMaxJvmCpuLoad()); -// valueBuffer.putDouble(joinCpuLoadBo.getMinJvmCpuLoad()); -// valueBuffer.putDouble(joinCpuLoadBo.getSystemCpuLoad()); -// valueBuffer.putDouble(joinCpuLoadBo.getMaxSystemCpuLoad()); -// valueBuffer.putDouble(joinCpuLoadBo.getMinSystemCpuLoad()); -// -// final Buffer qualifierBuffer = new AutomaticBuffer(64); -// qualifierBuffer.putVLong(joinAgentStatBo.getTimestamp()); -// -// put.addColumn(STAT_METADATA_CF, Bytes.toBytes(qualifierBuffer.wrapByteBuffer()), Bytes.toBytes(valueBuffer.wrapByteBuffer())); -// hbaseTemplate2.put(TableName.valueOf("AgentStatV2Aggre"), put); - } -} \ No newline at end of file diff --git a/flink/src/main/java/com/navercorp/pinpoint/flink/dao/hbase/StatisticsDaoInterceptor.java b/flink/src/main/java/com/navercorp/pinpoint/flink/dao/hbase/StatisticsDaoInterceptor.java deleted file mode 100644 index c3069c0fb12a..000000000000 --- a/flink/src/main/java/com/navercorp/pinpoint/flink/dao/hbase/StatisticsDaoInterceptor.java +++ /dev/null @@ -1,28 +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.flink.dao.hbase; - -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinStatBo; -import org.apache.flink.api.java.tuple.Tuple3; - -/** - * @author minwoo.jung - */ -public interface StatisticsDaoInterceptor { - void before(Tuple3 statData); - - void after(); -} \ No newline at end of file diff --git a/flink/src/main/java/com/navercorp/pinpoint/flink/function/AgentStatTimestampAssigner.java b/flink/src/main/java/com/navercorp/pinpoint/flink/function/AgentStatTimestampAssigner.java deleted file mode 100644 index 31685fa62cc7..000000000000 --- a/flink/src/main/java/com/navercorp/pinpoint/flink/function/AgentStatTimestampAssigner.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2021 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.flink.function; - -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinStatBo; -import org.apache.flink.api.common.eventtime.SerializableTimestampAssigner; -import org.apache.flink.api.java.tuple.Tuple3; - -/** - * @author minwoo.jung - */ -public class AgentStatTimestampAssigner implements SerializableTimestampAssigner> { - @Override - public long extractTimestamp(Tuple3 value, long l) { - return value.f2; - } -} diff --git a/flink/src/main/java/com/navercorp/pinpoint/flink/function/ApplicationStatBoFilter.java b/flink/src/main/java/com/navercorp/pinpoint/flink/function/ApplicationStatBoFilter.java deleted file mode 100644 index 6a8f6d9919c6..000000000000 --- a/flink/src/main/java/com/navercorp/pinpoint/flink/function/ApplicationStatBoFilter.java +++ /dev/null @@ -1,36 +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.flink.function; - -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinApplicationStatBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinStatBo; -import org.apache.flink.api.common.functions.FilterFunction; -import org.apache.flink.api.java.tuple.Tuple3; - -/** - * @author minwoo.jung - */ -public class ApplicationStatBoFilter implements FilterFunction> { - - @Override - public boolean filter(Tuple3 value) throws Exception { - if (value.f1 instanceof JoinApplicationStatBo) { - return true; - } - - return false; - } -} diff --git a/flink/src/main/java/com/navercorp/pinpoint/flink/function/ApplicationStatBoWindow.java b/flink/src/main/java/com/navercorp/pinpoint/flink/function/ApplicationStatBoWindow.java deleted file mode 100644 index cc623536f90d..000000000000 --- a/flink/src/main/java/com/navercorp/pinpoint/flink/function/ApplicationStatBoWindow.java +++ /dev/null @@ -1,104 +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.flink.function; - -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinApplicationStatBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinStatBo; -import com.navercorp.pinpoint.flink.Bootstrap; -import org.apache.flink.api.common.ExecutionConfig.GlobalJobParameters; -import org.apache.flink.api.java.tuple.Tuple3; -import org.apache.flink.configuration.Configuration; -import org.apache.flink.streaming.api.functions.windowing.RichWindowFunction; -import org.apache.flink.streaming.api.windowing.windows.TimeWindow; -import org.apache.flink.util.Collector; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -import java.io.Serial; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -/** - * @author minwoo.jung - */ -public class ApplicationStatBoWindow extends RichWindowFunction, Tuple3, String, TimeWindow> { - - @Serial - private static final long serialVersionUID = -3953699799713562034L; - - public static final int WINDOW_SIZE = 10000; - public static final int ALLOWED_LATENESS = 45000; - - private final static Logger logger = LogManager.getLogger(ApplicationStatBoWindow.class); - - private transient ApplicationStatBoWindowInterceptor applicationStatBoWindowInterceptor; - - @Override - public void open(Configuration parameters) throws Exception { - GlobalJobParameters globalJobParameters = getRuntimeContext().getExecutionConfig().getGlobalJobParameters(); - applicationStatBoWindowInterceptor = Bootstrap.getInstance(globalJobParameters.toMap()).getApplicationStatBoWindowInterceptor(); - - } - - @Override - public void apply(String groupingKey, TimeWindow window, Iterable> values, Collector> out) throws Exception { - applicationStatBoWindowInterceptor.before(values); - try { - JoinApplicationStatBo joinApplicationStatBo = join(values); - long delayTime = new Date().getTime() - joinApplicationStatBo.getTimestamp(); - if (delayTime > 35000) { - if (logger.isDebugEnabled()) { - logger.debug("[join][delay3] {} : {}", new Date(joinApplicationStatBo.getTimestamp()), joinApplicationStatBo); - } - } else if (delayTime > 25000) { - if (logger.isDebugEnabled()) { - logger.debug("[join][delay2] {} : {}", new Date(joinApplicationStatBo.getTimestamp()), joinApplicationStatBo); - } - } else if (delayTime > 15000) { - if (logger.isDebugEnabled()) { - logger.debug("[join][delay1] {} : {}", new Date(joinApplicationStatBo.getTimestamp()), joinApplicationStatBo); - } - } else { - if (logger.isDebugEnabled()) { - logger.debug("[join][non] {} : {}", new Date(joinApplicationStatBo.getTimestamp()), joinApplicationStatBo); - } - } - - if (joinApplicationStatBo == JoinApplicationStatBo.EMPTY_JOIN_APPLICATION_STAT_BO) { - return; - } - - Tuple3 resultTuple = applicationStatBoWindowInterceptor.middle(new Tuple3<>(groupingKey, joinApplicationStatBo, joinApplicationStatBo.getTimestamp())); - out.collect(resultTuple); - } catch (Exception e) { - logger.error("window function error", e); - } finally { - applicationStatBoWindowInterceptor.after(); - } - } - - private JoinApplicationStatBo join(Iterable> values) { - List joinApplicaitonStatBoList = new ArrayList<>(); - - for (Tuple3 value : values) { - joinApplicaitonStatBoList.add((JoinApplicationStatBo) value.f1); - } - - return JoinApplicationStatBo.joinApplicationStatBoByTimeSlice(joinApplicaitonStatBoList); - - } -} \ No newline at end of file diff --git a/flink/src/main/java/com/navercorp/pinpoint/flink/function/ApplicationStatBoWindowInterceptor.java b/flink/src/main/java/com/navercorp/pinpoint/flink/function/ApplicationStatBoWindowInterceptor.java deleted file mode 100644 index 14ca938c48f9..000000000000 --- a/flink/src/main/java/com/navercorp/pinpoint/flink/function/ApplicationStatBoWindowInterceptor.java +++ /dev/null @@ -1,30 +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.flink.function; - -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinStatBo; -import org.apache.flink.api.java.tuple.Tuple3; - -/** - * @author minwoo.jung - */ -public interface ApplicationStatBoWindowInterceptor { - void before(Iterable> values); - - Tuple3 middle(Tuple3 value); - - void after(); -} \ No newline at end of file diff --git a/flink/src/main/java/com/navercorp/pinpoint/flink/function/ApplicationStatKeySelector.java b/flink/src/main/java/com/navercorp/pinpoint/flink/function/ApplicationStatKeySelector.java deleted file mode 100644 index 9b6852b45beb..000000000000 --- a/flink/src/main/java/com/navercorp/pinpoint/flink/function/ApplicationStatKeySelector.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2021 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.flink.function; - -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinStatBo; -import org.apache.flink.api.java.functions.KeySelector; -import org.apache.flink.api.java.tuple.Tuple3; - -/** - * @author minwoo.jung - */ -public class ApplicationStatKeySelector implements KeySelector, String> { - @Override - public String getKey(Tuple3 value) throws Exception { - return value.f0; - } -} diff --git a/flink/src/main/java/com/navercorp/pinpoint/flink/function/DefaultApplicationStatBoWindowInterceptor.java b/flink/src/main/java/com/navercorp/pinpoint/flink/function/DefaultApplicationStatBoWindowInterceptor.java deleted file mode 100644 index b06015669259..000000000000 --- a/flink/src/main/java/com/navercorp/pinpoint/flink/function/DefaultApplicationStatBoWindowInterceptor.java +++ /dev/null @@ -1,37 +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.flink.function; - -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinStatBo; -import org.apache.flink.api.java.tuple.Tuple3; - -/** - * @author minwoo.jung - */ -public class DefaultApplicationStatBoWindowInterceptor implements ApplicationStatBoWindowInterceptor { - @Override - public void before(Iterable> values) { - } - - @Override - public Tuple3 middle(Tuple3 value) { - return value; - } - - @Override - public void after() { - } -} \ No newline at end of file diff --git a/flink/src/main/java/com/navercorp/pinpoint/flink/function/JoinAgentStatBoFunction.java b/flink/src/main/java/com/navercorp/pinpoint/flink/function/JoinAgentStatBoFunction.java deleted file mode 100644 index 817f3241bb5c..000000000000 --- a/flink/src/main/java/com/navercorp/pinpoint/flink/function/JoinAgentStatBoFunction.java +++ /dev/null @@ -1,47 +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.flink.function; - -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinAgentStatBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinStatBo; -import org.apache.flink.api.java.tuple.Tuple; -import org.apache.flink.api.java.tuple.Tuple3; -import org.apache.flink.streaming.api.functions.windowing.WindowFunction; -import org.apache.flink.streaming.api.windowing.windows.TimeWindow; -import org.apache.flink.util.Collector; - -import java.util.ArrayList; -import java.util.List; - -/** - * @author minwoo.jung - */ -public class JoinAgentStatBoFunction implements WindowFunction, Tuple3, Tuple, TimeWindow> { - @Override - public void apply(Tuple tuple, TimeWindow window, Iterable> values, Collector> out) throws Exception { - JoinAgentStatBo joinAgentStatBo = join(values); - out.collect(new Tuple3<>(joinAgentStatBo.getId(), joinAgentStatBo, joinAgentStatBo.getTimestamp())); - } - - private JoinAgentStatBo join(Iterable> values) { - List joinAgentStatBoList = new ArrayList<>(); - for (Tuple3 value : values) { - joinAgentStatBoList.add((JoinAgentStatBo) value.f1); - } - - return JoinAgentStatBo.joinAgentStatBo(joinAgentStatBoList); - } -} diff --git a/flink/src/main/java/com/navercorp/pinpoint/flink/function/Timestamp.java b/flink/src/main/java/com/navercorp/pinpoint/flink/function/Timestamp.java deleted file mode 100644 index 0e2ce6891f55..000000000000 --- a/flink/src/main/java/com/navercorp/pinpoint/flink/function/Timestamp.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright 2014 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.flink.function; - -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinStatBo; -import org.apache.flink.api.java.tuple.Tuple3; -import org.apache.flink.streaming.api.functions.AssignerWithPunctuatedWatermarks; -import org.apache.flink.streaming.api.watermark.Watermark; - -/** - * @author minwoo.jung - */ -@Deprecated -public class Timestamp implements AssignerWithPunctuatedWatermarks> { - - private static final long serialVersionUID = 1L; - - @Override - public Watermark checkAndGetNextWatermark(Tuple3 lastElement, long extractedTimestamp) { - return new Watermark(lastElement.f2); - } - - @Override - public long extractTimestamp(Tuple3 value, long previousElementTimestamp) { - return value.f2; - } -} diff --git a/flink/src/main/java/com/navercorp/pinpoint/flink/function/Timestamp2.java b/flink/src/main/java/com/navercorp/pinpoint/flink/function/Timestamp2.java deleted file mode 100644 index d3882f656d58..000000000000 --- a/flink/src/main/java/com/navercorp/pinpoint/flink/function/Timestamp2.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright 2014 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.flink.function; - -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinStatBo; -import org.apache.flink.api.java.tuple.Tuple3; -import org.apache.flink.streaming.api.functions.AssignerWithPunctuatedWatermarks; -import org.apache.flink.streaming.api.watermark.Watermark; - -/** - * @author minwoo.jung - */ -@Deprecated -public class Timestamp2 implements AssignerWithPunctuatedWatermarks> { - - private static final long serialVersionUID = 1L; - - @Override - public Watermark checkAndGetNextWatermark(Tuple3 lastElement, long extractedTimestamp) { - return new Watermark(lastElement.f2); - } - - @Override - public long extractTimestamp(Tuple3 value, long previousElementTimestamp) { - return value.f2; - } -} diff --git a/flink/src/main/java/com/navercorp/pinpoint/flink/hbase/Hbase2HadoopResourceCleanerRegistry.java b/flink/src/main/java/com/navercorp/pinpoint/flink/hbase/Hbase2HadoopResourceCleanerRegistry.java deleted file mode 100644 index 60e3590d4815..000000000000 --- a/flink/src/main/java/com/navercorp/pinpoint/flink/hbase/Hbase2HadoopResourceCleanerRegistry.java +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright 2023 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.flink.hbase; - -import com.navercorp.pinpoint.common.hbase.HadoopResourceCleanerRegistry; -import io.netty.util.concurrent.DefaultThreadFactory; -import org.apache.hadoop.conf.Configuration; -import org.apache.hadoop.hbase.ipc.AbstractRpcClient; -import org.apache.hadoop.hbase.ipc.NettyRpcClientConfigHelper; -import org.apache.hbase.thirdparty.io.netty.buffer.PoolArenaCleaner; -import org.apache.hbase.thirdparty.io.netty.channel.EventLoopGroup; -import org.apache.hbase.thirdparty.io.netty.channel.nio.NioEventLoopGroup; -import org.apache.hbase.thirdparty.io.netty.channel.socket.nio.NioSocketChannel; -import org.apache.hbase.thirdparty.io.netty.util.HashedWheelTimer; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; -import org.springframework.beans.factory.DisposableBean; -import org.springframework.beans.factory.InitializingBean; - -import java.lang.reflect.Field; -import java.util.concurrent.ExecutorService; - -/** - * @author youngjin.kim2 - */ -public class Hbase2HadoopResourceCleanerRegistry implements HadoopResourceCleanerRegistry, DisposableBean, InitializingBean { - - private static final Logger logger = LogManager.getLogger(Hbase2HadoopResourceCleanerRegistry.class); - - private boolean cleanSelf = true; - private EventLoopGroup eventLoopGroup; - - @Override - public void register(Configuration configuration) { - logger.info("Modified netty rpc client to use custom eventLoopGroup"); - NettyRpcClientConfigHelper.setEventLoopConfig( - configuration, - this.eventLoopGroup, - NioSocketChannel.class - ); - this.cleanSelf = false; - } - - @Override - public void clean() { - logger.info("Cleaning hbase2 hadoop resource"); - closeIdleConnSweeper(); - closeWheelTimer(); - closeEventLoopGroup(); - PoolArenaCleaner.finalizeExplicitly(); - } - - @Override - public void afterPropertiesSet() { - logger.info("Creating eventLoopGroup"); - - final DefaultThreadFactory eventLoopThreadFactory = - new DefaultThreadFactory("Pinpoint-RPCClient-NioEventLoopGroup", true, Thread.NORM_PRIORITY); - - this.eventLoopGroup = new NioEventLoopGroup(6, eventLoopThreadFactory); - - logger.info("Created eventLoopGroup for netty-rpc-client"); - } - - @Override - public void destroy() { - if (this.cleanSelf) { - logger.info("Closing custom eventLoopGroup for netty-rpc-client"); - this.closeEventLoopGroup(); - } else { - logger.info("Skipped closing custom eventLoopGroup for netty-rpc-client, any other must clean it"); - } - } - - private void closeEventLoopGroup() { - if (this.eventLoopGroup != null) { - logger.info("Shutdown eventLoopGroup gracefully"); - this.eventLoopGroup.shutdownGracefully(); - } else { - logger.warn("Failed to shutdown eventLoopGroup: eventLoopGroup is null"); - } - } - - private static void closeIdleConnSweeper() { - try { - logger.info("Shutdown idleConnSweeper"); - getStaticIdleConnSweeper().shutdown(); - } catch (Exception e) { - logger.warn("Failed to shutdown idleConnSweeper", e); - } - } - - private static ExecutorService getStaticIdleConnSweeper() throws Exception { - final Field sweeperField = AbstractRpcClient.class.getDeclaredField("IDLE_CONN_SWEEPER"); - sweeperField.setAccessible(true); - final Object sweeperObj = sweeperField.get(null); - if (sweeperObj instanceof ExecutorService executor) { - return executor; - } else { - throw new RuntimeException("idleConnSweeper not found"); - } - } - - private static void closeWheelTimer() { - try { - logger.info("Stopping wheelTimer"); - getStaticWheelTimer().stop(); - } catch (Exception e) { - logger.warn("Failed to stop wheelTimer", e); - } - } - - private static HashedWheelTimer getStaticWheelTimer() throws Exception { - final Field wheelTimerField = AbstractRpcClient.class.getDeclaredField("WHEEL_TIMER"); - wheelTimerField.setAccessible(true); - final Object wheelTimerObj = wheelTimerField.get(null); - if (wheelTimerObj instanceof HashedWheelTimer timer) { - return timer; - } else { - throw new RuntimeException("wheelTimer not found"); - } - } - -} diff --git a/flink/src/main/java/com/navercorp/pinpoint/flink/mapper/thrift/ThriftBoMapper.java b/flink/src/main/java/com/navercorp/pinpoint/flink/mapper/thrift/ThriftBoMapper.java deleted file mode 100644 index 2ce5ae19d0f1..000000000000 --- a/flink/src/main/java/com/navercorp/pinpoint/flink/mapper/thrift/ThriftBoMapper.java +++ /dev/null @@ -1,26 +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.flink.mapper.thrift; - -import org.apache.thrift.TBase; - -/** - * @author minwoo.jung - */ -public interface ThriftBoMapper> { - - T map(F thriftObject); -} diff --git a/flink/src/main/java/com/navercorp/pinpoint/flink/mapper/thrift/stat/JoinActiveTraceBoMapper.java b/flink/src/main/java/com/navercorp/pinpoint/flink/mapper/thrift/stat/JoinActiveTraceBoMapper.java deleted file mode 100644 index 3394e276c604..000000000000 --- a/flink/src/main/java/com/navercorp/pinpoint/flink/mapper/thrift/stat/JoinActiveTraceBoMapper.java +++ /dev/null @@ -1,83 +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.flink.mapper.thrift.stat; - -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinActiveTraceBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinAgentStatBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinIntFieldBo; -import com.navercorp.pinpoint.common.util.CollectionUtils; -import com.navercorp.pinpoint.thrift.dto.flink.TFActiveTrace; -import com.navercorp.pinpoint.thrift.dto.flink.TFActiveTraceHistogram; -import com.navercorp.pinpoint.thrift.dto.flink.TFAgentStat; - -import java.util.List; - -/** - * @author minwoo.jung - */ -public class JoinActiveTraceBoMapper implements ThriftStatMapper { - - @Override - public JoinActiveTraceBo map(TFAgentStat tFAgentStat) { - if (!tFAgentStat.isSetActiveTrace()) { - return JoinActiveTraceBo.EMPTY_JOIN_ACTIVE_TRACE_BO; - } - - final TFActiveTrace tFactiveTrace = tFAgentStat.getActiveTrace(); - final String agentId = tFAgentStat.getAgentId(); - - if (tFactiveTrace.isSetHistogram() == false) { - return JoinActiveTraceBo.EMPTY_JOIN_ACTIVE_TRACE_BO; - } - - final TFActiveTraceHistogram histogram = tFactiveTrace.getHistogram(); - final int totalCount = calculateTotalCount(tFactiveTrace.getHistogram()); - - JoinActiveTraceBo joinActiveTraceBo = new JoinActiveTraceBo(); - joinActiveTraceBo.setId(agentId); - joinActiveTraceBo.setTimestamp(tFAgentStat.getTimestamp()); - joinActiveTraceBo.setHistogramSchemaType(histogram.getHistogramSchemaType()); - joinActiveTraceBo.setVersion(histogram.getVersion()); - joinActiveTraceBo.setTotalCountJoinValue(new JoinIntFieldBo(totalCount, totalCount, agentId, totalCount, agentId)); - return joinActiveTraceBo; - } - - private int calculateTotalCount(TFActiveTraceHistogram histogram) { - int totalCount = 0; - - List activeTraceCountList = histogram.getActiveTraceCount(); - - if (CollectionUtils.isEmpty(activeTraceCountList)) { - return totalCount; - } - for (int activeTraceCount : activeTraceCountList) { - totalCount += activeTraceCount; - } - - return totalCount; - } - - @Override - public void build(TFAgentStat tFAgentStat, JoinAgentStatBo.Builder builder) { - JoinActiveTraceBo joinActiveTraceBo = this.map(tFAgentStat); - - if (joinActiveTraceBo == joinActiveTraceBo.EMPTY_JOIN_ACTIVE_TRACE_BO) { - return; - } - - builder.addActiveTrace(joinActiveTraceBo); - } -} diff --git a/flink/src/main/java/com/navercorp/pinpoint/flink/mapper/thrift/stat/JoinAgentStatBoMapper.java b/flink/src/main/java/com/navercorp/pinpoint/flink/mapper/thrift/stat/JoinAgentStatBoMapper.java deleted file mode 100644 index f27daeeb8ccb..000000000000 --- a/flink/src/main/java/com/navercorp/pinpoint/flink/mapper/thrift/stat/JoinAgentStatBoMapper.java +++ /dev/null @@ -1,79 +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.flink.mapper.thrift.stat; - -import com.google.common.collect.Iterables; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinAgentStatBo; -import com.navercorp.pinpoint.flink.mapper.thrift.ThriftBoMapper; -import com.navercorp.pinpoint.thrift.dto.flink.TFAgentStat; -import com.navercorp.pinpoint.thrift.dto.flink.TFAgentStatBatch; -import org.apache.commons.lang3.StringUtils; - -/** - * @author minwoo.jung - */ -public class JoinAgentStatBoMapper implements ThriftBoMapper { - private final ThriftStatMapper[] mappers = new ThriftStatMapper[] { - new JoinCpuLoadBoMapper(), - new JoinMemoryBoMapper(), - new JoinTransactionBoMapper(), - new JoinActiveTraceBoMapper(), - new JoinResponseTimeBoMapper(), - new JoinDataSourceListBoMapper(), - new JoinFileDescriptorBoMapper(), - new JoinDirectBufferBoMapper(), - new JoinTotalThreadCountBoMapper(), - new JoinLoadedClassBoMapper() - }; - - public JoinAgentStatBoMapper() { - } - - @Override - public JoinAgentStatBo map(TFAgentStatBatch tFAgentStatBatch) { - if (!tFAgentStatBatch.isSetAgentStats()) { - return JoinAgentStatBo.EMPTY_JOIN_AGENT_STAT_BO; - } - - if (StringUtils.isEmpty(tFAgentStatBatch.getAgentId())) { - return JoinAgentStatBo.EMPTY_JOIN_AGENT_STAT_BO; - } - - final String agentId = tFAgentStatBatch.getAgentId(); - final long startTimestamp = tFAgentStatBatch.getStartTimestamp(); - final long timeStamp = getTimeStamp(tFAgentStatBatch); - - JoinAgentStatBo.Builder builder = JoinAgentStatBo.newBuilder(agentId, startTimestamp, timeStamp); - for (TFAgentStat agentStat : tFAgentStatBatch.getAgentStats()) { - for (ThriftStatMapper mapper : mappers) { - mapper.build(agentStat, builder); - } - } - - return builder.build(); - } - - - private long getTimeStamp(TFAgentStatBatch joinAgentStatBo) { - final TFAgentStat first = Iterables.getFirst(joinAgentStatBo.getAgentStats(), null); - if (first == null) { - return Long.MIN_VALUE; - } - return first.getTimestamp(); - } - -} diff --git a/flink/src/main/java/com/navercorp/pinpoint/flink/mapper/thrift/stat/JoinCpuLoadBoMapper.java b/flink/src/main/java/com/navercorp/pinpoint/flink/mapper/thrift/stat/JoinCpuLoadBoMapper.java deleted file mode 100644 index 44ee14eb9855..000000000000 --- a/flink/src/main/java/com/navercorp/pinpoint/flink/mapper/thrift/stat/JoinCpuLoadBoMapper.java +++ /dev/null @@ -1,59 +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.flink.mapper.thrift.stat; - -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinAgentStatBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinCpuLoadBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinDoubleFieldBo; -import com.navercorp.pinpoint.thrift.dto.flink.TFAgentStat; -import com.navercorp.pinpoint.thrift.dto.flink.TFCpuLoad; - -/** - * @author minwoo.jung - */ -public class JoinCpuLoadBoMapper implements ThriftStatMapper { - - @Override - public JoinCpuLoadBo map(TFAgentStat tFAgentStat) { - if (!tFAgentStat.isSetCpuLoad()) { - return JoinCpuLoadBo.EMPTY_JOIN_CPU_LOAD_BO; - } - - JoinCpuLoadBo joinCpuLoadBo = new JoinCpuLoadBo(); - - final String agentId = tFAgentStat.getAgentId(); - joinCpuLoadBo.setId(agentId); - joinCpuLoadBo.setTimestamp(tFAgentStat.getTimestamp()); - - TFCpuLoad tFCpuLoad = tFAgentStat.getCpuLoad(); - final double jvmCpuLoad = tFCpuLoad.getJvmCpuLoad(); - joinCpuLoadBo.setJvmCpuLoadJoinValue(new JoinDoubleFieldBo(jvmCpuLoad, jvmCpuLoad, agentId, jvmCpuLoad, agentId)); - final double systemCpuLoad = tFCpuLoad.getSystemCpuLoad(); - joinCpuLoadBo.setSystemCpuLoadJoinValue(new JoinDoubleFieldBo(systemCpuLoad, systemCpuLoad, agentId, systemCpuLoad, agentId)); - return joinCpuLoadBo; - } - - @Override - public void build(TFAgentStat tFAgentStat, JoinAgentStatBo.Builder builder) { - JoinCpuLoadBo joinCpuLoadBo = this.map(tFAgentStat); - if (joinCpuLoadBo == JoinCpuLoadBo.EMPTY_JOIN_CPU_LOAD_BO) { - return; - } - - builder.addCpuLoadBo(joinCpuLoadBo); - } -} diff --git a/flink/src/main/java/com/navercorp/pinpoint/flink/mapper/thrift/stat/JoinDataSourceListBoMapper.java b/flink/src/main/java/com/navercorp/pinpoint/flink/mapper/thrift/stat/JoinDataSourceListBoMapper.java deleted file mode 100644 index eaf5c5d99957..000000000000 --- a/flink/src/main/java/com/navercorp/pinpoint/flink/mapper/thrift/stat/JoinDataSourceListBoMapper.java +++ /dev/null @@ -1,80 +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.flink.mapper.thrift.stat; - -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinAgentStatBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinDataSourceBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinDataSourceListBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinIntFieldBo; -import com.navercorp.pinpoint.thrift.dto.flink.TFAgentStat; -import com.navercorp.pinpoint.thrift.dto.flink.TFDataSource; -import com.navercorp.pinpoint.thrift.dto.flink.TFDataSourceList; - -import java.util.ArrayList; -import java.util.List; - -/** - * @author minwoo.jung - */ -public class JoinDataSourceListBoMapper implements ThriftStatMapper { - @Override - public JoinDataSourceListBo map(TFAgentStat tFAgentStat) { - if (!tFAgentStat.isSetDataSourceList()) { - return JoinDataSourceListBo.EMPTY_JOIN_DATA_SOURCE_LIST_BO; - } - - TFDataSourceList dataSourceList = tFAgentStat.getDataSourceList(); - if (!dataSourceList.isSetDataSourceList()) { - return JoinDataSourceListBo.EMPTY_JOIN_DATA_SOURCE_LIST_BO; - } - - List tFDataSourceList = dataSourceList.getDataSourceList(); - if (tFDataSourceList.isEmpty()) { - return JoinDataSourceListBo.EMPTY_JOIN_DATA_SOURCE_LIST_BO; - } - - - final String agentId = tFAgentStat.getAgentId(); - JoinDataSourceListBo joinDataSourceListBo = new JoinDataSourceListBo(); - joinDataSourceListBo.setId(agentId); - joinDataSourceListBo.setTimestamp(tFAgentStat.getTimestamp()); - - List joinDataSourceBoList = new ArrayList<>(); - for (TFDataSource tFDataSource : tFDataSourceList) { - JoinDataSourceBo joinDataSourceBo = new JoinDataSourceBo(); - joinDataSourceBo.setServiceTypeCode(tFDataSource.getServiceTypeCode()); - joinDataSourceBo.setUrl(tFDataSource.getUrl()); - final int activeConnectionSize = tFDataSource.getActiveConnectionSize(); - joinDataSourceBo.setActiveConnectionSizeJoinValue(new JoinIntFieldBo(activeConnectionSize, activeConnectionSize, agentId, activeConnectionSize, agentId)); - joinDataSourceBoList.add(joinDataSourceBo); - } - joinDataSourceListBo.setJoinDataSourceBoList(joinDataSourceBoList); - - return joinDataSourceListBo; - - } - - @Override - public void build(TFAgentStat tFAgentStat, JoinAgentStatBo.Builder builder) { - JoinDataSourceListBo joinDataSourceListBo = this.map(tFAgentStat); - - if (joinDataSourceListBo == JoinDataSourceListBo.EMPTY_JOIN_DATA_SOURCE_LIST_BO) { - return; - } - - builder.addDataSourceListBo(joinDataSourceListBo); - } -} diff --git a/flink/src/main/java/com/navercorp/pinpoint/flink/mapper/thrift/stat/JoinDirectBufferBoMapper.java b/flink/src/main/java/com/navercorp/pinpoint/flink/mapper/thrift/stat/JoinDirectBufferBoMapper.java deleted file mode 100644 index a4cc4d0c56e2..000000000000 --- a/flink/src/main/java/com/navercorp/pinpoint/flink/mapper/thrift/stat/JoinDirectBufferBoMapper.java +++ /dev/null @@ -1,68 +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.flink.mapper.thrift.stat; - -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinAgentStatBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinDirectBufferBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinLongFieldBo; -import com.navercorp.pinpoint.thrift.dto.flink.TFAgentStat; -import com.navercorp.pinpoint.thrift.dto.flink.TFDirectBuffer; - -/** - * @author Roy Kim - */ -public class JoinDirectBufferBoMapper implements ThriftStatMapper { - - @Override - public JoinDirectBufferBo map(TFAgentStat tFAgentStat) { - if (!tFAgentStat.isSetDirectBuffer()) { - return JoinDirectBufferBo.EMPTY_JOIN_DIRECT_BUFFER_BO; - } - - JoinDirectBufferBo joinDirectBufferBo = new JoinDirectBufferBo(); - - final String agentId = tFAgentStat.getAgentId(); - joinDirectBufferBo.setId(agentId); - joinDirectBufferBo.setTimestamp(tFAgentStat.getTimestamp()); - - TFDirectBuffer tFDirectBuffer = tFAgentStat.getDirectBuffer(); - final long directCount = tFDirectBuffer.getDirectCount(); - joinDirectBufferBo.setDirectCountJoinValue(new JoinLongFieldBo(directCount, directCount, agentId, directCount, agentId)); - - final long directMemoryUsed = tFDirectBuffer.getDirectMemoryUsed(); - joinDirectBufferBo.setDirectMemoryUsedJoinValue(new JoinLongFieldBo(directMemoryUsed, directMemoryUsed, agentId, directMemoryUsed, agentId)); - - final long mappedCount = tFDirectBuffer.getMappedCount(); - joinDirectBufferBo.setMappedCountJoinValue(new JoinLongFieldBo(mappedCount, mappedCount, agentId, mappedCount, agentId)); - - final long mappedMemoryUsed = tFDirectBuffer.getMappedMemoryUsed(); - joinDirectBufferBo.setMappedMemoryUsedJoinValue(new JoinLongFieldBo(mappedMemoryUsed, mappedMemoryUsed, agentId, mappedMemoryUsed, agentId)); - - return joinDirectBufferBo; - } - - @Override - public void build(TFAgentStat tFAgentStat, JoinAgentStatBo.Builder builder) { - JoinDirectBufferBo joinDirectBufferBo = this.map(tFAgentStat); - - if (joinDirectBufferBo == JoinDirectBufferBo.EMPTY_JOIN_DIRECT_BUFFER_BO) { - return; - } - - builder.addDirectBuffer(joinDirectBufferBo); - } -} diff --git a/flink/src/main/java/com/navercorp/pinpoint/flink/mapper/thrift/stat/JoinFileDescriptorBoMapper.java b/flink/src/main/java/com/navercorp/pinpoint/flink/mapper/thrift/stat/JoinFileDescriptorBoMapper.java deleted file mode 100644 index 8d1c0f71d10c..000000000000 --- a/flink/src/main/java/com/navercorp/pinpoint/flink/mapper/thrift/stat/JoinFileDescriptorBoMapper.java +++ /dev/null @@ -1,59 +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.flink.mapper.thrift.stat; - -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinAgentStatBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinFileDescriptorBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinLongFieldBo; -import com.navercorp.pinpoint.thrift.dto.flink.TFAgentStat; -import com.navercorp.pinpoint.thrift.dto.flink.TFFileDescriptor; - -/** - * @author Roy Kim - */ -public class JoinFileDescriptorBoMapper implements ThriftStatMapper { - - @Override - public JoinFileDescriptorBo map(TFAgentStat tFAgentStat) { - if (!tFAgentStat.isSetFileDescriptor()) { - return JoinFileDescriptorBo.EMPTY_JOIN_FILE_DESCRIPTOR_BO; - } - - JoinFileDescriptorBo joinFileDescriptorBo = new JoinFileDescriptorBo(); - - final String agentId = tFAgentStat.getAgentId(); - joinFileDescriptorBo.setId(agentId); - joinFileDescriptorBo.setTimestamp(tFAgentStat.getTimestamp()); - - TFFileDescriptor tFFileDescriptor = tFAgentStat.getFileDescriptor(); - final long openFileDescriptorCount = tFFileDescriptor.getOpenFileDescriptorCount(); - joinFileDescriptorBo.setOpenFdCountJoinValue(new JoinLongFieldBo(openFileDescriptorCount, openFileDescriptorCount, agentId, openFileDescriptorCount, agentId)); - - return joinFileDescriptorBo; - } - - @Override - public void build(TFAgentStat tFAgentStat, JoinAgentStatBo.Builder builder) { - JoinFileDescriptorBo joinFileDescriptorBo = this.map(tFAgentStat); - - if (joinFileDescriptorBo == JoinFileDescriptorBo.EMPTY_JOIN_FILE_DESCRIPTOR_BO) { - return; - } - - builder.addFileDescriptor(joinFileDescriptorBo); - } -} diff --git a/flink/src/main/java/com/navercorp/pinpoint/flink/mapper/thrift/stat/JoinLoadedClassBoMapper.java b/flink/src/main/java/com/navercorp/pinpoint/flink/mapper/thrift/stat/JoinLoadedClassBoMapper.java deleted file mode 100644 index 8d7cc8fc313a..000000000000 --- a/flink/src/main/java/com/navercorp/pinpoint/flink/mapper/thrift/stat/JoinLoadedClassBoMapper.java +++ /dev/null @@ -1,55 +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.flink.mapper.thrift.stat; - -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinAgentStatBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinLoadedClassBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinLongFieldBo; -import com.navercorp.pinpoint.thrift.dto.flink.TFAgentStat; - -public class JoinLoadedClassBoMapper implements ThriftStatMapper { - @Override - public JoinLoadedClassBo map(TFAgentStat thriftObject) { - if(!thriftObject.isSetLoadedClass()) { - return JoinLoadedClassBo.EMPTY_JOIN_LOADED_CLASS_BO; - } - JoinLoadedClassBo joinLoadedClassBo = new JoinLoadedClassBo(); - - final String agentId = thriftObject.getAgentId(); - final long loadedClass = thriftObject.getLoadedClass().getLoadedClassCount(); - final long unloadedClass = thriftObject.getLoadedClass().getUnloadedClassCount(); - - joinLoadedClassBo.setId(agentId); - joinLoadedClassBo.setTimestamp(thriftObject.getTimestamp()); - joinLoadedClassBo.setLoadedClassJoinValue(new JoinLongFieldBo(loadedClass, loadedClass, agentId, loadedClass, agentId)); - joinLoadedClassBo.setUnloadedClassJoinValue(new JoinLongFieldBo(unloadedClass, unloadedClass, agentId, unloadedClass, agentId)); - - return joinLoadedClassBo; - } - - - @Override - public void build(TFAgentStat tFAgentStat, JoinAgentStatBo.Builder builder) { - JoinLoadedClassBo joinLoadedClassBo = this.map(tFAgentStat); - - if (joinLoadedClassBo == JoinLoadedClassBo.EMPTY_JOIN_LOADED_CLASS_BO) { - return; - } - - builder.addLoadedClass(joinLoadedClassBo); - } -} diff --git a/flink/src/main/java/com/navercorp/pinpoint/flink/mapper/thrift/stat/JoinMemoryBoMapper.java b/flink/src/main/java/com/navercorp/pinpoint/flink/mapper/thrift/stat/JoinMemoryBoMapper.java deleted file mode 100644 index f74cfb0bc9ea..000000000000 --- a/flink/src/main/java/com/navercorp/pinpoint/flink/mapper/thrift/stat/JoinMemoryBoMapper.java +++ /dev/null @@ -1,60 +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.flink.mapper.thrift.stat; - -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinAgentStatBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinLongFieldBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinMemoryBo; -import com.navercorp.pinpoint.thrift.dto.flink.TFAgentStat; -import com.navercorp.pinpoint.thrift.dto.flink.TFJvmGc; - -/** - * @author minwoo.jung - */ -public class JoinMemoryBoMapper implements ThriftStatMapper { - - public JoinMemoryBo map(TFAgentStat tFAgentStat) { - if (!tFAgentStat.isSetGc()) { - return JoinMemoryBo.EMPTY_JOIN_MEMORY_BO; - } - - JoinMemoryBo joinMemoryBo = new JoinMemoryBo(); - joinMemoryBo.setId(tFAgentStat.getAgentId()); - - TFJvmGc memory = tFAgentStat.getGc(); - joinMemoryBo.setTimestamp(tFAgentStat.getTimestamp()); - - final String agentId = tFAgentStat.getAgentId(); - final long jvmMemoryHeapUsed = memory.getJvmMemoryHeapUsed(); - joinMemoryBo.setHeapUsedJoinValue(new JoinLongFieldBo(jvmMemoryHeapUsed, jvmMemoryHeapUsed, agentId, jvmMemoryHeapUsed, agentId)); - - final long jvmMemoryNonHeapUsed = memory.getJvmMemoryNonHeapUsed(); - joinMemoryBo.setNonHeapUsedJoinValue(new JoinLongFieldBo(jvmMemoryNonHeapUsed, jvmMemoryNonHeapUsed, agentId, jvmMemoryNonHeapUsed, agentId)); - - return joinMemoryBo; - } - - @Override - public void build(TFAgentStat tFAgentStat, JoinAgentStatBo.Builder builder) { - JoinMemoryBo joinMemoryBo = this.map(tFAgentStat); - - if (joinMemoryBo == JoinMemoryBo.EMPTY_JOIN_MEMORY_BO) { - return; - } - - builder.addMemory(joinMemoryBo); - } -} diff --git a/flink/src/main/java/com/navercorp/pinpoint/flink/mapper/thrift/stat/JoinResponseTimeBoMapper.java b/flink/src/main/java/com/navercorp/pinpoint/flink/mapper/thrift/stat/JoinResponseTimeBoMapper.java deleted file mode 100644 index ea3c91ab8227..000000000000 --- a/flink/src/main/java/com/navercorp/pinpoint/flink/mapper/thrift/stat/JoinResponseTimeBoMapper.java +++ /dev/null @@ -1,57 +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.flink.mapper.thrift.stat; - -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinAgentStatBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinLongFieldBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinResponseTimeBo; -import com.navercorp.pinpoint.thrift.dto.flink.TFAgentStat; -import com.navercorp.pinpoint.thrift.dto.flink.TFResponseTime; - -/** - * @author minwoo.jung - */ -public class JoinResponseTimeBoMapper implements ThriftStatMapper { - - public JoinResponseTimeBo map(TFAgentStat tFAgentStat) { - if (!tFAgentStat.isSetResponseTime()) { - return JoinResponseTimeBo.EMPTY_JOIN_RESPONSE_TIME_BO; - } - - final String agentId = tFAgentStat.getAgentId(); - final TFResponseTime tFResponseTime = tFAgentStat.getResponseTime(); - final long avg = tFResponseTime.getAvg(); - - JoinResponseTimeBo joinResponseTimeBo = new JoinResponseTimeBo(); - joinResponseTimeBo.setId(agentId); - joinResponseTimeBo.setTimestamp(tFAgentStat.getTimestamp()); - joinResponseTimeBo.setResponseTimeJoinValue(new JoinLongFieldBo(avg, avg, agentId, avg, agentId)); - - return joinResponseTimeBo; - } - - - @Override - public void build(TFAgentStat tFAgentStat, JoinAgentStatBo.Builder builder) { - JoinResponseTimeBo joinResponseTimeBo = this.map(tFAgentStat); - - if (joinResponseTimeBo == joinResponseTimeBo.EMPTY_JOIN_RESPONSE_TIME_BO) { - return; - } - - builder.addResponseTime(joinResponseTimeBo); - } -} diff --git a/flink/src/main/java/com/navercorp/pinpoint/flink/mapper/thrift/stat/JoinTotalThreadCountBoMapper.java b/flink/src/main/java/com/navercorp/pinpoint/flink/mapper/thrift/stat/JoinTotalThreadCountBoMapper.java deleted file mode 100644 index 2f80a11e630d..000000000000 --- a/flink/src/main/java/com/navercorp/pinpoint/flink/mapper/thrift/stat/JoinTotalThreadCountBoMapper.java +++ /dev/null @@ -1,50 +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.flink.mapper.thrift.stat; - -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinAgentStatBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinLongFieldBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinTotalThreadCountBo; -import com.navercorp.pinpoint.thrift.dto.flink.TFAgentStat; - -public class JoinTotalThreadCountBoMapper implements ThriftStatMapper { - @Override - public JoinTotalThreadCountBo map(TFAgentStat tFAgentStat) { - if(!tFAgentStat.isSetTotalThreadCount()) { - return JoinTotalThreadCountBo.EMPTY_TOTAL_THREAD_COUNT_BO; - } - JoinTotalThreadCountBo joinTotalThreadCountBo = new JoinTotalThreadCountBo(); - - final String agentId = tFAgentStat.getAgentId(); - final long totalThreadCount = tFAgentStat.getTotalThreadCount().getTotalThreadCount(); - joinTotalThreadCountBo.setId(agentId); - joinTotalThreadCountBo.setTimestamp(tFAgentStat.getTimestamp()); - joinTotalThreadCountBo.setTotalThreadCountJoinValue(new JoinLongFieldBo(totalThreadCount, totalThreadCount, agentId, totalThreadCount, agentId)); - return joinTotalThreadCountBo; - } - - @Override - public void build(TFAgentStat tFAgentStat, JoinAgentStatBo.Builder builder) { - JoinTotalThreadCountBo joinTotalThreadCountBo = this.map(tFAgentStat); - - if (joinTotalThreadCountBo == JoinTotalThreadCountBo.EMPTY_TOTAL_THREAD_COUNT_BO) { - return; - } - - builder.addTotalThreadCount(joinTotalThreadCountBo); - } -} diff --git a/flink/src/main/java/com/navercorp/pinpoint/flink/mapper/thrift/stat/JoinTransactionBoMapper.java b/flink/src/main/java/com/navercorp/pinpoint/flink/mapper/thrift/stat/JoinTransactionBoMapper.java deleted file mode 100644 index fa50f7033a18..000000000000 --- a/flink/src/main/java/com/navercorp/pinpoint/flink/mapper/thrift/stat/JoinTransactionBoMapper.java +++ /dev/null @@ -1,80 +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.flink.mapper.thrift.stat; - -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinAgentStatBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinLongFieldBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinTransactionBo; -import com.navercorp.pinpoint.thrift.dto.flink.TFAgentStat; -import com.navercorp.pinpoint.thrift.dto.flink.TFTransaction; -import org.apache.commons.math3.util.Precision; - -/** - * @author minwoo.jung - */ -public class JoinTransactionBoMapper implements ThriftStatMapper { - - @Override - public JoinTransactionBo map(TFAgentStat tFAgentStat) { - if (!tFAgentStat.isSetTransaction()) { - return JoinTransactionBo.EMPTY_JOIN_TRANSACTION_BO; - } - - TFTransaction tFtransaction = tFAgentStat.getTransaction(); - final long totalCount = calculateTotalCount(tFtransaction, tFAgentStat.getCollectInterval()); - final String agentId = tFAgentStat.getAgentId(); - - JoinTransactionBo joinTransactionBo = new JoinTransactionBo(); - joinTransactionBo.setId(agentId); - joinTransactionBo.setCollectInterval(tFAgentStat.getCollectInterval()); - joinTransactionBo.setTimestamp(tFAgentStat.getTimestamp()); - joinTransactionBo.setTotalCountJoinValue(new JoinLongFieldBo(totalCount, totalCount, agentId, totalCount, agentId)); - - return joinTransactionBo; - } - - private long calculateTotalCount(TFTransaction tFtransaction, long collectInterval) { - long totalCount = 0; - totalCount += tFtransaction.getSampledNewCount(); - totalCount += tFtransaction.getSampledContinuationCount(); - totalCount += tFtransaction.getUnsampledNewCount(); - totalCount += tFtransaction.getUnsampledContinuationCount(); - totalCount += tFtransaction.getSkippedNewCount(); - totalCount += tFtransaction.getSkippedContinuationCount(); - - totalCount = calculateAvgTotalCount(totalCount, collectInterval); - return totalCount; - } - - private static long calculateAvgTotalCount(long totalCount, long timeMs) { - if (totalCount <= 0) { - return totalCount; - } - - return (long) Precision.round(totalCount / (timeMs / 1000D), 1); - } - - @Override - public void build(TFAgentStat tFAgentStat, JoinAgentStatBo.Builder builder) { - JoinTransactionBo joinTransactionBo = this.map(tFAgentStat); - - if (joinTransactionBo == JoinTransactionBo.EMPTY_JOIN_TRANSACTION_BO) { - return; - } - - builder.addTransaction(joinTransactionBo); - } -} diff --git a/flink/src/main/java/com/navercorp/pinpoint/flink/mapper/thrift/stat/ThriftStatMapper.java b/flink/src/main/java/com/navercorp/pinpoint/flink/mapper/thrift/stat/ThriftStatMapper.java deleted file mode 100644 index e5dc53738247..000000000000 --- a/flink/src/main/java/com/navercorp/pinpoint/flink/mapper/thrift/stat/ThriftStatMapper.java +++ /dev/null @@ -1,29 +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.flink.mapper.thrift.stat; - -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinAgentStatBo; -import com.navercorp.pinpoint.flink.mapper.thrift.ThriftBoMapper; -import com.navercorp.pinpoint.thrift.dto.flink.TFAgentStat; -import org.apache.thrift.TBase; - -/** - * @author minwoo.jung - */ -public interface ThriftStatMapper> extends ThriftBoMapper { - - void build(TFAgentStat tFAgentStat, JoinAgentStatBo.Builder builder); -} diff --git a/flink/src/main/java/com/navercorp/pinpoint/flink/process/ApplicationCache.java b/flink/src/main/java/com/navercorp/pinpoint/flink/process/ApplicationCache.java deleted file mode 100644 index a74a91fd33a1..000000000000 --- a/flink/src/main/java/com/navercorp/pinpoint/flink/process/ApplicationCache.java +++ /dev/null @@ -1,128 +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.flink.process; - -import com.navercorp.pinpoint.common.hbase.HbaseTemplate; -import com.navercorp.pinpoint.common.hbase.TableNameProvider; -import com.navercorp.pinpoint.common.server.bo.AgentInfoBo; -import com.navercorp.pinpoint.common.server.bo.serializer.agent.AgentIdRowKeyEncoder; -import com.navercorp.pinpoint.common.server.dao.hbase.mapper.AgentInfoBoMapper; -import com.navercorp.pinpoint.flink.cache.FlinkCacheConfiguration; -import org.apache.hadoop.hbase.TableName; -import org.apache.hadoop.hbase.client.Get; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; -import org.springframework.cache.annotation.Cacheable; - -import java.util.Objects; - -import static com.navercorp.pinpoint.common.hbase.HbaseColumnFamily.AGENTINFO_INFO; - -/** - * @author minwoo.jung - */ -public class ApplicationCache { - private final Logger logger = LogManager.getLogger(this.getClass()); - - private static final String SPEL_KEY = "#application.getAgentId() + '.' + #application.getAgentStartTime()"; - public static final String NOT_FOUND_APP_ID = "notFoundId"; - - private final transient AgentInfoBoMapper agentInfoMapper = new AgentInfoBoMapper(); - - private final transient HbaseTemplate hbaseTemplate2; - - private final transient TableNameProvider tableNameProvider; - - private final AgentIdRowKeyEncoder rowKeyEncoder = new AgentIdRowKeyEncoder(); - - public ApplicationCache(HbaseTemplate hbaseTemplate2, TableNameProvider tableNameProvider) { - this.hbaseTemplate2 = Objects.requireNonNull(hbaseTemplate2, "hbaseTemplate"); - this.tableNameProvider = Objects.requireNonNull(tableNameProvider, "tableNameProvider"); - } - - @Cacheable(cacheNames = "applicationId", key = SPEL_KEY, cacheManager = FlinkCacheConfiguration.APPLICATION_ID_CACHE_NAME) - public String findApplicationId(ApplicationKey application) { - final String agentId = application.getAgentId(); - final long agentStartTimestamp = application.getAgentStartTime(); - final byte[] rowKey = rowKeyEncoder.encodeRowKey(agentId, agentStartTimestamp); - - Get get = new Get(rowKey); - - get.addColumn(AGENTINFO_INFO.getName(), AGENTINFO_INFO.QUALIFIER_IDENTIFIER); - AgentInfoBo agentInfo = null; - try { - TableName tableName = tableNameProvider.getTableName(AGENTINFO_INFO.getTable()); - agentInfo = hbaseTemplate2.get(tableName, get, agentInfoMapper); - } catch (Exception e) { - logger.error("can't found application id({}). {}", agentId, e.getMessage()); - } - - return getApplicationId(agentInfo, agentId); - } - - private String getApplicationId(AgentInfoBo agentInfo, String agentId) { - if (agentInfo == null) { - logger.warn("can't found application id : {}", agentId); - return NOT_FOUND_APP_ID; - } - return agentInfo.getApplicationName(); - } - - public static class ApplicationKey { - private final String agentId; - private final long agentStartTime; - - public ApplicationKey(String agentId, long agentStartTime) { - this.agentId = agentId; - this.agentStartTime = agentStartTime; - } - - public String getAgentId() { - return agentId; - } - - public long getAgentStartTime() { - return agentStartTime; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - ApplicationKey that = (ApplicationKey) o; - - if (agentStartTime != that.agentStartTime) return false; - return agentId != null ? agentId.equals(that.agentId) : that.agentId == null; - - } - - @Override - public int hashCode() { - int result = agentId != null ? agentId.hashCode() : 0; - result = 31 * result + (int) (agentStartTime ^ (agentStartTime >>> 32)); - return result; - } - - @Override - public String toString() { - return "ApplicationKey{" + - "agentId='" + agentId + '\'' + - ", agentStartTime=" + agentStartTime + - '}'; - } - } -} diff --git a/flink/src/main/java/com/navercorp/pinpoint/flink/process/DefaultTBaseFlatMapperInterceptor.java b/flink/src/main/java/com/navercorp/pinpoint/flink/process/DefaultTBaseFlatMapperInterceptor.java deleted file mode 100644 index 364ebf0d01fe..000000000000 --- a/flink/src/main/java/com/navercorp/pinpoint/flink/process/DefaultTBaseFlatMapperInterceptor.java +++ /dev/null @@ -1,41 +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.flink.process; - -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinStatBo; -import com.navercorp.pinpoint.flink.vo.RawData; -import org.apache.flink.api.java.tuple.Tuple3; - -import java.util.List; - -/** - * @author minwoo.jung - */ -public class DefaultTBaseFlatMapperInterceptor implements TBaseFlatMapperInterceptor { - - @Override - public void before(RawData rawData) { - } - - @Override - public void after() { - } - - @Override - public List> middle(List> outData) { - return outData; - } -} \ No newline at end of file diff --git a/flink/src/main/java/com/navercorp/pinpoint/flink/process/TBaseFlatMapper.java b/flink/src/main/java/com/navercorp/pinpoint/flink/process/TBaseFlatMapper.java deleted file mode 100644 index fabf79e35d18..000000000000 --- a/flink/src/main/java/com/navercorp/pinpoint/flink/process/TBaseFlatMapper.java +++ /dev/null @@ -1,151 +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.flink.process; - -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinAgentStatBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinApplicationStatBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinStatBo; -import com.navercorp.pinpoint.flink.Bootstrap; -import com.navercorp.pinpoint.flink.function.ApplicationStatBoWindow; -import com.navercorp.pinpoint.flink.mapper.thrift.stat.JoinAgentStatBoMapper; -import com.navercorp.pinpoint.flink.vo.RawData; -import com.navercorp.pinpoint.thrift.dto.flink.TFAgentStatBatch; -import org.apache.flink.api.common.ExecutionConfig.GlobalJobParameters; -import org.apache.flink.api.common.functions.RichFlatMapFunction; -import org.apache.flink.api.java.tuple.Tuple3; -import org.apache.flink.configuration.Configuration; -import org.apache.flink.util.Collector; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; -import org.apache.thrift.TBase; - -import java.io.Serial; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Date; -import java.util.List; - -/** - * @author minwoo.jung - */ -public class TBaseFlatMapper extends RichFlatMapFunction> { - - @Serial - private static final long serialVersionUID = 8646632121712637243L; - - private final static List> EMPTY_LIST = Collections.emptyList(); - - private final static Logger logger = LogManager.getLogger(TBaseFlatMapper.class); - - private transient JoinAgentStatBoMapper joinAgentStatBoMapper; - private transient ApplicationCache applicationCache; - private transient TBaseFlatMapperInterceptor tBaseFlatMapperInterceptor; - - - public TBaseFlatMapper() { - } - - public TBaseFlatMapper(JoinAgentStatBoMapper joinAgentStatBoMapper, ApplicationCache applicationCache, TBaseFlatMapperInterceptor tBaseFlatMapperInterceptor) { - this.joinAgentStatBoMapper = joinAgentStatBoMapper; - this.applicationCache = applicationCache; - this.tBaseFlatMapperInterceptor = tBaseFlatMapperInterceptor; - } - - public void open(Configuration parameters) throws Exception { - GlobalJobParameters globalJobParameters = getRuntimeContext().getExecutionConfig().getGlobalJobParameters(); - this.joinAgentStatBoMapper = new JoinAgentStatBoMapper(); - Bootstrap bootstrap = Bootstrap.getInstance(globalJobParameters.toMap()); - applicationCache = bootstrap.getApplicationCache(); - tBaseFlatMapperInterceptor = bootstrap.getTbaseFlatMapperInterceptor(); - } - - @Override - public void flatMap(RawData rawData, Collector> out) { - final TBase tBase = rawData.getData(); - if (tBase == null) { - logger.error("tBase is null"); - return; - } - - tBaseFlatMapperInterceptor.before(rawData); - - try { - List> outData = serverRequestFlatMap(tBase); - if (outData.isEmpty()) { - return; - } - - outData = tBaseFlatMapperInterceptor.middle(outData); - - for (Tuple3 tuple : outData) { - out.collect(tuple); - } - } finally { - tBaseFlatMapperInterceptor.after(); - } - } - - private List> serverRequestFlatMap(TBase tBase) { - List> outData = new ArrayList<>(5); - - if (tBase instanceof TFAgentStatBatch tFAgentStatBatch) { - if (logger.isDebugEnabled()) { - logger.debug("raw data : {}", tBase); - } - - final long time = new Date().getTime() + 3600000; - final JoinAgentStatBo joinAgentStatBo; - try { - joinAgentStatBo = joinAgentStatBoMapper.map(tFAgentStatBatch); - - if (joinAgentStatBo == JoinAgentStatBo.EMPTY_JOIN_AGENT_STAT_BO) { - return EMPTY_LIST; - } - - if (joinAgentStatBo.getTimestamp() >= time) { - logger.error("timestamp is too big !! {}" , joinAgentStatBo.toString()); - return EMPTY_LIST; - } - } catch (Exception e) { - logger.error("can't create joinAgentStatBo object {}", tFAgentStatBatch, e); - return EMPTY_LIST; - } - - outData.add(new Tuple3<>(joinAgentStatBo.getId(), joinAgentStatBo, joinAgentStatBo.getTimestamp())); - - final ApplicationCache.ApplicationKey applicationKey = new ApplicationCache.ApplicationKey(joinAgentStatBo.getId(), joinAgentStatBo.getAgentStartTimestamp()); - final String applicationId = applicationCache.findApplicationId(applicationKey); - - if (ApplicationCache.NOT_FOUND_APP_ID.equals(applicationId)) { - logger.warn("can't found application id. agent id : {}, start time : {}.", joinAgentStatBo.getId(), joinAgentStatBo.getAgentStartTimestamp()); - return EMPTY_LIST; - } - - List joinApplicationStatBoList = JoinApplicationStatBo.createJoinApplicationStatBo(applicationId, joinAgentStatBo, ApplicationStatBoWindow.WINDOW_SIZE); - - for (JoinApplicationStatBo joinApplicationStatBo : joinApplicationStatBoList) { - if (joinApplicationStatBo.getTimestamp() >= time) { - logger.error("timestamp is too big !! {}" , joinApplicationStatBo.toString()); - return EMPTY_LIST; - } - outData.add(new Tuple3<>(applicationId, joinApplicationStatBo, joinApplicationStatBo.getTimestamp())); - } - } - - return outData; - } - -} \ No newline at end of file diff --git a/flink/src/main/java/com/navercorp/pinpoint/flink/process/TBaseFlatMapperInterceptor.java b/flink/src/main/java/com/navercorp/pinpoint/flink/process/TBaseFlatMapperInterceptor.java deleted file mode 100644 index dd17b09fd850..000000000000 --- a/flink/src/main/java/com/navercorp/pinpoint/flink/process/TBaseFlatMapperInterceptor.java +++ /dev/null @@ -1,34 +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.flink.process; - -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinStatBo; -import com.navercorp.pinpoint.flink.vo.RawData; -import org.apache.flink.api.java.tuple.Tuple3; - -import java.util.List; - -/** - * @author minwoo.jung - */ -public interface TBaseFlatMapperInterceptor { - - void before(RawData rawData); - - void after(); - - List> middle(List> outData); -} \ No newline at end of file diff --git a/flink/src/main/java/com/navercorp/pinpoint/flink/receiver/AgentStatHandler.java b/flink/src/main/java/com/navercorp/pinpoint/flink/receiver/AgentStatHandler.java deleted file mode 100644 index d7ee7abe055f..000000000000 --- a/flink/src/main/java/com/navercorp/pinpoint/flink/receiver/AgentStatHandler.java +++ /dev/null @@ -1,53 +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.flink.receiver; - - -import com.navercorp.pinpoint.collector.handler.SimpleHandler; -import com.navercorp.pinpoint.flink.vo.RawData; -import com.navercorp.pinpoint.io.request.ServerRequest; -import org.apache.flink.streaming.api.functions.source.SourceFunction.SourceContext; -import org.apache.thrift.TBase; -import org.apache.logging.log4j.Logger; -import org.apache.logging.log4j.LogManager; - -import java.util.HashMap; -import java.util.Map; - - -/** - * @author minwoo.jung - */ -public class AgentStatHandler extends SourceContextManager implements SimpleHandler> { - - private final Logger logger = LogManager.getLogger(this.getClass()); - - @Override - public void handleSimple(ServerRequest> serverRequest) { - final TBase tBase = serverRequest.getData(); - final Map metaInfo = new HashMap<>(serverRequest.getHeaderEntity().getEntityAll()); - final RawData rawData = new RawData(tBase, metaInfo); - final SourceContext sourceContext = roundRobinSourceContext(); - - if (sourceContext == null) { - logger.warn("sourceContext is null."); - return; - } - - sourceContext.collect(rawData); - - } -} diff --git a/flink/src/main/java/com/navercorp/pinpoint/flink/receiver/FlinkPacketHandlerFactory.java b/flink/src/main/java/com/navercorp/pinpoint/flink/receiver/FlinkPacketHandlerFactory.java deleted file mode 100644 index 6b50b2b70f9a..000000000000 --- a/flink/src/main/java/com/navercorp/pinpoint/flink/receiver/FlinkPacketHandlerFactory.java +++ /dev/null @@ -1,57 +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.flink.receiver; - -import com.navercorp.pinpoint.collector.receiver.DispatchHandler; -import com.navercorp.pinpoint.collector.receiver.thrift.tcp.DefaultTCPPacketHandler; -import com.navercorp.pinpoint.collector.receiver.thrift.tcp.TCPPacketHandler; -import com.navercorp.pinpoint.collector.receiver.thrift.tcp.TCPPacketHandlerFactory; -import com.navercorp.pinpoint.thrift.io.DeserializerFactory; -import com.navercorp.pinpoint.thrift.io.HeaderTBaseDeserializer; -import com.navercorp.pinpoint.thrift.io.HeaderTBaseDeserializerFactory; -import com.navercorp.pinpoint.thrift.io.HeaderTBaseSerializer; -import com.navercorp.pinpoint.thrift.io.HeaderTBaseSerializerFactory; -import com.navercorp.pinpoint.thrift.io.SerializerFactory; -import com.navercorp.pinpoint.thrift.io.ThreadLocalHeaderTBaseDeserializerFactory; -import com.navercorp.pinpoint.thrift.io.ThreadLocalHeaderTBaseSerializerFactory; -import org.apache.thrift.TBase; - -import java.util.Objects; - -/** - * @author Woonduk Kang(emeroad) - */ -public class FlinkPacketHandlerFactory implements TCPPacketHandlerFactory, TBase> { - - private final SerializerFactory cachedSerializer; - private final DeserializerFactory cachedDeserializer; - - public FlinkPacketHandlerFactory(HeaderTBaseSerializerFactory flinkHeaderTBaseSerializerFactory, HeaderTBaseDeserializerFactory flinkHeaderTBaseDeserializerFactory) { - Objects.requireNonNull(flinkHeaderTBaseSerializerFactory, "flinkHeaderTBaseSerializerFactory"); - Objects.requireNonNull(flinkHeaderTBaseDeserializerFactory, "flinkHeaderTBaseDeserializerFactory"); - - this.cachedSerializer = new ThreadLocalHeaderTBaseSerializerFactory<>(flinkHeaderTBaseSerializerFactory); - - this.cachedDeserializer = new ThreadLocalHeaderTBaseDeserializerFactory<>(flinkHeaderTBaseDeserializerFactory); - } - - @Override - public TCPPacketHandler build(DispatchHandler, TBase> dispatchHandler) { - Objects.requireNonNull(dispatchHandler, "dispatchHandler"); - return new DefaultTCPPacketHandler(dispatchHandler, cachedSerializer, cachedDeserializer); - } -} \ No newline at end of file diff --git a/flink/src/main/java/com/navercorp/pinpoint/flink/receiver/SourceContextManager.java b/flink/src/main/java/com/navercorp/pinpoint/flink/receiver/SourceContextManager.java deleted file mode 100644 index 24e13a495c17..000000000000 --- a/flink/src/main/java/com/navercorp/pinpoint/flink/receiver/SourceContextManager.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 2019 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.flink.receiver; - -import org.apache.flink.streaming.api.functions.source.SourceFunction; -import org.apache.logging.log4j.Logger; -import org.apache.logging.log4j.LogManager; - -import java.util.List; -import java.util.concurrent.CopyOnWriteArrayList; -import java.util.concurrent.atomic.AtomicInteger; - -/** - * @author minwoo.jung - */ -public abstract class SourceContextManager { - - private final Logger logger = LogManager.getLogger(this.getClass()); - - private final List sourceContextList = new CopyOnWriteArrayList<>(); - private final AtomicInteger callCount = new AtomicInteger(1); - - public void addSourceContext(SourceFunction.SourceContext sourceContext) { - logger.info("add sourceContext."); - sourceContextList.add(sourceContext); - } - - protected SourceFunction.SourceContext roundRobinSourceContext() { - if (sourceContextList.isEmpty()) { - logger.warn("sourceContextList is empty."); - return null; - } - - int count = callCount.getAndIncrement(); - int sourceContextListIndex = count % sourceContextList.size(); - - if (sourceContextListIndex < 0) { - sourceContextListIndex = sourceContextListIndex * -1; - callCount.set(0); - } - - try { - return sourceContextList.get(sourceContextListIndex); - } catch (Exception e) { - logger.warn("not get sourceContext", e); - } - - return null; - } -} diff --git a/flink/src/main/java/com/navercorp/pinpoint/flink/receiver/TcpDispatchHandler.java b/flink/src/main/java/com/navercorp/pinpoint/flink/receiver/TcpDispatchHandler.java deleted file mode 100644 index 058edf1b30dc..000000000000 --- a/flink/src/main/java/com/navercorp/pinpoint/flink/receiver/TcpDispatchHandler.java +++ /dev/null @@ -1,59 +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.flink.receiver; - -import com.navercorp.pinpoint.collector.handler.SimpleHandler; -import com.navercorp.pinpoint.collector.receiver.DispatchHandler; -import com.navercorp.pinpoint.io.header.Header; -import com.navercorp.pinpoint.io.request.ServerRequest; -import com.navercorp.pinpoint.io.request.ServerResponse; -import com.navercorp.pinpoint.thrift.io.FlinkTBaseLocator; - -import java.util.Objects; - -/** - * @author minwoo.jung - */ -public class TcpDispatchHandler implements DispatchHandler { - - private SimpleHandler simpleHandler; - - private SimpleHandler getSimpleHandler(Header header) { - if (header.getType() == FlinkTBaseLocator.AGENT_STAT_BATCH) { - return simpleHandler; - } - throw new UnsupportedOperationException("unsupported header:" + header); - } - - private SimpleHandler getSimpleHandler(ServerRequest serverRequest) { - final Header header = serverRequest.getHeader(); - return getSimpleHandler(header); - } - - public void setSimpletHandler(SimpleHandler simpleHandler) { - this.simpleHandler = Objects.requireNonNull(simpleHandler, "agentStatHandler"); - } - - @Override - public void dispatchSendMessage(ServerRequest serverRequest) { - SimpleHandler simpleHandler = getSimpleHandler(serverRequest); - simpleHandler.handleSimple(serverRequest); - } - - @Override - public void dispatchRequestMessage(ServerRequest serverRequest, ServerResponse serverResponse) { - } -} diff --git a/flink/src/main/java/com/navercorp/pinpoint/flink/receiver/TcpSourceFunction.java b/flink/src/main/java/com/navercorp/pinpoint/flink/receiver/TcpSourceFunction.java deleted file mode 100644 index 34d3f92aa8c7..000000000000 --- a/flink/src/main/java/com/navercorp/pinpoint/flink/receiver/TcpSourceFunction.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright 2014 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.flink.receiver; - -import com.navercorp.pinpoint.flink.Bootstrap; -import com.navercorp.pinpoint.flink.vo.RawData; -import org.apache.flink.api.common.ExecutionConfig.GlobalJobParameters; -import org.apache.flink.configuration.Configuration; -import org.apache.flink.streaming.api.functions.source.RichParallelSourceFunction; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -import java.io.Serial; - -/** - * @author minwoo.jung - */ -public class TcpSourceFunction extends RichParallelSourceFunction { - - @Serial - private static final long serialVersionUID = -1605300070500115073L; - - private final Logger logger = LogManager.getLogger(TcpSourceFunction.class); - private transient GlobalJobParameters globalJobParameters; - - - @Override - public void open(Configuration parameters) throws Exception { - globalJobParameters = getRuntimeContext().getExecutionConfig().getGlobalJobParameters(); - } - - @Override - public void run(SourceContext ctx) throws Exception { - final Bootstrap bootstrap = Bootstrap.getInstance(globalJobParameters.toMap()); - bootstrap.setStatHandlerTcpDispatchHandler(ctx); - bootstrap.initFlinkServerRegister(); - bootstrap.initTcpReceiver(); - - Thread.sleep(Long.MAX_VALUE); - } - - @Override - public void cancel() { - logger.info("cancel TcpSourceFunction."); - Bootstrap.close(); - } -} \ No newline at end of file diff --git a/flink/src/main/java/com/navercorp/pinpoint/flink/vo/RawData.java b/flink/src/main/java/com/navercorp/pinpoint/flink/vo/RawData.java deleted file mode 100644 index 3394bb677b56..000000000000 --- a/flink/src/main/java/com/navercorp/pinpoint/flink/vo/RawData.java +++ /dev/null @@ -1,44 +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.flink.vo; - -import org.apache.thrift.TBase; - -import java.util.Map; -import java.util.Objects; - -/** - * @author minwoo.jung - */ -public class RawData { - - private final TBase data; - private final Map metaInfo; - - public RawData(TBase data, Map metaInfo) { - this.data = Objects.requireNonNull(data, "data"); - this.metaInfo = Objects.requireNonNull(metaInfo, "metaInfo"); - } - - public TBase getData() { - return data; - } - - public String getMetaInfo(String key) { - return metaInfo.get(key); - } - -} diff --git a/flink/src/main/java/org/apache/hbase/thirdparty/io/netty/buffer/PoolArenaCleaner.java b/flink/src/main/java/org/apache/hbase/thirdparty/io/netty/buffer/PoolArenaCleaner.java deleted file mode 100644 index 12ce6760148b..000000000000 --- a/flink/src/main/java/org/apache/hbase/thirdparty/io/netty/buffer/PoolArenaCleaner.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright 2023 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 org.apache.hbase.thirdparty.io.netty.buffer; - -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -import java.lang.reflect.Field; - -/** - * @author youngjin.kim2 - */ -public class PoolArenaCleaner { - - private static final Logger logger = LogManager.getLogger(PoolArenaCleaner.class); - - @SuppressWarnings("FinalizeCalledExplicitly") - public static void finalizeExplicitly() { - try { - logger.info("Destroying netty direct buffer chunks"); - final PooledByteBufAllocator allocator = PooledByteBufAllocator.DEFAULT; - final PoolArena[] arenas = getDirectBufferArenas(allocator); - for (final PoolArena arena: arenas) { - if (arena != null) { - arena.finalize(); - } - } - } catch (Throwable e) { - logger.warn("Failed to destroy netty direct buffer chunks", e); - } - } - - private static PoolArena[] getDirectBufferArenas(PooledByteBufAllocator allocator) throws Exception { - final Field directArenasField = PooledByteBufAllocator.class.getDeclaredField("directArenas"); - directArenasField.setAccessible(true); - final Object arenas = directArenasField.get(allocator); - if (arenas instanceof PoolArena[]) { - return (PoolArena[]) arenas; - } else { - throw new RuntimeException("Invalid field: directArenas"); - } - } - -} diff --git a/flink/src/main/resources/applicationContext-flink-extend.xml b/flink/src/main/resources/applicationContext-flink-extend.xml deleted file mode 100644 index 9f482d1dcd6c..000000000000 --- a/flink/src/main/resources/applicationContext-flink-extend.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/flink/src/main/resources/applicationContext-flink.xml b/flink/src/main/resources/applicationContext-flink.xml deleted file mode 100644 index df387b35b6d8..000000000000 --- a/flink/src/main/resources/applicationContext-flink.xml +++ /dev/null @@ -1,105 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/flink/src/main/resources/applicationContext-hbase.xml b/flink/src/main/resources/applicationContext-hbase.xml deleted file mode 100644 index e70684f6977b..000000000000 --- a/flink/src/main/resources/applicationContext-hbase.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/flink/src/main/resources/log4j2.xml b/flink/src/main/resources/log4j2.xml deleted file mode 100644 index 5622e312567b..000000000000 --- a/flink/src/main/resources/log4j2.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - %d{MM-dd HH:mm:ss.sss} [%15.15t] %clr{%-5level} %clr{%-40.40logger{1.}}{cyan}:%3L -- %msg%n - %d{MM-dd HH:mm:ss.sss} [%15.15t] %-5level %-40.40logger{1.}:%3L -- %msg%n - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/flink/src/main/resources/profiles/.gitignore b/flink/src/main/resources/profiles/.gitignore deleted file mode 100644 index 6a94e57191ca..000000000000 --- a/flink/src/main/resources/profiles/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -# for custom profile -!local/ -!release/ -**/ \ No newline at end of file diff --git a/flink/src/main/resources/profiles/local/hbase.properties b/flink/src/main/resources/profiles/local/hbase.properties deleted file mode 100644 index eddd3e609ab9..000000000000 --- a/flink/src/main/resources/profiles/local/hbase.properties +++ /dev/null @@ -1,30 +0,0 @@ -hbase.client.host=localhost -hbase.client.port=2181 - -# hbase default:/hbase -hbase.client.znode=/hbase - -# hbase namespace to use default:default -hbase.namespace=default - -# hbase timeout option================================================================================== -# hbase default:true -hbase.client.properties.hbase.ipc.client.tcpnodelay=true -# hbase default:60000 -hbase.client.properties.hbase.rpc.timeout=10000 -# hbase default:Integer.MAX_VALUE -hbase.client.properties.hbase.client.operation.timeout=10000 -# hbase default: 20m -hbase.client.properties.hbase.client.meta.operation.timeout=10000 - -# hbase socket read timeout. default: 200000 -hbase.client.properties.hbase.ipc.client.socket.timeout.read=20000 -# socket write timeout. hbase default: 600000 -hbase.client.properties.hbase.ipc.client.socket.timeout.write=30000 - -#================================================================================== -# hbase client thread pool option -hbase.client.executor.corePoolSize=16 -hbase.client.executor.maxPoolSize=128 -hbase.client.executor.queueCapacity=5120 -hbase.client.executor.prestartAllCoreThreads=false \ No newline at end of file diff --git a/flink/src/main/resources/profiles/local/pinpoint-flink.properties b/flink/src/main/resources/profiles/local/pinpoint-flink.properties deleted file mode 100644 index 8febc00bedea..000000000000 --- a/flink/src/main/resources/profiles/local/pinpoint-flink.properties +++ /dev/null @@ -1,43 +0,0 @@ -# configure l4 ip address to ignore health check logs -collector.l4.ip= - -# base data receiver config --------------------------------------------------------------------- -flink.receiver.base.ip=0.0.0.0 -flink.receiver.base.port=19994 - -# number of tcp worker threads -flink.receiver.base.worker.corePoolSize=8 -flink.receiver.base.worker.maxPoolSize=8 -# capacity of tcp worker queue -flink.receiver.base.worker.queueCapacity=1024 -# monitoring for tcp worker -flink.receiver.base.worker.monitor=true - -# change OS level read/write socket buffer size (for linux) -#sudo sysctl -w net.core.rmem_max= -#sudo sysctl -w net.core.wmem_max= -# check current values using: -#$ /sbin/sysctl -a | grep -e rmem -e wmem - -# number of agent event worker threads -collector.agentEventWorker.corePoolSize=4 -collector.agentEventWorker.maxPoolSize=4 -# capacity of agent event worker queue -collector.agentEventWorker.queueCapacity=1024 - -#collector.admin.password= -#collector.admin.api.rest.active= -#collector.admin.api.jmx.active= - -collector.spanEvent.sequence.limit=10000 - -# flink cluster -flink.cluster.enable=true -flink.cluster.zookeeper.address=localhost -flink.cluster.zookeeper.znode_root=/pinpoint-cluster -flink.cluster.zookeeper.sessiontimeout=3000 -flink.cluster.zookeeper.retry.interval=5000 -flink.cluster.tcp.port=19994 - -# flink env init -flink.StreamExecutionEnvironment=local \ No newline at end of file diff --git a/flink/src/main/resources/profiles/release/hbase.properties b/flink/src/main/resources/profiles/release/hbase.properties deleted file mode 100644 index 8252a629fd4e..000000000000 --- a/flink/src/main/resources/profiles/release/hbase.properties +++ /dev/null @@ -1,29 +0,0 @@ -hbase.client.host=localhost -hbase.client.port=2181 - -# hbase default:/hbase -hbase.client.znode=/hbase - -# hbase namespace to use default:default -hbase.namespace=default - -# hbase timeout option================================================================================== -# hbase default:true -hbase.client.properties.hbase.ipc.client.tcpnodelay=true -# hbase default:60000 -hbase.client.properties.hbase.rpc.timeout=10000 -# hbase default:Integer.MAX_VALUE -hbase.client.properties.hbase.client.operation.timeout=10000 -# hbase default: 20m -hbase.client.properties.hbase.client.meta.operation.timeout=10000 - -# hbase socket read timeout. default: 200000 -hbase.client.properties.hbase.ipc.client.socket.timeout.read=20000 -# socket write timeout. hbase default: 600000 -hbase.client.properties.hbase.ipc.client.socket.timeout.write=30000 - -#================================================================================== -# hbase client thread pool option -hbase.client.executor.corePoolSize=128 -hbase.client.executor.maxPoolSize=128 -hbase.client.executor.queueCapacity=5120 diff --git a/flink/src/main/resources/profiles/release/pinpoint-flink.properties b/flink/src/main/resources/profiles/release/pinpoint-flink.properties deleted file mode 100644 index 51e5ed3915b5..000000000000 --- a/flink/src/main/resources/profiles/release/pinpoint-flink.properties +++ /dev/null @@ -1,43 +0,0 @@ -# configure l4 ip address to ignore health check logs -collector.l4.ip= - -# base data receiver config --------------------------------------------------------------------- -flink.receiver.base.ip=0.0.0.0 -flink.receiver.base.port=19994 - -# number of tcp worker threads -flink.receiver.base.worker.corePoolSize=8 -flink.receiver.base.worker.maxPoolSize=8 -# capacity of tcp worker queue -flink.receiver.base.worker.queueCapacity=1024 -# monitoring for tcp worker -flink.receiver.base.worker.monitor=true - -# change OS level read/write socket buffer size (for linux) -#sudo sysctl -w net.core.rmem_max= -#sudo sysctl -w net.core.wmem_max= -# check current values using: -#$ /sbin/sysctl -a | grep -e rmem -e wmem - -# number of agent event worker threads -collector.agentEventWorker.corePoolSize=4 -collector.agentEventWorker.maxPoolSize=4 -# capacity of agent event worker queue -collector.agentEventWorker.queueCapacity=1024 - -#collector.admin.password= -#collector.admin.api.rest.active= -#collector.admin.api.jmx.active= - -collector.spanEvent.sequence.limit=10000 - -# flink cluster -flink.cluster.enable=true -flink.cluster.zookeeper.address=localhost -flink.cluster.zookeeper.znode_root=/pinpoint-cluster -flink.cluster.zookeeper.sessiontimeout=3000 -flink.cluster.zookeeper.retry.interval=5000 -flink.cluster.tcp.port=19994 - -# flink env init -flink.StreamExecutionEnvironment=server \ No newline at end of file diff --git a/flink/src/main/resources/spring.properties b/flink/src/main/resources/spring.properties deleted file mode 100644 index 5cf0f959ec13..000000000000 --- a/flink/src/main/resources/spring.properties +++ /dev/null @@ -1 +0,0 @@ -spring.jndi.ignore=true \ No newline at end of file diff --git a/flink/src/test/java/com/navercorp/pinpoint/flink/config/DataReceiverPropertiesTest.java b/flink/src/test/java/com/navercorp/pinpoint/flink/config/DataReceiverPropertiesTest.java deleted file mode 100644 index b2073025da3e..000000000000 --- a/flink/src/test/java/com/navercorp/pinpoint/flink/config/DataReceiverPropertiesTest.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.navercorp.pinpoint.flink.config; - -import com.navercorp.pinpoint.common.server.thread.MonitoringExecutorProperties; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.boot.context.properties.EnableConfigurationProperties; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.TestPropertySource; -import org.springframework.test.context.junit.jupiter.SpringExtension; -import org.springframework.validation.annotation.Validated; - - -@TestPropertySource(properties = { - "flink.receiver.base.ip:0.0.0.2", - "flink.receiver.base.port:39994", - - "flink.receiver.base.worker.corePoolSize:33", - "flink.receiver.base.worker.maxPoolSize:32", - "flink.receiver.base.worker.queueCapacity:29", - "flink.receiver.base.worker.monitor-enable:true", - -}) -@ContextConfiguration(classes = { - DataReceiverProperties.class, - DataReceiverPropertiesTest.DataReceiverTestConfig.class -}) -@ExtendWith(SpringExtension.class) -class DataReceiverPropertiesTest { - - @Configuration - @EnableConfigurationProperties - static class DataReceiverTestConfig { - @Bean - @Validated - @ConfigurationProperties("flink.receiver.base.worker") - public MonitoringExecutorProperties flinkWorkerExecutorProperties() { - return new MonitoringExecutorProperties(); - } - } - - @Autowired - DataReceiverProperties properties; - @Autowired - MonitoringExecutorProperties executorProperties; - - @Test - public void properties() { - Assertions.assertEquals("0.0.0.2", properties.getBindIp()); - Assertions.assertEquals(39994, properties.getBindPort()); - Assertions.assertEquals(33, executorProperties.getCorePoolSize()); - Assertions.assertEquals(32, executorProperties.getMaxPoolSize()); - Assertions.assertEquals(29, executorProperties.getQueueCapacity()); - Assertions.assertTrue(executorProperties.isMonitorEnable()); - } - -} \ No newline at end of file diff --git a/flink/src/test/java/com/navercorp/pinpoint/flink/config/FlinkPropertiesTest.java b/flink/src/test/java/com/navercorp/pinpoint/flink/config/FlinkPropertiesTest.java deleted file mode 100644 index 04a2002ce317..000000000000 --- a/flink/src/test/java/com/navercorp/pinpoint/flink/config/FlinkPropertiesTest.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2019 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.flink.config; - -import com.navercorp.pinpoint.common.server.cluster.zookeeper.config.ClusterConfigurationFactory; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit.jupiter.SpringExtension; - - -/** - * @author Woonduk Kang(emeroad) - */ -@ContextConfiguration(classes = { FlinkProperties.class, ClusterConfigurationFactory.class}) -@ExtendWith(SpringExtension.class) -public class FlinkPropertiesTest { - @Autowired - private FlinkProperties flinkProperties; - - @Test - public void log() { - flinkProperties.log(); - } - -} \ No newline at end of file diff --git a/flink/src/test/java/com/navercorp/pinpoint/flink/mapper/thrift/stat/JoinAgentStatBoMapperTest.java b/flink/src/test/java/com/navercorp/pinpoint/flink/mapper/thrift/stat/JoinAgentStatBoMapperTest.java deleted file mode 100644 index d63433bf5350..000000000000 --- a/flink/src/test/java/com/navercorp/pinpoint/flink/mapper/thrift/stat/JoinAgentStatBoMapperTest.java +++ /dev/null @@ -1,442 +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.flink.mapper.thrift.stat; - -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinActiveTraceBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinAgentStatBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinCpuLoadBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinDoubleFieldBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinIntFieldBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinLoadedClassBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinLongFieldBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinMemoryBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinResponseTimeBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinTotalThreadCountBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinTransactionBo; -import com.navercorp.pinpoint.thrift.dto.flink.TFActiveTrace; -import com.navercorp.pinpoint.thrift.dto.flink.TFActiveTraceHistogram; -import com.navercorp.pinpoint.thrift.dto.flink.TFAgentStat; -import com.navercorp.pinpoint.thrift.dto.flink.TFAgentStatBatch; -import com.navercorp.pinpoint.thrift.dto.flink.TFCpuLoad; -import com.navercorp.pinpoint.thrift.dto.flink.TFJvmGc; -import com.navercorp.pinpoint.thrift.dto.flink.TFLoadedClass; -import com.navercorp.pinpoint.thrift.dto.flink.TFResponseTime; -import com.navercorp.pinpoint.thrift.dto.flink.TFTotalThreadCount; -import com.navercorp.pinpoint.thrift.dto.flink.TFTransaction; -import org.junit.jupiter.api.Test; - -import java.util.List; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * @author minwoo.jung - */ -public class JoinAgentStatBoMapperTest { - - @Test - public void mapTest() { - final String agentId = "testAgent"; - final JoinAgentStatBoMapper joinAgentStatBoMapper = new JoinAgentStatBoMapper(); - - final TFAgentStatBatch tFAgentStatBatch = new TFAgentStatBatch(); - tFAgentStatBatch.setStartTimestamp(1491274138454L); - tFAgentStatBatch.setAgentId(agentId); - - final TFAgentStat tFAgentStat = new TFAgentStat(); - tFAgentStat.setAgentId(agentId); - tFAgentStat.setTimestamp(1491274148454L); - - final TFCpuLoad tFCpuLoad = new TFCpuLoad(); - tFCpuLoad.setJvmCpuLoad(10); - tFCpuLoad.setSystemCpuLoad(30); - tFAgentStat.setCpuLoad(tFCpuLoad); - - final TFAgentStat tFAgentStat2 = new TFAgentStat(); - tFAgentStat2.setAgentId(agentId); - tFAgentStat2.setTimestamp(1491275148454L); - - final TFCpuLoad tFCpuLoad2 = new TFCpuLoad(); - tFCpuLoad2.setJvmCpuLoad(20); - tFCpuLoad2.setSystemCpuLoad(50); - tFAgentStat2.setCpuLoad(tFCpuLoad2); - - final List tFAgentStatList = List.of( - tFAgentStat, tFAgentStat2 - ); - tFAgentStatBatch.setAgentStats(tFAgentStatList); - - JoinAgentStatBo joinAgentStatBo = joinAgentStatBoMapper.map(tFAgentStatBatch); - assertEquals(joinAgentStatBo.getId(), agentId); - assertEquals(joinAgentStatBo.getAgentStartTimestamp(), 1491274138454L); - assertEquals(joinAgentStatBo.getTimestamp(), 1491274148454L); - - List joinCpuLoadBoList = joinAgentStatBo.getJoinCpuLoadBoList(); - assertThat(joinCpuLoadBoList).hasSize(2); - - JoinCpuLoadBo joinCpuLoadBo = joinCpuLoadBoList.get(0); - assertEquals(joinCpuLoadBo.getId(), agentId); - assertEquals(joinCpuLoadBo.getTimestamp(), 1491274148454L); - - JoinDoubleFieldBo jvmCpuLoadJoinValue = joinCpuLoadBo.getJvmCpuLoadJoinValue(); - assertEquals(jvmCpuLoadJoinValue.getAvg(), 10, 0); - assertEquals(jvmCpuLoadJoinValue.getMin(), 10, 0); - assertEquals(jvmCpuLoadJoinValue.getMax(), 10, 0); - JoinDoubleFieldBo systemCpuLoadJoinValue = joinCpuLoadBo.getSystemCpuLoadJoinValue(); - assertEquals(systemCpuLoadJoinValue.getAvg(), 30, 0); - assertEquals(systemCpuLoadJoinValue.getMin(), 30, 0); - assertEquals(systemCpuLoadJoinValue.getMax(), 30, 0); - - joinCpuLoadBo = joinCpuLoadBoList.get(1); - assertEquals(joinCpuLoadBo.getId(), agentId); - assertEquals(joinCpuLoadBo.getTimestamp(), 1491275148454L); - jvmCpuLoadJoinValue = joinCpuLoadBo.getJvmCpuLoadJoinValue(); - assertEquals(jvmCpuLoadJoinValue.getAvg(), 20, 0); - assertEquals(jvmCpuLoadJoinValue.getMin(), 20, 0); - assertEquals(jvmCpuLoadJoinValue.getMax(), 20, 0); - systemCpuLoadJoinValue = joinCpuLoadBo.getSystemCpuLoadJoinValue(); - assertEquals(systemCpuLoadJoinValue.getAvg(), 50, 0); - assertEquals(systemCpuLoadJoinValue.getMin(), 50, 0); - assertEquals(systemCpuLoadJoinValue.getMax(), 50, 0); - } - - @Test - public void map2Test() { - final String agentId = "testAgent"; - final JoinAgentStatBoMapper joinAgentStatBoMapper = new JoinAgentStatBoMapper(); - - final TFAgentStatBatch tFAgentStatBatch = new TFAgentStatBatch(); - tFAgentStatBatch.setStartTimestamp(1491274138454L); - tFAgentStatBatch.setAgentId(agentId); - - final TFAgentStat tFAgentStat = new TFAgentStat(); - tFAgentStat.setAgentId(agentId); - tFAgentStat.setTimestamp(1491274148454L); - - final TFJvmGc tFJvmGc = new TFJvmGc(); - tFJvmGc.setJvmMemoryHeapUsed(1000); - tFJvmGc.setJvmMemoryNonHeapUsed(300); - tFAgentStat.setGc(tFJvmGc); - - final TFAgentStat tFAgentStat2 = new TFAgentStat(); - tFAgentStat2.setAgentId(agentId); - tFAgentStat2.setTimestamp(1491275148454L); - - final TFJvmGc tFJvmGc2 = new TFJvmGc(); - tFJvmGc2.setJvmMemoryHeapUsed(2000); - tFJvmGc2.setJvmMemoryNonHeapUsed(500); - tFAgentStat2.setGc(tFJvmGc2); - - - final List tFAgentStatList = List.of( - tFAgentStat, tFAgentStat2 - ); - tFAgentStatBatch.setAgentStats(tFAgentStatList); - - JoinAgentStatBo joinAgentStatBo = joinAgentStatBoMapper.map(tFAgentStatBatch); - assertEquals(joinAgentStatBo.getId(), agentId); - assertEquals(joinAgentStatBo.getAgentStartTimestamp(), 1491274138454L); - assertEquals(joinAgentStatBo.getTimestamp(), 1491274148454L); - - List joinMemoryBoList = joinAgentStatBo.getJoinMemoryBoList(); - assertThat(joinMemoryBoList).hasSize(2); - - JoinMemoryBo joinMemoryBo = joinMemoryBoList.get(0); - assertEquals(joinMemoryBo.getId(), agentId); - assertEquals(joinMemoryBo.getTimestamp(), 1491274148454L); - assertEquals((long) joinMemoryBo.getHeapUsedJoinValue().getAvg(), 1000); - assertEquals((long) joinMemoryBo.getNonHeapUsedJoinValue().getAvg(), 300); - - JoinMemoryBo joinMemoryBo2 = joinMemoryBoList.get(1); - assertEquals(joinMemoryBo2.getId(), agentId); - assertEquals(joinMemoryBo2.getTimestamp(), 1491275148454L); - assertEquals((long) joinMemoryBo2.getHeapUsedJoinValue().getAvg(), 2000); - assertEquals((long) joinMemoryBo2.getNonHeapUsedJoinValue().getAvg(), 500); - } - - @Test - public void map3Test() { - final String agentId = "testAgent"; - final JoinAgentStatBoMapper joinAgentStatBoMapper = new JoinAgentStatBoMapper(); - - final TFAgentStatBatch tFAgentStatBatch = new TFAgentStatBatch(); - tFAgentStatBatch.setStartTimestamp(1491274138454L); - tFAgentStatBatch.setAgentId(agentId); - - final TFAgentStat tFAgentStat = new TFAgentStat(); - tFAgentStat.setAgentId(agentId); - tFAgentStat.setTimestamp(1491274148454L); - tFAgentStat.setCollectInterval(5000); - - final TFTransaction tFTransaction = new TFTransaction(); - tFTransaction.setSampledNewCount(10); - tFTransaction.setSampledContinuationCount(20); - tFTransaction.setUnsampledNewCount(40); - tFTransaction.setUnsampledContinuationCount(50); - tFAgentStat.setTransaction(tFTransaction); - - final TFAgentStat tFAgentStat2 = new TFAgentStat(); - tFAgentStat2.setAgentId(agentId); - tFAgentStat2.setTimestamp(1491275148454L); - tFAgentStat2.setCollectInterval(5000); - - final TFTransaction tFTransaction2 = new TFTransaction(); - tFTransaction2.setSampledNewCount(11); - tFTransaction2.setSampledContinuationCount(21); - tFTransaction2.setUnsampledNewCount(41); - tFTransaction2.setUnsampledContinuationCount(51); - tFAgentStat2.setTransaction(tFTransaction2); - - - final List tFAgentStatList = List.of( - tFAgentStat, tFAgentStat2 - ); - tFAgentStatBatch.setAgentStats(tFAgentStatList); - - JoinAgentStatBo joinAgentStatBo = joinAgentStatBoMapper.map(tFAgentStatBatch); - assertEquals(joinAgentStatBo.getId(), agentId); - assertEquals(joinAgentStatBo.getAgentStartTimestamp(), 1491274138454L); - assertEquals(joinAgentStatBo.getTimestamp(), 1491274148454L); - - List joinTransactionBoList = joinAgentStatBo.getJoinTransactionBoList(); - assertThat(joinTransactionBoList).hasSize(2); - - JoinTransactionBo joinTransactionBo = joinTransactionBoList.get(0); - assertEquals(joinTransactionBo.getId(), agentId); - assertEquals(joinTransactionBo.getTimestamp(), 1491274148454L); - assertEquals(joinTransactionBo.getCollectInterval(), 5000); - assertEquals(joinTransactionBo.getTotalCountJoinValue(), new JoinLongFieldBo(24L, 24L, agentId, 24L, agentId)); - - JoinTransactionBo joinTransactionBo2 = joinTransactionBoList.get(1); - assertEquals(joinTransactionBo2.getId(), agentId); - assertEquals(joinTransactionBo2.getTimestamp(), 1491275148454L); - assertEquals(joinTransactionBo2.getCollectInterval(), 5000); - assertEquals(joinTransactionBo2.getTotalCountJoinValue(), new JoinLongFieldBo(24L, 24L, agentId, 24L, agentId)); - } - - @Test - public void map4Test() { - final String agentId = "testAgent"; - final JoinAgentStatBoMapper joinAgentStatBoMapper = new JoinAgentStatBoMapper(); - - final TFAgentStatBatch tFAgentStatBatch = new TFAgentStatBatch(); - tFAgentStatBatch.setStartTimestamp(1491274138454L); - tFAgentStatBatch.setAgentId(agentId); - - final TFAgentStat tFAgentStat = new TFAgentStat(); - tFAgentStat.setAgentId(agentId); - tFAgentStat.setTimestamp(1491274148454L); - - final TFActiveTraceHistogram tFActiveTraceHistogram = new TFActiveTraceHistogram(); - tFActiveTraceHistogram.setVersion((short)2); - tFActiveTraceHistogram.setHistogramSchemaType(1); - List activeTraceCount = List.of(10, 20, 40, 50); - tFActiveTraceHistogram.setActiveTraceCount(activeTraceCount); - - final TFActiveTrace tfActiveTrace = new TFActiveTrace(); - tfActiveTrace.setHistogram(tFActiveTraceHistogram); - tFAgentStat.setActiveTrace(tfActiveTrace); - - final TFAgentStat tFAgentStat2 = new TFAgentStat(); - tFAgentStat2.setAgentId(agentId); - tFAgentStat2.setTimestamp(1491275148454L); - tFAgentStat2.setCollectInterval(5000); - - final TFActiveTraceHistogram tFActiveTraceHistogram2 = new TFActiveTraceHistogram(); - tFActiveTraceHistogram2.setVersion((short) 2); - tFActiveTraceHistogram2.setHistogramSchemaType(1); - List activeTraceCount2 = List.of(11, 21, 41, 51); - tFActiveTraceHistogram2.setActiveTraceCount(activeTraceCount2); - - final TFActiveTrace tfActiveTrace2 = new TFActiveTrace(); - tfActiveTrace2.setHistogram(tFActiveTraceHistogram2); - tFAgentStat2.setActiveTrace(tfActiveTrace2); - - final List tFAgentStatList = List.of( - tFAgentStat, tFAgentStat2 - ); - tFAgentStatBatch.setAgentStats(tFAgentStatList); - - JoinAgentStatBo joinAgentStatBo = joinAgentStatBoMapper.map(tFAgentStatBatch); - assertEquals(joinAgentStatBo.getId(), agentId); - assertEquals(joinAgentStatBo.getAgentStartTimestamp(), 1491274138454L); - assertEquals(joinAgentStatBo.getTimestamp(), 1491274148454L); - - List joinActiveTraceBoList = joinAgentStatBo.getJoinActiveTraceBoList(); - assertThat(joinActiveTraceBoList).hasSize(2); - - JoinActiveTraceBo joinActiveTraceBo = joinActiveTraceBoList.get(0); - assertEquals(joinActiveTraceBo.getId(), agentId); - assertEquals(joinActiveTraceBo.getTimestamp(), 1491274148454L); - assertEquals(joinActiveTraceBo.getVersion(), 2); - assertEquals(joinActiveTraceBo.getHistogramSchemaType(), 1); - assertEquals(joinActiveTraceBo.getTotalCountJoinValue(), new JoinIntFieldBo(120, 120, agentId, 120, agentId)); - - JoinActiveTraceBo joinActiveTraceBo2 = joinActiveTraceBoList.get(1); - assertEquals(joinActiveTraceBo2.getId(), agentId); - assertEquals(joinActiveTraceBo2.getTimestamp(), 1491275148454L); - assertEquals(joinActiveTraceBo2.getVersion(), 2); - assertEquals(joinActiveTraceBo2.getHistogramSchemaType(), 1); - assertEquals(joinActiveTraceBo2.getTotalCountJoinValue(), new JoinIntFieldBo(124, 124, agentId, 124, agentId)); - } - - @Test - public void map5Test() { - final String agentId = "testAgent"; - final JoinAgentStatBoMapper joinAgentStatBoMapper = new JoinAgentStatBoMapper(); - - final TFAgentStatBatch tFAgentStatBatch = new TFAgentStatBatch(); - tFAgentStatBatch.setStartTimestamp(1491274138454L); - tFAgentStatBatch.setAgentId(agentId); - - final TFResponseTime tFResponseTime = new TFResponseTime(); - tFResponseTime.setAvg(100); - final TFAgentStat tFAgentStat = new TFAgentStat(); - tFAgentStat.setAgentId(agentId); - tFAgentStat.setTimestamp(1491274148454L); - tFAgentStat.setResponseTime(tFResponseTime); - - final TFResponseTime tFResponseTime2 = new TFResponseTime(); - tFResponseTime2.setAvg(120); - final TFAgentStat tFAgentStat2 = new TFAgentStat(); - tFAgentStat2.setAgentId(agentId); - tFAgentStat2.setTimestamp(1491275148454L); - tFAgentStat2.setResponseTime(tFResponseTime2); - - final List tFAgentStatList = List.of( - tFAgentStat, tFAgentStat2 - ); - tFAgentStatBatch.setAgentStats(tFAgentStatList); - - JoinAgentStatBo joinAgentStatBo = joinAgentStatBoMapper.map(tFAgentStatBatch); - assertEquals(joinAgentStatBo.getId(), agentId); - assertEquals(joinAgentStatBo.getAgentStartTimestamp(), 1491274138454L); - assertEquals(joinAgentStatBo.getTimestamp(), 1491274148454L); - - List joinResponseTimeBoList = joinAgentStatBo.getJoinResponseTimeBoList(); - assertThat(joinResponseTimeBoList).hasSize(2); - - JoinResponseTimeBo joinResponseTimeBo = joinResponseTimeBoList.get(0); - assertEquals(joinResponseTimeBo.getId(), agentId); - assertEquals(joinResponseTimeBo.getTimestamp(), 1491274148454L); - assertEquals(joinResponseTimeBo.getResponseTimeJoinValue(), new JoinLongFieldBo(100L, 100L, agentId, 100L, agentId)); - - JoinResponseTimeBo joinResponseTimeBo2 = joinResponseTimeBoList.get(1); - assertEquals(joinResponseTimeBo2.getId(), agentId); - assertEquals(joinResponseTimeBo2.getTimestamp(), 1491275148454L); - assertEquals(joinResponseTimeBo2.getResponseTimeJoinValue(), new JoinLongFieldBo(120L, 120L, agentId, 120L, agentId)); - } - - @Test - public void map6Test() { - final String agentId = "testAgent"; - final JoinAgentStatBoMapper joinAgentStatBoMapper = new JoinAgentStatBoMapper(); - - final TFAgentStatBatch tFAgentStatBatch = new TFAgentStatBatch(); - tFAgentStatBatch.setStartTimestamp(1491274138454L); - tFAgentStatBatch.setAgentId(agentId); - - final TFTotalThreadCount tfTotalThreadCount = new TFTotalThreadCount(); - tfTotalThreadCount.setTotalThreadCount(100); - final TFAgentStat tFAgentStat = new TFAgentStat(); - tFAgentStat.setAgentId(agentId); - tFAgentStat.setTimestamp(1491274148454L); - tFAgentStat.setTotalThreadCount(tfTotalThreadCount); - - final TFTotalThreadCount tfTotalThreadCount2 = new TFTotalThreadCount(); - tfTotalThreadCount2.setTotalThreadCount(120); - final TFAgentStat tFAgentStat2 = new TFAgentStat(); - tFAgentStat2.setAgentId(agentId); - tFAgentStat2.setTimestamp(1491275148454L); - tFAgentStat2.setTotalThreadCount(tfTotalThreadCount2); - - final List tFAgentStatList = List.of( - tFAgentStat, tFAgentStat2 - ); - tFAgentStatBatch.setAgentStats(tFAgentStatList); - - JoinAgentStatBo joinAgentStatBo = joinAgentStatBoMapper.map(tFAgentStatBatch); - assertEquals(agentId, joinAgentStatBo.getId()); - assertEquals(1491274138454L, joinAgentStatBo.getAgentStartTimestamp()); - assertEquals(1491274148454L, joinAgentStatBo.getTimestamp()); - - List joinTotalThreadCountBoList = joinAgentStatBo.getJoinTotalThreadCountBoList(); - assertThat(joinTotalThreadCountBoList).hasSize(2); - - JoinTotalThreadCountBo joinTotalThreadCountBo = joinTotalThreadCountBoList.get(0); - assertEquals(agentId, joinTotalThreadCountBo.getId()); - assertEquals(1491274148454L, joinTotalThreadCountBo.getTimestamp()); - assertEquals(new JoinLongFieldBo(100L, 100L, agentId, 100L, agentId), joinTotalThreadCountBo.getTotalThreadCountJoinValue()); - - JoinTotalThreadCountBo joinTotalThreadCountBo2 = joinTotalThreadCountBoList.get(1); - assertEquals(agentId, joinTotalThreadCountBo2.getId()); - assertEquals(1491275148454L, joinTotalThreadCountBo2.getTimestamp()); - assertEquals(new JoinLongFieldBo(120L, 120L, agentId, 120L, agentId), joinTotalThreadCountBo2.getTotalThreadCountJoinValue()); - } - - @Test - public void map7Test() { - final String agentId = "testAgent"; - final JoinAgentStatBoMapper joinAgentStatBoMapper = new JoinAgentStatBoMapper(); - - final TFAgentStatBatch tFAgentStatBatch = new TFAgentStatBatch(); - tFAgentStatBatch.setStartTimestamp(1491274138454L); - tFAgentStatBatch.setAgentId(agentId); - - final TFLoadedClass tfLoadedClass = new TFLoadedClass(); - tfLoadedClass.setLoadedClassCount(100); - tfLoadedClass.setUnloadedClassCount(100); - final TFAgentStat tFAgentStat = new TFAgentStat(); - tFAgentStat.setAgentId(agentId); - tFAgentStat.setTimestamp(1491274148454L); - tFAgentStat.setLoadedClass(tfLoadedClass); - - final TFLoadedClass tfLoadedClass2 = new TFLoadedClass(); - tfLoadedClass2.setLoadedClassCount(120); - tfLoadedClass2.setUnloadedClassCount(120); - final TFAgentStat tFAgentStat2 = new TFAgentStat(); - tFAgentStat2.setAgentId(agentId); - tFAgentStat2.setTimestamp(1491275148454L); - tFAgentStat2.setLoadedClass(tfLoadedClass2); - - final List tFAgentStatList = List.of( - tFAgentStat, tFAgentStat2 - ); - tFAgentStatBatch.setAgentStats(tFAgentStatList); - - JoinAgentStatBo joinAgentStatBo = joinAgentStatBoMapper.map(tFAgentStatBatch); - assertEquals(agentId, joinAgentStatBo.getId()); - assertEquals(1491274138454L, joinAgentStatBo.getAgentStartTimestamp()); - assertEquals(1491274148454L, joinAgentStatBo.getTimestamp()); - - List joinLoadedClassBoList = joinAgentStatBo.getJoinLoadedClassBoList(); - assertThat(joinLoadedClassBoList).hasSize(2); - - JoinLoadedClassBo joinLoadedClassBo = joinLoadedClassBoList.get(0); - assertEquals(agentId, joinLoadedClassBo.getId()); - assertEquals(1491274148454L, joinLoadedClassBo.getTimestamp()); - assertEquals(new JoinLongFieldBo(100L, 100L, agentId, 100L, agentId), joinLoadedClassBo.getLoadedClassJoinValue()); - assertEquals(new JoinLongFieldBo(100L, 100L, agentId, 100L, agentId), joinLoadedClassBo.getUnloadedClassJoinValue()); - - JoinLoadedClassBo joinLoadedClassBo2 = joinLoadedClassBoList.get(1); - assertEquals(agentId, joinLoadedClassBo2.getId()); - assertEquals(1491275148454L, joinLoadedClassBo2.getTimestamp()); - assertEquals(new JoinLongFieldBo(120L, 120L, agentId, 120L, agentId), joinLoadedClassBo2.getLoadedClassJoinValue()); - assertEquals(new JoinLongFieldBo(120L, 120L, agentId, 120L, agentId), joinLoadedClassBo2.getUnloadedClassJoinValue()); - } -} \ No newline at end of file diff --git a/flink/src/test/java/com/navercorp/pinpoint/flink/mapper/thrift/stat/JoinDataSourceListBoMapperTest.java b/flink/src/test/java/com/navercorp/pinpoint/flink/mapper/thrift/stat/JoinDataSourceListBoMapperTest.java deleted file mode 100644 index d8c23f833693..000000000000 --- a/flink/src/test/java/com/navercorp/pinpoint/flink/mapper/thrift/stat/JoinDataSourceListBoMapperTest.java +++ /dev/null @@ -1,99 +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.flink.mapper.thrift.stat; - -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinDataSourceBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinDataSourceListBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinIntFieldBo; -import com.navercorp.pinpoint.thrift.dto.flink.TFAgentStat; -import com.navercorp.pinpoint.thrift.dto.flink.TFDataSource; -import com.navercorp.pinpoint.thrift.dto.flink.TFDataSourceList; -import org.junit.jupiter.api.Test; - -import java.util.List; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * @author minwoo.jung - */ -public class JoinDataSourceListBoMapperTest { - - @Test - public void mapTest() { - JoinDataSourceListBoMapper mapper = new JoinDataSourceListBoMapper(); - TFAgentStat tFAgentStat = new TFAgentStat(); - tFAgentStat.setAgentId("testAgent"); - tFAgentStat.setTimestamp(1491274138454L); - TFDataSourceList tFDataSourceList = new TFDataSourceList(); - - - TFDataSource tFDataSource1 = new TFDataSource(); - tFDataSource1.setUrl("jdbc:mysql"); - tFDataSource1.setMaxConnectionSize(30); - tFDataSource1.setActiveConnectionSize(13); - tFDataSource1.setDatabaseName("pinpoint"); - tFDataSource1.setServiceTypeCode((short) 1000); - TFDataSource tFDataSource2 = new TFDataSource(); - tFDataSource2.setUrl("jdbc:mssql"); - tFDataSource2.setMaxConnectionSize(31); - tFDataSource2.setActiveConnectionSize(23); - tFDataSource2.setDatabaseName("pinpoint"); - tFDataSource2.setServiceTypeCode((short) 2000); - - List dataSourceList = List.of(tFDataSource1, tFDataSource2); - - tFDataSourceList.setDataSourceList(dataSourceList); - tFAgentStat.setDataSourceList(tFDataSourceList); - JoinDataSourceListBo joinDataSourceListBo = mapper.map(tFAgentStat); - - assertEquals(joinDataSourceListBo.getId(), "testAgent"); - assertEquals(joinDataSourceListBo.getTimestamp(), 1491274138454L); - assertThat(joinDataSourceListBo.getJoinDataSourceBoList()).hasSize(2); - - List joinDataSourceBoList = joinDataSourceListBo.getJoinDataSourceBoList(); - JoinDataSourceBo joinDataSourceBo1 = joinDataSourceBoList.get(0); - assertEquals(joinDataSourceBo1.getServiceTypeCode(), 1000); - assertEquals(joinDataSourceBo1.getUrl(), "jdbc:mysql"); - assertEquals(joinDataSourceBo1.getActiveConnectionSizeJoinValue(), new JoinIntFieldBo(13, 13, "testAgent", 13, "testAgent")); - JoinDataSourceBo joinDataSourceBo2 = joinDataSourceBoList.get(1); - assertEquals(joinDataSourceBo2.getServiceTypeCode(), 2000); - assertEquals(joinDataSourceBo2.getUrl(), "jdbc:mssql"); - assertEquals(joinDataSourceBo2.getActiveConnectionSizeJoinValue(), new JoinIntFieldBo(23, 23, "testAgent", 23, "testAgent")); - } - - - @Test - public void map2Test() { - JoinDataSourceListBoMapper mapper = new JoinDataSourceListBoMapper(); - TFAgentStat tFAgentStat = new TFAgentStat(); - tFAgentStat.setAgentId("testAgent"); - tFAgentStat.setTimestamp(1491274138454L); - JoinDataSourceListBo joinDataSourceListBo = mapper.map(tFAgentStat); - assertEquals(joinDataSourceListBo, JoinDataSourceListBo.EMPTY_JOIN_DATA_SOURCE_LIST_BO); - - TFDataSourceList tFDataSourceList = new TFDataSourceList(); - tFAgentStat.setDataSourceList(tFDataSourceList); - joinDataSourceListBo = mapper.map(tFAgentStat); - assertEquals(joinDataSourceListBo, JoinDataSourceListBo.EMPTY_JOIN_DATA_SOURCE_LIST_BO); - - tFDataSourceList.setDataSourceList(List.of()); - joinDataSourceListBo = mapper.map(tFAgentStat); - assertEquals(joinDataSourceListBo, JoinDataSourceListBo.EMPTY_JOIN_DATA_SOURCE_LIST_BO); - } -} \ No newline at end of file diff --git a/flink/src/test/java/com/navercorp/pinpoint/flink/mapper/thrift/stat/JoinDirectBufferBoMapperTest.java b/flink/src/test/java/com/navercorp/pinpoint/flink/mapper/thrift/stat/JoinDirectBufferBoMapperTest.java deleted file mode 100644 index 50679a5a30a6..000000000000 --- a/flink/src/test/java/com/navercorp/pinpoint/flink/mapper/thrift/stat/JoinDirectBufferBoMapperTest.java +++ /dev/null @@ -1,79 +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.flink.mapper.thrift.stat; - -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinDirectBufferBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinLongFieldBo; -import com.navercorp.pinpoint.thrift.dto.flink.TFAgentStat; -import com.navercorp.pinpoint.thrift.dto.flink.TFDirectBuffer; -import org.junit.jupiter.api.Test; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; - -/** - * @author Roy Kim - */ -public class JoinDirectBufferBoMapperTest { - @Test - public void mapTest() throws Exception { - final TFAgentStat tFAgentStat = new TFAgentStat(); - tFAgentStat.setAgentId("testAgent"); - tFAgentStat.setTimestamp(1491274138454L); - - final TFDirectBuffer tfDirectBuffer = new TFDirectBuffer(); - tfDirectBuffer.setDirectCount(10); - tfDirectBuffer.setDirectMemoryUsed(11); - tfDirectBuffer.setMappedCount(12); - tfDirectBuffer.setMappedMemoryUsed(13); - tFAgentStat.setDirectBuffer(tfDirectBuffer); - - final JoinDirectBufferBoMapper mapper = new JoinDirectBufferBoMapper(); - final JoinDirectBufferBo joinDirectBufferBo = mapper.map(tFAgentStat); - - assertNotNull(joinDirectBufferBo); - assertEquals(joinDirectBufferBo.getId(), "testAgent"); - assertEquals(joinDirectBufferBo.getTimestamp(), 1491274138454L); - final JoinLongFieldBo directCountJoinValue = joinDirectBufferBo.getDirectCountJoinValue(); - assertEquals(directCountJoinValue.getAvg(), 10, 0); - assertEquals(directCountJoinValue.getMin(), 10, 0); - assertEquals(directCountJoinValue.getMax(), 10, 0); - final JoinLongFieldBo directMemoryUsedJoinValue = joinDirectBufferBo.getDirectMemoryUsedJoinValue(); - assertEquals(directMemoryUsedJoinValue.getAvg(), 11, 0); - assertEquals(directMemoryUsedJoinValue.getMin(), 11, 0); - assertEquals(directMemoryUsedJoinValue.getMax(), 11, 0); - final JoinLongFieldBo mappedCountJoinValue = joinDirectBufferBo.getMappedCountJoinValue(); - assertEquals(mappedCountJoinValue.getAvg(), 12, 0); - assertEquals(mappedCountJoinValue.getMin(), 12, 0); - assertEquals(mappedCountJoinValue.getMax(), 12, 0); - final JoinLongFieldBo mappedMemoryUsedJoinValue = joinDirectBufferBo.getMappedMemoryUsedJoinValue(); - assertEquals(mappedMemoryUsedJoinValue.getAvg(), 13, 0); - assertEquals(mappedMemoryUsedJoinValue.getMin(), 13, 0); - assertEquals(mappedMemoryUsedJoinValue.getMax(), 13, 0); - } - - @Test - public void map2Test() { - final TFAgentStat tFAgentStat = new TFAgentStat(); - tFAgentStat.setAgentId("testAgent"); - tFAgentStat.setTimestamp(1491274138454L); - - final JoinDirectBufferBoMapper mapper = new JoinDirectBufferBoMapper(); - final JoinDirectBufferBo joinDirectBufferBo = mapper.map(tFAgentStat); - assertEquals(joinDirectBufferBo, joinDirectBufferBo.EMPTY_JOIN_DIRECT_BUFFER_BO); - } -} \ No newline at end of file diff --git a/flink/src/test/java/com/navercorp/pinpoint/flink/mapper/thrift/stat/JoinFileDescriptorBoMapperTest.java b/flink/src/test/java/com/navercorp/pinpoint/flink/mapper/thrift/stat/JoinFileDescriptorBoMapperTest.java deleted file mode 100644 index 1ecd5f5d6d2b..000000000000 --- a/flink/src/test/java/com/navercorp/pinpoint/flink/mapper/thrift/stat/JoinFileDescriptorBoMapperTest.java +++ /dev/null @@ -1,62 +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.flink.mapper.thrift.stat; - -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinFileDescriptorBo; -import com.navercorp.pinpoint.thrift.dto.flink.TFAgentStat; -import com.navercorp.pinpoint.thrift.dto.flink.TFFileDescriptor; -import org.junit.jupiter.api.Test; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; - -/** - * @author Roy Kim - */ -public class JoinFileDescriptorBoMapperTest { - @Test - public void mapTest() throws Exception { - final TFAgentStat tFAgentStat = new TFAgentStat(); - tFAgentStat.setAgentId("testAgent"); - tFAgentStat.setTimestamp(1491274138454L); - - final TFFileDescriptor tfFileDescriptor = new TFFileDescriptor(); - tfFileDescriptor.setOpenFileDescriptorCount(10); - tFAgentStat.setFileDescriptor(tfFileDescriptor); - - final JoinFileDescriptorBoMapper mapper = new JoinFileDescriptorBoMapper(); - final JoinFileDescriptorBo joinFileDescriptorBo = mapper.map(tFAgentStat); - - assertNotNull(joinFileDescriptorBo); - assertEquals(joinFileDescriptorBo.getId(), "testAgent"); - assertEquals(joinFileDescriptorBo.getTimestamp(), 1491274138454L); - assertEquals(joinFileDescriptorBo.getOpenFdCountJoinValue().getAvg(), 10, 0); - assertEquals(joinFileDescriptorBo.getOpenFdCountJoinValue().getMin(), 10, 0); - assertEquals(joinFileDescriptorBo.getOpenFdCountJoinValue().getMax(), 10, 0); - } - - @Test - public void map2Test() { - final TFAgentStat tFAgentStat = new TFAgentStat(); - tFAgentStat.setAgentId("testAgent"); - tFAgentStat.setTimestamp(1491274138454L); - - final JoinFileDescriptorBoMapper mapper = new JoinFileDescriptorBoMapper(); - final JoinFileDescriptorBo joinFileDescriptorBo = mapper.map(tFAgentStat); - assertEquals(joinFileDescriptorBo, joinFileDescriptorBo.EMPTY_JOIN_FILE_DESCRIPTOR_BO); - } -} \ No newline at end of file diff --git a/flink/src/test/java/com/navercorp/pinpoint/flink/mapper/thrift/stat/JoinLoadedClassBoMapperTest.java b/flink/src/test/java/com/navercorp/pinpoint/flink/mapper/thrift/stat/JoinLoadedClassBoMapperTest.java deleted file mode 100644 index ea4dcf9a41c5..000000000000 --- a/flink/src/test/java/com/navercorp/pinpoint/flink/mapper/thrift/stat/JoinLoadedClassBoMapperTest.java +++ /dev/null @@ -1,60 +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.flink.mapper.thrift.stat; - -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinLoadedClassBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinLongFieldBo; -import com.navercorp.pinpoint.thrift.dto.flink.TFAgentStat; -import com.navercorp.pinpoint.thrift.dto.flink.TFLoadedClass; -import org.junit.jupiter.api.Test; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; - -public class JoinLoadedClassBoMapperTest { - @Test - public void mapTest() throws Exception { - final TFAgentStat tFAgentStat = new TFAgentStat(); - tFAgentStat.setAgentId("testAgent"); - tFAgentStat.setTimestamp(1491274138454L); - - final TFLoadedClass tfLoadedClass = new TFLoadedClass(); - tfLoadedClass.setLoadedClassCount(50); - tfLoadedClass.setUnloadedClassCount(50); - tFAgentStat.setLoadedClass(tfLoadedClass); - - final JoinLoadedClassBoMapper mapper = new JoinLoadedClassBoMapper(); - final JoinLoadedClassBo joinLoadedClassBo = mapper.map(tFAgentStat); - - assertNotNull(joinLoadedClassBo); - assertEquals("testAgent", joinLoadedClassBo.getId()); - assertEquals(1491274138454L, joinLoadedClassBo.getTimestamp()); - assertEquals(new JoinLongFieldBo(50L, 50L, "testAgent", 50L, "testAgent"), joinLoadedClassBo.getLoadedClassJoinValue()); - assertEquals(new JoinLongFieldBo(50L, 50L, "testAgent", 50L, "testAgent"), joinLoadedClassBo.getUnloadedClassJoinValue()); - } - - @Test - public void map2Test() { - final TFAgentStat tFAgentStat = new TFAgentStat(); - tFAgentStat.setAgentId("testAgent"); - tFAgentStat.setTimestamp(1491274138454L); - - final JoinLoadedClassBoMapper mapper = new JoinLoadedClassBoMapper(); - final JoinLoadedClassBo joinLoadedClassBo = mapper.map(tFAgentStat); - assertEquals(joinLoadedClassBo, joinLoadedClassBo.EMPTY_JOIN_LOADED_CLASS_BO); - } -} diff --git a/flink/src/test/java/com/navercorp/pinpoint/flink/mapper/thrift/stat/JoinMemoryBoMapperTest.java b/flink/src/test/java/com/navercorp/pinpoint/flink/mapper/thrift/stat/JoinMemoryBoMapperTest.java deleted file mode 100644 index 1bbabb901cfa..000000000000 --- a/flink/src/test/java/com/navercorp/pinpoint/flink/mapper/thrift/stat/JoinMemoryBoMapperTest.java +++ /dev/null @@ -1,66 +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.flink.mapper.thrift.stat; - -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinLongFieldBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinMemoryBo; -import com.navercorp.pinpoint.thrift.dto.flink.TFAgentStat; -import com.navercorp.pinpoint.thrift.dto.flink.TFJvmGc; -import org.junit.jupiter.api.Test; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * @author minwoo.jung - */ -public class JoinMemoryBoMapperTest { - - public static final String TEST_AGENT = "testAgent"; - - @Test - public void map1Test() throws Exception { - final JoinMemoryBoMapper joinMemoryBoMapper = new JoinMemoryBoMapper(); - - final TFAgentStat tFAgentStat = new TFAgentStat(); - tFAgentStat.setAgentId(TEST_AGENT); - tFAgentStat.setTimestamp(1491274138454L); - - final TFJvmGc tFJvmGc = new TFJvmGc(); - tFJvmGc.setJvmMemoryHeapUsed(1000); - tFJvmGc.setJvmMemoryNonHeapUsed(300); - tFAgentStat.setGc(tFJvmGc); - - JoinMemoryBo joinMemoryBo = joinMemoryBoMapper.map(tFAgentStat); - assertEquals(joinMemoryBo.getTimestamp(), 1491274138454L); - assertEquals(joinMemoryBo.getId(), TEST_AGENT); - assertEquals(joinMemoryBo.getHeapUsedJoinValue(), new JoinLongFieldBo(1000L, 1000L, TEST_AGENT, 1000L, TEST_AGENT)); - assertEquals(joinMemoryBo.getNonHeapUsedJoinValue(), new JoinLongFieldBo(300L, 300L, TEST_AGENT, 300L, TEST_AGENT)); - } - - @Test - public void map2Test() { - final JoinMemoryBoMapper joinMemoryBoMapper = new JoinMemoryBoMapper(); - - final TFAgentStat tFAgentStat = new TFAgentStat(); - tFAgentStat.setAgentId(TEST_AGENT); - tFAgentStat.setTimestamp(1491274138454L); - - JoinMemoryBo joinMemoryBo = joinMemoryBoMapper.map(tFAgentStat); - assertEquals(joinMemoryBo, joinMemoryBo.EMPTY_JOIN_MEMORY_BO); - } - -} \ No newline at end of file diff --git a/flink/src/test/java/com/navercorp/pinpoint/flink/mapper/thrift/stat/JoinResponseTimeBoMapperTest.java b/flink/src/test/java/com/navercorp/pinpoint/flink/mapper/thrift/stat/JoinResponseTimeBoMapperTest.java deleted file mode 100644 index db0e9aa29e3b..000000000000 --- a/flink/src/test/java/com/navercorp/pinpoint/flink/mapper/thrift/stat/JoinResponseTimeBoMapperTest.java +++ /dev/null @@ -1,65 +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.flink.mapper.thrift.stat; - -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinLongFieldBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinResponseTimeBo; -import com.navercorp.pinpoint.thrift.dto.flink.TFAgentStat; -import com.navercorp.pinpoint.thrift.dto.flink.TFResponseTime; -import org.junit.jupiter.api.Test; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * @author minwoo.jung - */ -public class JoinResponseTimeBoMapperTest { - - @Test - public void mapTest() { - final String agentId = "agentId"; - final TFResponseTime tFResponseTime = new TFResponseTime(); - tFResponseTime.setAvg(100); - final TFAgentStat tFAgentStat = new TFAgentStat(); - tFAgentStat.setAgentId(agentId); - tFAgentStat.setTimestamp(1491274148454L); - tFAgentStat.setResponseTime(tFResponseTime); - - JoinResponseTimeBoMapper mapper = new JoinResponseTimeBoMapper(); - JoinResponseTimeBo joinResponseTimeBo = mapper.map(tFAgentStat); - - assertEquals(joinResponseTimeBo.getId(), agentId); - assertEquals(joinResponseTimeBo.getTimestamp(), 1491274148454L); - assertEquals(joinResponseTimeBo.getResponseTimeJoinValue(), new JoinLongFieldBo(100L, 100L, agentId, 100L, agentId)); - } - - @Test - public void map2Test() { - final String agentId = "agentId"; - final TFResponseTime tFResponseTime = new TFResponseTime(); - tFResponseTime.setAvg(100); - final TFAgentStat tFAgentStat = new TFAgentStat(); - tFAgentStat.setAgentId(agentId); - tFAgentStat.setTimestamp(1491274148454L); - - JoinResponseTimeBoMapper mapper = new JoinResponseTimeBoMapper(); - JoinResponseTimeBo joinResponseTimeBo = mapper.map(tFAgentStat); - - assertEquals(joinResponseTimeBo, JoinResponseTimeBo.EMPTY_JOIN_RESPONSE_TIME_BO); - } - -} \ No newline at end of file diff --git a/flink/src/test/java/com/navercorp/pinpoint/flink/mapper/thrift/stat/JoinThriftActiveTraceBoMapperTest.java b/flink/src/test/java/com/navercorp/pinpoint/flink/mapper/thrift/stat/JoinThriftActiveTraceBoMapperTest.java deleted file mode 100644 index ec64a13403f4..000000000000 --- a/flink/src/test/java/com/navercorp/pinpoint/flink/mapper/thrift/stat/JoinThriftActiveTraceBoMapperTest.java +++ /dev/null @@ -1,82 +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.flink.mapper.thrift.stat; - -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinActiveTraceBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinIntFieldBo; -import com.navercorp.pinpoint.thrift.dto.flink.TFActiveTrace; -import com.navercorp.pinpoint.thrift.dto.flink.TFActiveTraceHistogram; -import com.navercorp.pinpoint.thrift.dto.flink.TFAgentStat; -import org.junit.jupiter.api.Test; - -import java.util.ArrayList; -import java.util.List; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; - -/** - * @author minwoo.jung - */ -public class JoinThriftActiveTraceBoMapperTest { - - @Test - public void mapTest() throws Exception { - final TFAgentStat tFAgentStat = new TFAgentStat(); - final String id = "testAgent"; - tFAgentStat.setAgentId(id); - tFAgentStat.setTimestamp(1491274148454L); - - final TFActiveTraceHistogram tFActiveTraceHistogram = new TFActiveTraceHistogram(); - List activeTraceCount = new ArrayList<>(4); - activeTraceCount.add(10); - activeTraceCount.add(20); - activeTraceCount.add(40); - activeTraceCount.add(50); - tFActiveTraceHistogram.setVersion((short) 2); - tFActiveTraceHistogram.setHistogramSchemaType(1); - tFActiveTraceHistogram.setActiveTraceCount(activeTraceCount); - - final TFActiveTrace tFActiveTrace = new TFActiveTrace(); - tFActiveTrace.setHistogram(tFActiveTraceHistogram); - tFAgentStat.setActiveTrace(tFActiveTrace); - - final JoinActiveTraceBoMapper joinActiveTraceBoMapper = new JoinActiveTraceBoMapper(); - final JoinActiveTraceBo joinActiveTraceBo = joinActiveTraceBoMapper.map(tFAgentStat); - - assertNotNull(joinActiveTraceBo); - assertEquals(joinActiveTraceBo.getId(), id); - assertEquals(joinActiveTraceBo.getTimestamp(), 1491274148454L); - assertEquals(joinActiveTraceBo.getVersion(), 2); - assertEquals(joinActiveTraceBo.getHistogramSchemaType(), 1); - assertEquals(joinActiveTraceBo.getTotalCountJoinValue(), new JoinIntFieldBo(120, 120, id, 120, id)); - } - - @Test - public void map2Test() { - final TFAgentStat tFAgentStat = new TFAgentStat(); - final String id = "testAgent"; - tFAgentStat.setAgentId(id); - tFAgentStat.setTimestamp(1491274148454L); - - final JoinActiveTraceBoMapper joinActiveTraceBoMapper = new JoinActiveTraceBoMapper(); - final JoinActiveTraceBo joinActiveTraceBo = joinActiveTraceBoMapper.map(tFAgentStat); - - assertEquals(joinActiveTraceBo, JoinActiveTraceBo.EMPTY_JOIN_ACTIVE_TRACE_BO); - } - -} \ No newline at end of file diff --git a/flink/src/test/java/com/navercorp/pinpoint/flink/mapper/thrift/stat/JoinThriftCpuLoadBoMapperTest.java b/flink/src/test/java/com/navercorp/pinpoint/flink/mapper/thrift/stat/JoinThriftCpuLoadBoMapperTest.java deleted file mode 100644 index e45b8305c661..000000000000 --- a/flink/src/test/java/com/navercorp/pinpoint/flink/mapper/thrift/stat/JoinThriftCpuLoadBoMapperTest.java +++ /dev/null @@ -1,69 +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.flink.mapper.thrift.stat; - -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinCpuLoadBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinDoubleFieldBo; -import com.navercorp.pinpoint.thrift.dto.flink.TFAgentStat; -import com.navercorp.pinpoint.thrift.dto.flink.TFCpuLoad; -import org.junit.jupiter.api.Test; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; - -/** - * @author minwoo.jung - */ -public class JoinThriftCpuLoadBoMapperTest { - @Test - public void mapTest() throws Exception { - final TFAgentStat tFAgentStat = new TFAgentStat(); - tFAgentStat.setAgentId("testAgent"); - tFAgentStat.setTimestamp(1491274138454L); - - final TFCpuLoad tfCpuLoad = new TFCpuLoad(); - tfCpuLoad.setJvmCpuLoad(10); - tfCpuLoad.setSystemCpuLoad(30); - tFAgentStat.setCpuLoad(tfCpuLoad); - - final JoinCpuLoadBoMapper mapper = new JoinCpuLoadBoMapper(); - final JoinCpuLoadBo joinCpuLoadBo = mapper.map(tFAgentStat); - - assertNotNull(joinCpuLoadBo); - assertEquals(joinCpuLoadBo.getId(), "testAgent"); - assertEquals(joinCpuLoadBo.getTimestamp(), 1491274138454L); - final JoinDoubleFieldBo jvmCpuLoadJoinValue = joinCpuLoadBo.getJvmCpuLoadJoinValue(); - assertEquals(jvmCpuLoadJoinValue.getAvg(), 10, 0); - assertEquals(jvmCpuLoadJoinValue.getMin(), 10, 0); - assertEquals(jvmCpuLoadJoinValue.getMax(), 10, 0); - final JoinDoubleFieldBo systemCpuLoadJoinValue = joinCpuLoadBo.getSystemCpuLoadJoinValue(); - assertEquals(systemCpuLoadJoinValue.getAvg(), 30, 0); - assertEquals(systemCpuLoadJoinValue.getMin(), 30, 0); - assertEquals(systemCpuLoadJoinValue.getMax(), 30, 0); - } - - @Test - public void map2Test() { - final TFAgentStat tFAgentStat = new TFAgentStat(); - tFAgentStat.setAgentId("testAgent"); - tFAgentStat.setTimestamp(1491274138454L); - - final JoinCpuLoadBoMapper mapper = new JoinCpuLoadBoMapper(); - final JoinCpuLoadBo joinCpuLoadBo = mapper.map(tFAgentStat); - assertEquals(joinCpuLoadBo, joinCpuLoadBo.EMPTY_JOIN_CPU_LOAD_BO); - } -} \ No newline at end of file diff --git a/flink/src/test/java/com/navercorp/pinpoint/flink/mapper/thrift/stat/JoinTotalThreadCountBoMapperTest.java b/flink/src/test/java/com/navercorp/pinpoint/flink/mapper/thrift/stat/JoinTotalThreadCountBoMapperTest.java deleted file mode 100644 index 62e50aa0f432..000000000000 --- a/flink/src/test/java/com/navercorp/pinpoint/flink/mapper/thrift/stat/JoinTotalThreadCountBoMapperTest.java +++ /dev/null @@ -1,58 +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.flink.mapper.thrift.stat; - -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinLongFieldBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinTotalThreadCountBo; -import com.navercorp.pinpoint.thrift.dto.flink.TFAgentStat; -import com.navercorp.pinpoint.thrift.dto.flink.TFTotalThreadCount; -import org.junit.jupiter.api.Test; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; - -public class JoinTotalThreadCountBoMapperTest { - @Test - public void mapTest() throws Exception { - final TFAgentStat tFAgentStat = new TFAgentStat(); - tFAgentStat.setAgentId("testAgent"); - tFAgentStat.setTimestamp(1491274138454L); - - final TFTotalThreadCount tfTotalThreadCount = new TFTotalThreadCount(); - tfTotalThreadCount.setTotalThreadCount(50); - tFAgentStat.setTotalThreadCount(tfTotalThreadCount); - - final JoinTotalThreadCountBoMapper mapper = new JoinTotalThreadCountBoMapper(); - final JoinTotalThreadCountBo joinTotalThreadCountBo = mapper.map(tFAgentStat); - - assertNotNull(joinTotalThreadCountBo); - assertEquals(joinTotalThreadCountBo.getId(), "testAgent"); - assertEquals(joinTotalThreadCountBo.getTimestamp(), 1491274138454L); - assertEquals(joinTotalThreadCountBo.getTotalThreadCountJoinValue(), new JoinLongFieldBo(50L, 50L, "testAgent", 50L, "testAgent")); - } - - @Test - public void map2Test() { - final TFAgentStat tFAgentStat = new TFAgentStat(); - tFAgentStat.setAgentId("testAgent"); - tFAgentStat.setTimestamp(1491274138454L); - - final JoinTotalThreadCountBoMapper mapper = new JoinTotalThreadCountBoMapper(); - final JoinTotalThreadCountBo joinTotalThreadCountBo = mapper.map(tFAgentStat); - assertEquals(joinTotalThreadCountBo, joinTotalThreadCountBo.EMPTY_TOTAL_THREAD_COUNT_BO); - } -} diff --git a/flink/src/test/java/com/navercorp/pinpoint/flink/mapper/thrift/stat/JoinTransactionBoMapperTest.java b/flink/src/test/java/com/navercorp/pinpoint/flink/mapper/thrift/stat/JoinTransactionBoMapperTest.java deleted file mode 100644 index 343e876425ad..000000000000 --- a/flink/src/test/java/com/navercorp/pinpoint/flink/mapper/thrift/stat/JoinTransactionBoMapperTest.java +++ /dev/null @@ -1,73 +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.flink.mapper.thrift.stat; - -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinLongFieldBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinTransactionBo; -import com.navercorp.pinpoint.thrift.dto.flink.TFAgentStat; -import com.navercorp.pinpoint.thrift.dto.flink.TFTransaction; -import org.junit.jupiter.api.Test; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; - -/** - * @author minwoo.jung - */ -public class JoinTransactionBoMapperTest { - - @Test - public void mapTest() throws Exception { - final TFAgentStat tFAgentStat = new TFAgentStat(); - final String id = "testAgent"; - tFAgentStat.setAgentId(id); - tFAgentStat.setTimestamp(1491274138454L); - tFAgentStat.setCollectInterval(5000); - - final TFTransaction tFTransaction = new TFTransaction(); - tFTransaction.setSampledNewCount(10); - tFTransaction.setSampledContinuationCount(20); - tFTransaction.setUnsampledNewCount(40); - tFTransaction.setUnsampledContinuationCount(50); - tFTransaction.setSkippedNewCount(60); - tFTransaction.setSkippedContinuationCount(70); - tFAgentStat.setTransaction(tFTransaction); - - final JoinTransactionBoMapper joinTransactionBoMapper = new JoinTransactionBoMapper(); - final JoinTransactionBo joinTransactionBo = joinTransactionBoMapper.map(tFAgentStat); - - assertNotNull(joinTransactionBo); - assertEquals(joinTransactionBo.getId(), id); - assertEquals(joinTransactionBo.getTimestamp(), 1491274138454L); - assertEquals(joinTransactionBo.getCollectInterval(), 5000); - assertEquals(joinTransactionBo.getTotalCountJoinValue(), new JoinLongFieldBo(50L, 50L, id, 50L, id)); - } - - @Test - public void map2Test() { - final TFAgentStat tFAgentStat = new TFAgentStat(); - final String id = "testAgent"; - tFAgentStat.setAgentId(id); - tFAgentStat.setTimestamp(1491274138454L); - tFAgentStat.setCollectInterval(5000); - - final JoinTransactionBoMapper joinTransactionBoMapper = new JoinTransactionBoMapper(); - final JoinTransactionBo joinTransactionBo = joinTransactionBoMapper.map(tFAgentStat); - - assertEquals(joinTransactionBo, JoinTransactionBo.EMPTY_JOIN_TRANSACTION_BO); - } -} \ No newline at end of file diff --git a/flink/src/test/java/com/navercorp/pinpoint/flink/process/TBaseFlatMapperTest.java b/flink/src/test/java/com/navercorp/pinpoint/flink/process/TBaseFlatMapperTest.java deleted file mode 100644 index c7578a83d950..000000000000 --- a/flink/src/test/java/com/navercorp/pinpoint/flink/process/TBaseFlatMapperTest.java +++ /dev/null @@ -1,519 +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.flink.process; - -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinAgentStatBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinApplicationStatBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinCpuLoadBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinDirectBufferBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinDoubleFieldBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinFileDescriptorBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinLongFieldBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinMemoryBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinStatBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinTransactionBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.StatType; -import com.navercorp.pinpoint.flink.mapper.thrift.stat.JoinAgentStatBoMapper; -import com.navercorp.pinpoint.flink.vo.RawData; -import com.navercorp.pinpoint.thrift.dto.flink.TFAgentStat; -import com.navercorp.pinpoint.thrift.dto.flink.TFAgentStatBatch; -import com.navercorp.pinpoint.thrift.dto.flink.TFCpuLoad; -import com.navercorp.pinpoint.thrift.dto.flink.TFDirectBuffer; -import com.navercorp.pinpoint.thrift.dto.flink.TFFileDescriptor; -import com.navercorp.pinpoint.thrift.dto.flink.TFJvmGc; -import com.navercorp.pinpoint.thrift.dto.flink.TFTransaction; -import org.apache.flink.api.common.functions.util.ListCollector; -import org.apache.flink.api.java.tuple.Tuple3; -import org.apache.flink.util.Collector; -import org.junit.jupiter.api.Test; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -/** - * @author minwoo.jung - */ -public class TBaseFlatMapperTest { - final static String AGENT_ID = "testAgent"; - final static String APPLICATION_ID = "testApplication"; - - @Test - public void flatMapTest() throws Exception { - - ApplicationCache applicationCache = newMockApplicationCache(); - TBaseFlatMapper mapper = new TBaseFlatMapper(new JoinAgentStatBoMapper(), applicationCache, new DefaultTBaseFlatMapperInterceptor()); - - - TFAgentStatBatch tfAgentStatBatch = createTFAgentStatBatch(); - List> dataList = new ArrayList<>(); - Collector> collector = new ListCollector<>(dataList); - RawData rawData = newRawData(tfAgentStatBatch); - mapper.flatMap(rawData, collector); - - assertThat(dataList).hasSize(2); - - Tuple3 data1 = dataList.get(0); - assertEquals(data1.f0, AGENT_ID); - assertEquals(data1.f2.longValue(), 1491274143454L); - JoinAgentStatBo joinAgentStatBo = (JoinAgentStatBo) data1.f1; - assertEquals(joinAgentStatBo.getId(), AGENT_ID); - assertEquals(joinAgentStatBo.getAgentStartTimestamp(), 1491274142454L); - assertEquals(joinAgentStatBo.getTimestamp(), 1491274143454L); - assertJoinCpuLoadBo(joinAgentStatBo.getJoinCpuLoadBoList()); - - Tuple3 data2 = dataList.get(1); - assertEquals(data2.f0, APPLICATION_ID); - assertEquals(data2.f2.longValue(), 1491274140000L); - JoinApplicationStatBo joinApplicationStatBo = (JoinApplicationStatBo) data2.f1; - assertEquals(joinApplicationStatBo.getId(), APPLICATION_ID); - assertEquals(joinApplicationStatBo.getTimestamp(), 1491274140000L); - assertEquals(joinApplicationStatBo.getStatType(), StatType.APP_STST); - assertJoinCpuLoadBo(joinApplicationStatBo.getJoinCpuLoadBoList()); - } - - private ApplicationCache newMockApplicationCache() { - ApplicationCache applicationCache = mock(ApplicationCache.class); - when(applicationCache.findApplicationId(any(ApplicationCache.ApplicationKey.class))) - .thenReturn(APPLICATION_ID); - return applicationCache; - } - - private void assertJoinCpuLoadBo(List joincpulaodBoList) { - assertThat(joincpulaodBoList).hasSize(2); - JoinCpuLoadBo joinCpuLoadBo = joincpulaodBoList.get(0); - assertEquals(joinCpuLoadBo.getId(), AGENT_ID); - assertEquals(joinCpuLoadBo.getTimestamp(), 1491274143454L); - JoinDoubleFieldBo jvmCpuLoadJoinValue = joinCpuLoadBo.getJvmCpuLoadJoinValue(); - assertEquals(jvmCpuLoadJoinValue.getAvg(), 10, 0); - assertEquals(jvmCpuLoadJoinValue.getMin(), 10, 0); - assertEquals(jvmCpuLoadJoinValue.getMax(), 10, 0); - JoinDoubleFieldBo systemCpuLoadJoinValue = joinCpuLoadBo.getSystemCpuLoadJoinValue(); - assertEquals(systemCpuLoadJoinValue.getAvg(), 30, 0); - assertEquals(systemCpuLoadJoinValue.getMin(), 30, 0); - assertEquals(systemCpuLoadJoinValue.getMax(), 30, 0); - joinCpuLoadBo = joincpulaodBoList.get(1); - assertEquals(joinCpuLoadBo.getId(), AGENT_ID); - assertEquals(joinCpuLoadBo.getTimestamp(), 1491274148454L); - jvmCpuLoadJoinValue = joinCpuLoadBo.getJvmCpuLoadJoinValue(); - assertEquals(jvmCpuLoadJoinValue.getAvg(), 20, 0); - assertEquals(jvmCpuLoadJoinValue.getMin(), 20, 0); - assertEquals(jvmCpuLoadJoinValue.getMax(), 20, 0); - systemCpuLoadJoinValue = joinCpuLoadBo.getSystemCpuLoadJoinValue(); - assertEquals(systemCpuLoadJoinValue.getAvg(), 50, 0); - assertEquals(systemCpuLoadJoinValue.getMin(), 50, 0); - assertEquals(systemCpuLoadJoinValue.getMax(), 50, 0); - } - - private TFAgentStatBatch createTFAgentStatBatch() { - final TFAgentStatBatch tFAgentStatBatch = new TFAgentStatBatch(); - tFAgentStatBatch.setStartTimestamp(1491274142454L); - tFAgentStatBatch.setAgentId(AGENT_ID); - - final TFAgentStat tFAgentStat = new TFAgentStat(); - tFAgentStat.setAgentId(AGENT_ID); - tFAgentStat.setTimestamp(1491274143454L); - - final TFCpuLoad tFCpuLoad = new TFCpuLoad(); - tFCpuLoad.setJvmCpuLoad(10); - tFCpuLoad.setSystemCpuLoad(30); - tFAgentStat.setCpuLoad(tFCpuLoad); - - final TFAgentStat tFAgentStat2 = new TFAgentStat(); - tFAgentStat2.setAgentId(AGENT_ID); - tFAgentStat2.setTimestamp(1491274148454L); - - final TFCpuLoad tFCpuLoad2 = new TFCpuLoad(); - tFCpuLoad2.setJvmCpuLoad(20); - tFCpuLoad2.setSystemCpuLoad(50); - tFAgentStat2.setCpuLoad(tFCpuLoad2); - - final List tFAgentStatList = List.of( - tFAgentStat, tFAgentStat2 - ); - tFAgentStatBatch.setAgentStats(tFAgentStatList); - - return tFAgentStatBatch; - } - - - @Test - public void flatMap2Test() throws Exception { - ApplicationCache applicationCache = newMockApplicationCache(); - TBaseFlatMapper mapper = new TBaseFlatMapper(new JoinAgentStatBoMapper(), applicationCache, new DefaultTBaseFlatMapperInterceptor()); - - TFAgentStatBatch tfAgentStatBatch = createTFAgentStatBatch2(); - ArrayList> dataList = new ArrayList<>(); - Collector> collector = new ListCollector<>(dataList); - RawData rawdata = newRawData(tfAgentStatBatch); - mapper.flatMap(rawdata, collector); - - assertThat(dataList).hasSize(2); - - Tuple3 data1 = dataList.get(0); - assertEquals(data1.f0, AGENT_ID); - assertEquals(data1.f2.longValue(), 1491274143454L); - JoinAgentStatBo joinAgentStatBo = (JoinAgentStatBo) data1.f1; - assertEquals(joinAgentStatBo.getId(), AGENT_ID); - assertEquals(joinAgentStatBo.getAgentStartTimestamp(), 1491274142454L); - assertEquals(joinAgentStatBo.getTimestamp(), 1491274143454L); - assertJoinMemoryBo(joinAgentStatBo.getJoinMemoryBoList()); - - Tuple3 data2 = dataList.get(1); - assertEquals(data2.f0, APPLICATION_ID); - assertEquals(data2.f2.longValue(), 1491274140000L); - JoinApplicationStatBo joinApplicationStatBo = (JoinApplicationStatBo) data2.f1; - assertEquals(joinApplicationStatBo.getId(), APPLICATION_ID); - assertEquals(joinApplicationStatBo.getTimestamp(), 1491274140000L); - assertEquals(joinApplicationStatBo.getStatType(), StatType.APP_STST); - assertJoinMemoryBo(joinApplicationStatBo.getJoinMemoryBoList()); - } - - private void assertJoinMemoryBo(List joinMemoryBoList) { - assertThat(joinMemoryBoList).hasSize(2); - - JoinMemoryBo joinMemoryBo = joinMemoryBoList.get(0); - assertEquals(joinMemoryBo.getId(), AGENT_ID); - assertEquals((long) joinMemoryBo.getHeapUsedJoinValue().getAvg(), 3000); - assertEquals((long) joinMemoryBo.getNonHeapUsedJoinValue().getAvg(), 450); - assertEquals(joinMemoryBo.getTimestamp(), 1491274143454L); - - JoinMemoryBo joinMemoryBo2 = joinMemoryBoList.get(1); - assertEquals(joinMemoryBo2.getId(), AGENT_ID); - assertEquals((long) joinMemoryBo2.getHeapUsedJoinValue().getAvg(), 2000); - assertEquals((long) joinMemoryBo2.getNonHeapUsedJoinValue().getAvg(), 850); - assertEquals(joinMemoryBo2.getTimestamp(), 1491274148454L); - } - - private TFAgentStatBatch createTFAgentStatBatch2() { - final TFAgentStatBatch tFAgentStatBatch = new TFAgentStatBatch(); - tFAgentStatBatch.setStartTimestamp(1491274142454L); - tFAgentStatBatch.setAgentId(AGENT_ID); - - final TFAgentStat tFAgentStat = new TFAgentStat(); - tFAgentStat.setAgentId(AGENT_ID); - tFAgentStat.setTimestamp(1491274143454L); - - final TFJvmGc tFJvmGc = new TFJvmGc(); - tFJvmGc.setJvmMemoryHeapUsed(3000); - tFJvmGc.setJvmMemoryNonHeapUsed(450); - tFAgentStat.setGc(tFJvmGc); - - final TFAgentStat tFAgentStat2 = new TFAgentStat(); - tFAgentStat2.setAgentId(AGENT_ID); - tFAgentStat2.setTimestamp(1491274148454L); - - final TFJvmGc tFJvmGc2 = new TFJvmGc(); - tFJvmGc2.setJvmMemoryHeapUsed(2000); - tFJvmGc2.setJvmMemoryNonHeapUsed(850); - tFAgentStat2.setGc(tFJvmGc2); - - final List tFAgentStatList = List.of( - tFAgentStat, tFAgentStat2 - ); - tFAgentStatBatch.setAgentStats(tFAgentStatList); - - return tFAgentStatBatch; - } - - @Test - public void flatMap3Test() throws Exception { - ApplicationCache applicationCache = newMockApplicationCache(); - TBaseFlatMapper mapper = new TBaseFlatMapper(new JoinAgentStatBoMapper(), applicationCache, new DefaultTBaseFlatMapperInterceptor()); - - TFAgentStatBatch tfAgentStatBatch = createTFAgentStatBatch3(); - ArrayList> dataList = new ArrayList<>(); - Collector> collector = new ListCollector<>(dataList); - RawData rawData = newRawData(tfAgentStatBatch); - mapper.flatMap(rawData, collector); - - assertThat(dataList).hasSize(2); - - Tuple3 data1 = dataList.get(0); - assertEquals(data1.f0, AGENT_ID); - assertEquals(data1.f2.longValue(), 1491274143454L); - JoinAgentStatBo joinAgentStatBo = (JoinAgentStatBo) data1.f1; - assertEquals(joinAgentStatBo.getId(), AGENT_ID); - assertEquals(joinAgentStatBo.getAgentStartTimestamp(), 1491274142454L); - assertEquals(joinAgentStatBo.getTimestamp(), 1491274143454L); - assertJoinTransactionBo(joinAgentStatBo.getJoinTransactionBoList()); - - Tuple3 data2 = dataList.get(1); - assertEquals(data2.f0, APPLICATION_ID); - assertEquals(data2.f2.longValue(), 1491274140000L); - JoinApplicationStatBo joinApplicationStatBo = (JoinApplicationStatBo) data2.f1; - assertEquals(joinApplicationStatBo.getId(), APPLICATION_ID); - assertEquals(joinApplicationStatBo.getTimestamp(), 1491274140000L); - assertEquals(joinApplicationStatBo.getStatType(), StatType.APP_STST); - assertJoinTransactionBo(joinApplicationStatBo.getJoinTransactionBoList()); - } - - private RawData newRawData(TFAgentStatBatch tfAgentStatBatch) { - return new RawData(tfAgentStatBatch, Collections.emptyMap()); - } - - private void assertJoinTransactionBo(List joinTransactionBoList) { - assertThat(joinTransactionBoList).hasSize(2); - - JoinTransactionBo joinTransactionBo = joinTransactionBoList.get(0); - assertEquals(joinTransactionBo.getId(), AGENT_ID); - assertEquals(joinTransactionBo.getTimestamp(), 1491274143454L); - assertEquals(joinTransactionBo.getCollectInterval(), 5000); - assertEquals(joinTransactionBo.getTotalCountJoinValue(), new JoinLongFieldBo(24L, 24L, AGENT_ID, 24L, AGENT_ID)); - - JoinTransactionBo joinTransactionBo2 = joinTransactionBoList.get(1); - assertEquals(joinTransactionBo2.getId(), AGENT_ID); - assertEquals(joinTransactionBo2.getTimestamp(), 1491274148454L); - assertEquals(joinTransactionBo2.getCollectInterval(), 5000); - assertEquals(joinTransactionBo2.getTotalCountJoinValue(), new JoinLongFieldBo(24L, 24L, AGENT_ID, 24L, AGENT_ID)); - } - - private TFAgentStatBatch createTFAgentStatBatch3() { - final TFAgentStatBatch tFAgentStatBatch = new TFAgentStatBatch(); - tFAgentStatBatch.setStartTimestamp(1491274142454L); - tFAgentStatBatch.setAgentId(AGENT_ID); - - final TFAgentStat tFAgentStat = new TFAgentStat(); - tFAgentStat.setAgentId(AGENT_ID); - tFAgentStat.setTimestamp(1491274143454L); - tFAgentStat.setCollectInterval(5000); - - final TFTransaction tFTransaction = new TFTransaction(); - tFTransaction.setSampledNewCount(10); - tFTransaction.setSampledContinuationCount(20); - tFTransaction.setUnsampledNewCount(40); - tFTransaction.setUnsampledContinuationCount(50); - tFAgentStat.setTransaction(tFTransaction); - - final TFAgentStat tFAgentStat2 = new TFAgentStat(); - tFAgentStat2.setAgentId(AGENT_ID); - tFAgentStat2.setTimestamp(1491274148454L); - tFAgentStat2.setCollectInterval(5000); - - final TFTransaction tFTransaction2 = new TFTransaction(); - tFTransaction2.setSampledNewCount(11); - tFTransaction2.setSampledContinuationCount(21); - tFTransaction2.setUnsampledNewCount(41); - tFTransaction2.setUnsampledContinuationCount(51); - tFAgentStat2.setTransaction(tFTransaction2); - - final List tFAgentStatList = List.of( - tFAgentStat, tFAgentStat2 - ); - tFAgentStatBatch.setAgentStats(tFAgentStatList); - - return tFAgentStatBatch; - } - - @Test - public void flatMap4Test() throws Exception { - - ApplicationCache applicationCache = newMockApplicationCache(); - TBaseFlatMapper mapper = new TBaseFlatMapper(new JoinAgentStatBoMapper(), applicationCache, new DefaultTBaseFlatMapperInterceptor()); - - - TFAgentStatBatch tfAgentStatBatch = createTFAgentStatBatch4(); - ArrayList> dataList = new ArrayList<>(); - Collector> collector = new ListCollector<>(dataList); - RawData rawData = newRawData(tfAgentStatBatch); - mapper.flatMap(rawData, collector); - - assertThat(dataList).hasSize(2); - - Tuple3 data1 = dataList.get(0); - assertEquals(data1.f0, AGENT_ID); - assertEquals(data1.f2.longValue(), 1491274143454L); - JoinAgentStatBo joinAgentStatBo = (JoinAgentStatBo) data1.f1; - assertEquals(joinAgentStatBo.getId(), AGENT_ID); - assertEquals(joinAgentStatBo.getAgentStartTimestamp(), 1491274142454L); - assertEquals(joinAgentStatBo.getTimestamp(), 1491274143454L); - assertJoinFileDescriptorBo(joinAgentStatBo.getJoinFileDescriptorBoList()); - - Tuple3 data2 = dataList.get(1); - assertEquals(data2.f0, APPLICATION_ID); - assertEquals(data2.f2.longValue(), 1491274140000L); - JoinApplicationStatBo joinApplicationStatBo = (JoinApplicationStatBo) data2.f1; - assertEquals(joinApplicationStatBo.getId(), APPLICATION_ID); - assertEquals(joinApplicationStatBo.getTimestamp(), 1491274140000L); - assertEquals(joinApplicationStatBo.getStatType(), StatType.APP_STST); - assertJoinFileDescriptorBo(joinApplicationStatBo.getJoinFileDescriptorBoList()); - } - - private void assertJoinFileDescriptorBo(List joinFileDescriptorBoList) { - assertThat(joinFileDescriptorBoList).hasSize(2); - JoinFileDescriptorBo joinFileDescriptorBo = joinFileDescriptorBoList.get(0); - assertEquals(joinFileDescriptorBo.getId(), AGENT_ID); - assertEquals(joinFileDescriptorBo.getTimestamp(), 1491274143454L); - assertEquals(joinFileDescriptorBo.getOpenFdCountJoinValue().getAvg(), 10, 0); - assertEquals(joinFileDescriptorBo.getOpenFdCountJoinValue().getMin(), 10, 0); - assertEquals(joinFileDescriptorBo.getOpenFdCountJoinValue().getMax(), 10, 0); - joinFileDescriptorBo = joinFileDescriptorBoList.get(1); - assertEquals(joinFileDescriptorBo.getId(), AGENT_ID); - assertEquals(joinFileDescriptorBo.getTimestamp(), 1491274148454L); - assertEquals(joinFileDescriptorBo.getOpenFdCountJoinValue().getAvg(), 20, 0); - assertEquals(joinFileDescriptorBo.getOpenFdCountJoinValue().getMin(), 20, 0); - assertEquals(joinFileDescriptorBo.getOpenFdCountJoinValue().getMax(), 20, 0); - } - - private TFAgentStatBatch createTFAgentStatBatch4() { - final TFAgentStatBatch tFAgentStatBatch = new TFAgentStatBatch(); - tFAgentStatBatch.setStartTimestamp(1491274142454L); - tFAgentStatBatch.setAgentId(AGENT_ID); - - final TFAgentStat tFAgentStat = new TFAgentStat(); - tFAgentStat.setAgentId(AGENT_ID); - tFAgentStat.setTimestamp(1491274143454L); - - final TFFileDescriptor tFFileDescriptor = new TFFileDescriptor(); - tFFileDescriptor.setOpenFileDescriptorCount(10); - tFAgentStat.setFileDescriptor(tFFileDescriptor); - - final TFAgentStat tFAgentStat2 = new TFAgentStat(); - tFAgentStat2.setAgentId(AGENT_ID); - tFAgentStat2.setTimestamp(1491274148454L); - - final TFFileDescriptor tFFileDescriptor2 = new TFFileDescriptor(); - tFFileDescriptor2.setOpenFileDescriptorCount(20); - tFAgentStat2.setFileDescriptor(tFFileDescriptor2); - - final List tFAgentStatList = List.of( - tFAgentStat, tFAgentStat2 - ); - tFAgentStatBatch.setAgentStats(tFAgentStatList); - - return tFAgentStatBatch; - } - - - @Test - public void flatMap5Test() throws Exception { - - ApplicationCache applicationCache = newMockApplicationCache(); - TBaseFlatMapper mapper = new TBaseFlatMapper(new JoinAgentStatBoMapper(), applicationCache, new DefaultTBaseFlatMapperInterceptor()); - - - TFAgentStatBatch tfAgentStatBatch = createTFAgentStatBatch5(); - ArrayList> dataList = new ArrayList<>(); - Collector> collector = new ListCollector<>(dataList); - RawData rawData = newRawData(tfAgentStatBatch); - mapper.flatMap(rawData, collector); - - assertThat(dataList).hasSize(2); - - Tuple3 data1 = dataList.get(0); - assertEquals(data1.f0, AGENT_ID); - assertEquals(data1.f2.longValue(), 1491274143454L); - JoinAgentStatBo joinAgentStatBo = (JoinAgentStatBo) data1.f1; - assertEquals(joinAgentStatBo.getId(), AGENT_ID); - assertEquals(joinAgentStatBo.getAgentStartTimestamp(), 1491274142454L); - assertEquals(joinAgentStatBo.getTimestamp(), 1491274143454L); - assertJoinDirectBufferBo(joinAgentStatBo.getJoinDirectBufferBoList()); - - Tuple3 data2 = dataList.get(1); - assertEquals(data2.f0, APPLICATION_ID); - assertEquals(data2.f2.longValue(), 1491274140000L); - JoinApplicationStatBo joinApplicationStatBo = (JoinApplicationStatBo) data2.f1; - assertEquals(joinApplicationStatBo.getId(), APPLICATION_ID); - assertEquals(joinApplicationStatBo.getTimestamp(), 1491274140000L); - assertEquals(joinApplicationStatBo.getStatType(), StatType.APP_STST); - assertJoinDirectBufferBo(joinApplicationStatBo.getJoinDirectBufferBoList()); - } - - private void assertJoinDirectBufferBo(List joinDirectBufferBoList) { - assertThat(joinDirectBufferBoList).hasSize(2); - JoinDirectBufferBo joinDirectBufferBo = joinDirectBufferBoList.get(0); - assertEquals(joinDirectBufferBo.getId(), AGENT_ID); - assertEquals(joinDirectBufferBo.getTimestamp(), 1491274143454L); - JoinLongFieldBo directCountJoinValue = joinDirectBufferBo.getDirectCountJoinValue(); - assertEquals(directCountJoinValue.getAvg(), 10, 0); - assertEquals(directCountJoinValue.getMin(), 10, 0); - assertEquals(directCountJoinValue.getMax(), 10, 0); - JoinLongFieldBo directMemoryUsedJoinValue = joinDirectBufferBo.getDirectMemoryUsedJoinValue(); - assertEquals(directMemoryUsedJoinValue.getAvg(), 20, 0); - assertEquals(directMemoryUsedJoinValue.getMin(), 20, 0); - assertEquals(directMemoryUsedJoinValue.getMax(), 20, 0); - JoinLongFieldBo mappedCountJoinValue = joinDirectBufferBo.getMappedCountJoinValue(); - assertEquals(mappedCountJoinValue.getAvg(), 30, 0); - assertEquals(mappedCountJoinValue.getMin(), 30, 0); - assertEquals(mappedCountJoinValue.getMax(), 30, 0); - JoinLongFieldBo mappedMemoryUsedJoinValue = joinDirectBufferBo.getMappedMemoryUsedJoinValue(); - assertEquals(mappedMemoryUsedJoinValue.getAvg(), 40, 0); - assertEquals(mappedMemoryUsedJoinValue.getMin(), 40, 0); - assertEquals(mappedMemoryUsedJoinValue.getMax(), 40, 0); - joinDirectBufferBo = joinDirectBufferBoList.get(1); - assertEquals(joinDirectBufferBo.getId(), AGENT_ID); - assertEquals(joinDirectBufferBo.getTimestamp(), 1491274148454L); - directCountJoinValue = joinDirectBufferBo.getDirectCountJoinValue(); - assertEquals(directCountJoinValue.getAvg(), 50, 0); - assertEquals(directCountJoinValue.getMin(), 50, 0); - assertEquals(directCountJoinValue.getMax(), 50, 0); - directMemoryUsedJoinValue = joinDirectBufferBo.getDirectMemoryUsedJoinValue(); - assertEquals(directMemoryUsedJoinValue.getAvg(), 60, 0); - assertEquals(directMemoryUsedJoinValue.getMin(), 60, 0); - assertEquals(directMemoryUsedJoinValue.getMax(), 60, 0); - mappedCountJoinValue = joinDirectBufferBo.getMappedCountJoinValue(); - assertEquals(mappedCountJoinValue.getAvg(), 70, 0); - assertEquals(mappedCountJoinValue.getMin(), 70, 0); - assertEquals(mappedCountJoinValue.getMax(), 70, 0); - mappedMemoryUsedJoinValue = joinDirectBufferBo.getMappedMemoryUsedJoinValue(); - assertEquals(mappedMemoryUsedJoinValue.getAvg(), 80, 0); - assertEquals(mappedMemoryUsedJoinValue.getMin(), 80, 0); - assertEquals(mappedMemoryUsedJoinValue.getMax(), 80, 0); - } - - private TFAgentStatBatch createTFAgentStatBatch5() { - final TFAgentStatBatch tFAgentStatBatch = new TFAgentStatBatch(); - tFAgentStatBatch.setStartTimestamp(1491274142454L); - tFAgentStatBatch.setAgentId(AGENT_ID); - - final TFAgentStat tFAgentStat = new TFAgentStat(); - tFAgentStat.setAgentId(AGENT_ID); - tFAgentStat.setTimestamp(1491274143454L); - - final TFDirectBuffer tFDirectBuffer = new TFDirectBuffer(); - tFDirectBuffer.setDirectCount(10); - tFDirectBuffer.setDirectMemoryUsed(20); - tFDirectBuffer.setMappedCount(30); - tFDirectBuffer.setMappedMemoryUsed(40); - tFAgentStat.setDirectBuffer(tFDirectBuffer); - - final TFAgentStat tFAgentStat2 = new TFAgentStat(); - tFAgentStat2.setAgentId(AGENT_ID); - tFAgentStat2.setTimestamp(1491274148454L); - - final TFDirectBuffer tFDirectBuffer2 = new TFDirectBuffer(); - tFDirectBuffer2.setDirectCount(50); - tFDirectBuffer2.setDirectMemoryUsed(60); - tFDirectBuffer2.setMappedCount(70); - tFDirectBuffer2.setMappedMemoryUsed(80); - tFAgentStat2.setDirectBuffer(tFDirectBuffer2); - - final List tFAgentStatList = List.of( - tFAgentStat, tFAgentStat2 - ); - tFAgentStatBatch.setAgentStats(tFAgentStatList); - - return tFAgentStatBatch; - } - -} \ No newline at end of file diff --git a/pom.xml b/pom.xml index 823464a65717..df88f14e42df 100644 --- a/pom.xml +++ b/pom.xml @@ -215,8 +215,6 @@ 1.2.17 - 1.18.0 - 4.0.1 3.0.1 ${jakarta.servlet6.version} diff --git a/spotbugs-exclude.xml b/spotbugs-exclude.xml index 4ba7a8032c28..6b01b2245176 100644 --- a/spotbugs-exclude.xml +++ b/spotbugs-exclude.xml @@ -11,7 +11,6 @@ - diff --git a/thrift/src/main/java/com/navercorp/pinpoint/io/request/FlinkRequest.java b/thrift/src/main/java/com/navercorp/pinpoint/io/request/FlinkRequest.java deleted file mode 100644 index 047946ac66d8..000000000000 --- a/thrift/src/main/java/com/navercorp/pinpoint/io/request/FlinkRequest.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.io.request; - -import java.util.Objects; -import com.navercorp.pinpoint.io.header.HeaderEntity; -import org.apache.thrift.TBase; - -/** - * @author minwoo.jung - */ -public class FlinkRequest { - - private final HeaderEntity headerEntity; - private final TBase data; - - public FlinkRequest(HeaderEntity headerEntity, TBase data) { - this.headerEntity = Objects.requireNonNull(headerEntity, "headerEntity"); - this.data = Objects.requireNonNull(data, "data"); - } - - public HeaderEntity getHeaderEntity() { - return headerEntity; - } - - public TBase getData() { - return data; - } -} diff --git a/web/src/main/java/com/navercorp/pinpoint/web/WebHbaseModule.java b/web/src/main/java/com/navercorp/pinpoint/web/WebHbaseModule.java index ee87cd8d226c..0e19b0bd0259 100644 --- a/web/src/main/java/com/navercorp/pinpoint/web/WebHbaseModule.java +++ b/web/src/main/java/com/navercorp/pinpoint/web/WebHbaseModule.java @@ -8,7 +8,6 @@ import com.navercorp.pinpoint.web.applicationmap.config.MapHbaseConfiguration; import com.navercorp.pinpoint.web.dao.hbase.config.AgentStatDaoConfiguration; import com.navercorp.pinpoint.web.dao.hbase.config.AgentStatOperationConfiguration; -import com.navercorp.pinpoint.web.dao.hbase.config.ApplicationMetricConfiguration; import com.navercorp.pinpoint.web.dao.hbase.config.SampledAgentStatDaoConfiguration; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -24,7 +23,6 @@ AgentStatDaoConfiguration.class, AgentStatOperationConfiguration.class, - ApplicationMetricConfiguration.class, SampledAgentStatDaoConfiguration.class, HbaseNamespaceConfiguration.class, diff --git a/web/src/main/java/com/navercorp/pinpoint/web/authorization/controller/ApplicationDataSourceController.java b/web/src/main/java/com/navercorp/pinpoint/web/authorization/controller/ApplicationDataSourceController.java deleted file mode 100644 index c93e16b0c2e1..000000000000 --- a/web/src/main/java/com/navercorp/pinpoint/web/authorization/controller/ApplicationDataSourceController.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.navercorp.pinpoint.web.authorization.controller; - -import com.navercorp.pinpoint.common.server.util.time.Range; -import com.navercorp.pinpoint.common.server.util.timewindow.TimeWindowSampler; -import com.navercorp.pinpoint.web.service.appmetric.ApplicationDataSourceService; -import com.navercorp.pinpoint.common.server.util.timewindow.TimeWindow; -import com.navercorp.pinpoint.common.server.util.timewindow.TimeWindowSlotCentricSampler; -import com.navercorp.pinpoint.web.vo.stat.chart.StatChart; -import jakarta.validation.constraints.NotBlank; -import jakarta.validation.constraints.PositiveOrZero; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; - -import java.util.List; - -@RestController -@RequestMapping("/api") -@Validated -public class ApplicationDataSourceController { - private final Logger logger = LogManager.getLogger(this.getClass()); - private final TimeWindowSampler defaultTimeWindowSampler = new TimeWindowSlotCentricSampler(); - - private final ApplicationDataSourceService applicationDataSourceService; - - public ApplicationDataSourceController(ApplicationDataSourceService applicationDataSourceService) { - this.applicationDataSourceService = applicationDataSourceService; - } - - @GetMapping("/getApplicationStat/dataSource/chart") - public List getAgentStatChart( - @RequestParam("applicationId") @NotBlank String applicationId, - @RequestParam("from") @PositiveOrZero long from, - @RequestParam("to") @PositiveOrZero long to - ) { - TimeWindow timeWindow = new TimeWindow(Range.between(from, to), defaultTimeWindowSampler); - try { - return this.applicationDataSourceService.selectApplicationChart(applicationId, timeWindow); - } catch (Exception e ) { - logger.error("error" , e); - throw e; - } - } -} diff --git a/web/src/main/java/com/navercorp/pinpoint/web/dao/hbase/appmetric/DefaultApplicationMetricDao.java b/web/src/main/java/com/navercorp/pinpoint/web/dao/hbase/appmetric/DefaultApplicationMetricDao.java deleted file mode 100644 index 1a40bb4c6294..000000000000 --- a/web/src/main/java/com/navercorp/pinpoint/web/dao/hbase/appmetric/DefaultApplicationMetricDao.java +++ /dev/null @@ -1,71 +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.web.dao.hbase.appmetric; - -import com.navercorp.pinpoint.common.hbase.ResultsExtractor; -import com.navercorp.pinpoint.common.hbase.RowMapper; -import com.navercorp.pinpoint.common.server.bo.codec.stat.ApplicationStatDecoder; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinStatBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.StatType; -import com.navercorp.pinpoint.common.server.util.time.Range; -import com.navercorp.pinpoint.web.dao.appmetric.ApplicationMetricDao; -import com.navercorp.pinpoint.web.mapper.stat.SampledApplicationStatResultExtractor; -import com.navercorp.pinpoint.web.mapper.stat.sampling.sampler.ApplicationStatSampler; -import com.navercorp.pinpoint.common.server.util.timewindow.TimeWindow; -import com.navercorp.pinpoint.web.vo.stat.AggregationStatData; - -import java.util.List; -import java.util.Objects; - -/** - * @author minwoo.jung - */ -public class DefaultApplicationMetricDao implements ApplicationMetricDao { - - private final StatType statType; - private final ApplicationStatDecoder decoder; - - private final ApplicationStatSampler sampler; - - private final HbaseApplicationStatDaoOperations operations; - - public DefaultApplicationMetricDao(StatType statType, - ApplicationStatDecoder decoder, - ApplicationStatSampler sampler, - HbaseApplicationStatDaoOperations operations) { - this.statType = Objects.requireNonNull(statType, "statType"); - this.decoder = Objects.requireNonNull(decoder, "decoder"); - this.sampler = Objects.requireNonNull(sampler, "sampler"); - this.operations = Objects.requireNonNull(operations, "operations"); - } - - @Override - public List getApplicationStatList(String applicationId, TimeWindow timeWindow) { - Objects.requireNonNull(applicationId, "applicationId"); - Objects.requireNonNull(timeWindow, "timeWindow"); - - Range range = timeWindow.getWindowSlotRange(); - - RowMapper> mapper = operations.createRowMapper(decoder, range); - ResultsExtractor> resultExtractor = new SampledApplicationStatResultExtractor<>(timeWindow, mapper, sampler); - return operations.getSampledStatList(statType, resultExtractor, applicationId, range); - } - - @Override - public String getChartType() { - return this.statType.getChartType(); - } -} diff --git a/web/src/main/java/com/navercorp/pinpoint/web/dao/hbase/appmetric/HbaseApplicationStatDaoOperations.java b/web/src/main/java/com/navercorp/pinpoint/web/dao/hbase/appmetric/HbaseApplicationStatDaoOperations.java deleted file mode 100644 index 721d140b411f..000000000000 --- a/web/src/main/java/com/navercorp/pinpoint/web/dao/hbase/appmetric/HbaseApplicationStatDaoOperations.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright 2022 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.web.dao.hbase.appmetric; - -import com.navercorp.pinpoint.common.hbase.HbaseColumnFamily; -import com.navercorp.pinpoint.common.hbase.HbaseOperations; -import com.navercorp.pinpoint.common.hbase.ResultsExtractor; -import com.navercorp.pinpoint.common.hbase.RowMapper; -import com.navercorp.pinpoint.common.hbase.TableNameProvider; -import com.navercorp.pinpoint.common.server.bo.codec.stat.ApplicationStatDecoder; -import com.navercorp.pinpoint.common.server.bo.serializer.stat.ApplicationStatHbaseOperationFactory; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinStatBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.StatType; -import com.navercorp.pinpoint.common.server.util.time.Range; -import com.navercorp.pinpoint.web.dao.hbase.HBaseUtils; -import com.navercorp.pinpoint.web.mapper.RangeTimestampFilter; -import com.navercorp.pinpoint.web.mapper.TimestampFilter; -import com.navercorp.pinpoint.web.mapper.stat.ApplicationStatMapper; -import com.navercorp.pinpoint.web.vo.stat.AggregationStatData; -import org.apache.hadoop.hbase.TableName; -import org.apache.hadoop.hbase.client.Scan; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; -import org.springframework.stereotype.Component; - -import java.util.List; -import java.util.Objects; - -/** - * @author Minwoo Jung - */ -@Component -public class HbaseApplicationStatDaoOperations { - - private static final int APPLICATION_STAT_NUM_PARTITIONS = 32; - private static final int MAX_SCAN_CACHE_SIZE = 256; - - private final Logger logger = LogManager.getLogger(this.getClass()); - private static final HbaseColumnFamily.ApplicationStatStatistics DESCRIPTOR = HbaseColumnFamily.APPLICATION_STAT_STATISTICS; - - private final HbaseOperations hbaseOperations; - private final TableNameProvider tableNameProvider; - - private final ApplicationStatHbaseOperationFactory operationFactory; - - public HbaseApplicationStatDaoOperations(HbaseOperations hbaseOperations, - TableNameProvider tableNameProvider, - ApplicationStatHbaseOperationFactory operationFactory) { - this.hbaseOperations = Objects.requireNonNull(hbaseOperations, "hbaseOperations"); - this.tableNameProvider = Objects.requireNonNull(tableNameProvider, "tableNameProvider"); - this.operationFactory = Objects.requireNonNull(operationFactory, "operationFactory"); - } - - List getSampledStatList(StatType statType, - ResultsExtractor> resultExtractor, - String applicationId, Range range) { - Objects.requireNonNull(applicationId, "applicationId"); - Objects.requireNonNull(resultExtractor, "resultExtractor"); - Objects.requireNonNull(range, "range"); - - Scan scan = this.createScan(statType, applicationId, range); - - TableName applicationStatAggreTableName = tableNameProvider.getTableName(DESCRIPTOR.getTable()); - return hbaseOperations.findParallel(applicationStatAggreTableName, scan, this.operationFactory.getRowKeyDistributor(), resultExtractor, APPLICATION_STAT_NUM_PARTITIONS); - } - - RowMapper> createRowMapper(ApplicationStatDecoder decoder, Range range) { - TimestampFilter filter = new RangeTimestampFilter(range); - return new ApplicationStatMapper<>(this.operationFactory, decoder, filter); - } - - private Scan createScan(StatType statType, String applicationId, Range range) { - int scanCacheSize = HBaseUtils.getScanCacheSize(range, DESCRIPTOR.TIMESPAN_MS, MAX_SCAN_CACHE_SIZE); - return this.createScan(statType, applicationId, range, scanCacheSize); - } - - private Scan createScan(StatType statType, String applicationId, Range range, int scanCacheSize) { - Scan scan = this.operationFactory.createScan(applicationId, statType, range.getFrom(), range.getTo()); - scan.setCaching(scanCacheSize); - scan.setId("ApplicationStat_" + statType); - scan.addFamily(DESCRIPTOR.getName()); - return scan; - } - -} diff --git a/web/src/main/java/com/navercorp/pinpoint/web/dao/hbase/config/ApplicationMetricConfiguration.java b/web/src/main/java/com/navercorp/pinpoint/web/dao/hbase/config/ApplicationMetricConfiguration.java deleted file mode 100644 index f1278a143a1e..000000000000 --- a/web/src/main/java/com/navercorp/pinpoint/web/dao/hbase/config/ApplicationMetricConfiguration.java +++ /dev/null @@ -1,112 +0,0 @@ -package com.navercorp.pinpoint.web.dao.hbase.config; - -import com.navercorp.pinpoint.common.server.bo.codec.stat.ApplicationStatDecoder; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinActiveTraceBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinCpuLoadBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinDataSourceListBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinDirectBufferBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinFileDescriptorBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinLoadedClassBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinMemoryBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinResponseTimeBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinStatBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinTotalThreadCountBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinTransactionBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.StatType; -import com.navercorp.pinpoint.web.dao.appmetric.ApplicationMetricDao; -import com.navercorp.pinpoint.web.dao.hbase.appmetric.DefaultApplicationMetricDao; -import com.navercorp.pinpoint.web.dao.hbase.appmetric.HbaseApplicationStatDaoOperations; -import com.navercorp.pinpoint.web.mapper.stat.sampling.sampler.ApplicationStatSampler; -import com.navercorp.pinpoint.web.vo.stat.AggreJoinActiveTraceBo; -import com.navercorp.pinpoint.web.vo.stat.AggreJoinCpuLoadBo; -import com.navercorp.pinpoint.web.vo.stat.AggreJoinDataSourceListBo; -import com.navercorp.pinpoint.web.vo.stat.AggreJoinDirectBufferBo; -import com.navercorp.pinpoint.web.vo.stat.AggreJoinFileDescriptorBo; -import com.navercorp.pinpoint.web.vo.stat.AggreJoinLoadedClassBo; -import com.navercorp.pinpoint.web.vo.stat.AggreJoinMemoryBo; -import com.navercorp.pinpoint.web.vo.stat.AggreJoinResponseTimeBo; -import com.navercorp.pinpoint.web.vo.stat.AggreJoinTotalThreadCountBo; -import com.navercorp.pinpoint.web.vo.stat.AggreJoinTransactionBo; -import com.navercorp.pinpoint.web.vo.stat.AggregationStatData; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -import java.util.Objects; - -@Configuration -public class ApplicationMetricConfiguration { - private final HbaseApplicationStatDaoOperations operations; - - public ApplicationMetricConfiguration(HbaseApplicationStatDaoOperations operations) { - this.operations = Objects.requireNonNull(operations, "operations"); - } - - private ApplicationMetricDao newApplicationMetricDao(StatType statType, - ApplicationStatDecoder decoder, - ApplicationStatSampler sampler) { - Objects.requireNonNull(statType, "statType"); - Objects.requireNonNull(decoder, "decoder"); - Objects.requireNonNull(sampler, "sampler"); - return new DefaultApplicationMetricDao<>(statType, decoder, sampler, operations); - } - - @Bean - public ApplicationMetricDao getApplicationActiveTraceDao(ApplicationStatDecoder decoder, - ApplicationStatSampler sampler) { - return newApplicationMetricDao(StatType.APP_ACTIVE_TRACE_COUNT, decoder, sampler); - } - - @Bean - public ApplicationMetricDao getApplicationCpuLoadDao(ApplicationStatDecoder decoder, - ApplicationStatSampler sampler) { - return newApplicationMetricDao(StatType.APP_CPU_LOAD, decoder, sampler); - } - - @Bean - public ApplicationMetricDao getApplicationDataSourceDao(ApplicationStatDecoder decoder, - ApplicationStatSampler sampler) { - return newApplicationMetricDao(StatType.APP_DATA_SOURCE, decoder, sampler); - } - - @Bean - public ApplicationMetricDao getApplicationDirectBufferDao(ApplicationStatDecoder decoder, - ApplicationStatSampler sampler) { - return newApplicationMetricDao(StatType.APP_DIRECT_BUFFER, decoder, sampler); - } - - @Bean - public ApplicationMetricDao getApplicationFileDescriptorDao(ApplicationStatDecoder decoder, - ApplicationStatSampler sampler) { - return newApplicationMetricDao(StatType.APP_FILE_DESCRIPTOR, decoder, sampler); - } - - @Bean - public ApplicationMetricDao getApplicationLoadedClassDao(ApplicationStatDecoder decoder, - ApplicationStatSampler sampler) { - return newApplicationMetricDao(StatType.APP_LOADED_CLASS, decoder, sampler); - } - - @Bean - public ApplicationMetricDao getApplicationMemoryDao(ApplicationStatDecoder decoder, - ApplicationStatSampler sampler) { - return newApplicationMetricDao(StatType.APP_MEMORY_USED, decoder, sampler); - } - - @Bean - public ApplicationMetricDao getApplicationResponseTimeDao(ApplicationStatDecoder decoder, - ApplicationStatSampler sampler) { - return newApplicationMetricDao(StatType.APP_RESPONSE_TIME, decoder, sampler); - } - - @Bean - public ApplicationMetricDao getApplicationTotalThreadCountDao(ApplicationStatDecoder decoder, - ApplicationStatSampler sampler) { - return newApplicationMetricDao(StatType.APP_TOTAL_THREAD_COUNT, decoder, sampler); - } - - @Bean - public ApplicationMetricDao getApplicationTransactionDao(ApplicationStatDecoder decoder, - ApplicationStatSampler sampler) { - return newApplicationMetricDao(StatType.APP_TRANSACTION_COUNT, decoder, sampler); - } -} diff --git a/web/src/main/java/com/navercorp/pinpoint/web/mapper/stat/ApplicationStatMapper.java b/web/src/main/java/com/navercorp/pinpoint/web/mapper/stat/ApplicationStatMapper.java deleted file mode 100644 index 3aa3967838c5..000000000000 --- a/web/src/main/java/com/navercorp/pinpoint/web/mapper/stat/ApplicationStatMapper.java +++ /dev/null @@ -1,92 +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.web.mapper.stat; - -import com.navercorp.pinpoint.common.buffer.Buffer; -import com.navercorp.pinpoint.common.buffer.OffsetFixedBuffer; -import com.navercorp.pinpoint.common.hbase.HbaseColumnFamily; -import com.navercorp.pinpoint.common.hbase.RowMapper; -import com.navercorp.pinpoint.common.server.bo.codec.stat.ApplicationStatDecoder; -import com.navercorp.pinpoint.common.server.bo.serializer.stat.ApplicationStatDecodingContext; -import com.navercorp.pinpoint.common.server.bo.serializer.stat.ApplicationStatHbaseOperationFactory; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinStatBo; -import com.navercorp.pinpoint.web.mapper.TimestampFilter; - -import org.apache.hadoop.hbase.Cell; -import org.apache.hadoop.hbase.CellUtil; -import org.apache.hadoop.hbase.client.Result; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.List; - -/** - * @author minwoo.jung - */ -public class ApplicationStatMapper implements RowMapper> { - - public final static Comparator REVERSE_TIMESTAMP_COMPARATOR - = Comparator.comparingLong(JoinStatBo::getTimestamp).reversed(); - - private final ApplicationStatHbaseOperationFactory hbaseOperationFactory; - private final ApplicationStatDecoder decoder; - private final TimestampFilter filter; - - public ApplicationStatMapper(ApplicationStatHbaseOperationFactory hbaseOperationFactory, ApplicationStatDecoder decoder, TimestampFilter filter) { - this.hbaseOperationFactory = hbaseOperationFactory; - this.decoder = decoder; - this.filter = filter; - } - - @Override - public List mapRow(Result result, int rowNum) throws Exception { - if (result.isEmpty()) { - return Collections.emptyList(); - } - final byte[] distributedRowKey = result.getRow(); - final String applicationId = this.hbaseOperationFactory.getApplicationId(distributedRowKey); - final long baseTimestamp = this.hbaseOperationFactory.getBaseTimestamp(distributedRowKey); - - List dataPoints = new ArrayList<>(); - - for (Cell cell : result.rawCells()) { - if (CellUtil.matchingFamily(cell, HbaseColumnFamily.APPLICATION_STAT_STATISTICS.getName())) { - Buffer qualifierBuffer = new OffsetFixedBuffer(cell.getQualifierArray(), cell.getQualifierOffset(), cell.getQualifierLength()); - Buffer valueBuffer = new OffsetFixedBuffer(cell.getValueArray(), cell.getValueOffset(), cell.getValueLength()); - - long timestampDelta = this.decoder.decodeQualifier(qualifierBuffer); - - ApplicationStatDecodingContext decodingContext = new ApplicationStatDecodingContext(); - decodingContext.setApplicationId(applicationId); - decodingContext.setBaseTimestamp(baseTimestamp); - decodingContext.setTimestampDelta(timestampDelta); - List candidates = this.decoder.decodeValue(valueBuffer, decodingContext); - for (T candidate : candidates) { - long timestamp = candidate.getTimestamp(); - if (this.filter.filter(timestamp)) { - continue; - } - dataPoints.add(candidate); - } - } - } - // Reverse sort as timestamp is stored in a reversed order. - dataPoints.sort(REVERSE_TIMESTAMP_COMPARATOR); - return dataPoints; - } -} - diff --git a/web/src/main/java/com/navercorp/pinpoint/web/mapper/stat/sampling/sampler/JoinActiveTraceSampler.java b/web/src/main/java/com/navercorp/pinpoint/web/mapper/stat/sampling/sampler/JoinActiveTraceSampler.java deleted file mode 100644 index 87e41ff406d9..000000000000 --- a/web/src/main/java/com/navercorp/pinpoint/web/mapper/stat/sampling/sampler/JoinActiveTraceSampler.java +++ /dev/null @@ -1,47 +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.web.mapper.stat.sampling.sampler; - -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinActiveTraceBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinIntFieldBo; -import com.navercorp.pinpoint.web.vo.stat.AggreJoinActiveTraceBo; - -import org.apache.commons.collections4.CollectionUtils; -import org.springframework.stereotype.Component; - -import java.util.List; - -/** - * @author minwoo.jung - */ -@Component -public class JoinActiveTraceSampler implements ApplicationStatSampler { - - @Override - public AggreJoinActiveTraceBo sampleDataPoints(int index, long timestamp, List joinActiveTraceBoList, JoinActiveTraceBo previousDataPoint) { - if (CollectionUtils.isEmpty(joinActiveTraceBoList)) { - return AggreJoinActiveTraceBo.createUncollectedObject(timestamp); - } - - JoinActiveTraceBo joinActiveTraceBo = JoinActiveTraceBo.joinActiveTraceBoList(joinActiveTraceBoList, timestamp); - String id = joinActiveTraceBo.getId(); - int histogramSchemaType = joinActiveTraceBo.getHistogramSchemaType(); - short version = joinActiveTraceBo.getVersion(); - JoinIntFieldBo totalCountValue = joinActiveTraceBo.getTotalCountJoinValue(); - - return new AggreJoinActiveTraceBo(id, histogramSchemaType, version, totalCountValue, timestamp); - } -} diff --git a/web/src/main/java/com/navercorp/pinpoint/web/mapper/stat/sampling/sampler/JoinCpuLoadSampler.java b/web/src/main/java/com/navercorp/pinpoint/web/mapper/stat/sampling/sampler/JoinCpuLoadSampler.java deleted file mode 100644 index 3b1202f2e534..000000000000 --- a/web/src/main/java/com/navercorp/pinpoint/web/mapper/stat/sampling/sampler/JoinCpuLoadSampler.java +++ /dev/null @@ -1,64 +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.web.mapper.stat.sampling.sampler; - -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinCpuLoadBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinDoubleFieldBo; -import com.navercorp.pinpoint.web.vo.stat.AggreJoinCpuLoadBo; -import org.apache.commons.collections4.CollectionUtils; -import org.apache.commons.math3.util.Precision; -import org.springframework.stereotype.Component; - -import java.util.List; - -/** - * @author minwoo.jung - */ -@Component -public class JoinCpuLoadSampler implements ApplicationStatSampler { - - @Override - public AggreJoinCpuLoadBo sampleDataPoints(int timeWindowIndex, long timestamp, List joinCpuLoadBoList, JoinCpuLoadBo previousDataPoint) { - if (CollectionUtils.isEmpty(joinCpuLoadBoList)) { - return AggreJoinCpuLoadBo.createUncollectedObject(timestamp); - } - - JoinCpuLoadBo joinCpuLoadBo = JoinCpuLoadBo.joinCpuLoadBoList(joinCpuLoadBoList, timestamp); - - String id = joinCpuLoadBo.getId(); - - final JoinDoubleFieldBo jvmCpuLoadJoinValue = joinCpuLoadBo.getJvmCpuLoadJoinValue(); - double jvmCpuLoad = roundToScale(jvmCpuLoadJoinValue.getAvg() * 100); - double minJvmCpuLoad = roundToScale(jvmCpuLoadJoinValue.getMin() * 100); - String minJvmCpuAgentId = jvmCpuLoadJoinValue.getMinAgentId(); - double maxJvmCpuLoad = roundToScale(jvmCpuLoadJoinValue.getMax() * 100); - String maxJvmCpuAgentId = jvmCpuLoadJoinValue.getMaxAgentId(); - - final JoinDoubleFieldBo systemCpuLoadJoinValue = joinCpuLoadBo.getSystemCpuLoadJoinValue(); - double sysCpuLoad = roundToScale(systemCpuLoadJoinValue.getAvg() * 100); - double minSysCpuLoad = roundToScale(systemCpuLoadJoinValue.getMin() * 100); - String minSysCpuAgentId = systemCpuLoadJoinValue.getMinAgentId(); - double maxSysCpuLoad = roundToScale(systemCpuLoadJoinValue.getMax() * 100); - String maxSysCpuAgentId = systemCpuLoadJoinValue.getMaxAgentId(); - - return new AggreJoinCpuLoadBo(id, jvmCpuLoad, maxJvmCpuLoad, maxJvmCpuAgentId, minJvmCpuLoad, minJvmCpuAgentId, sysCpuLoad, maxSysCpuLoad, maxSysCpuAgentId, minSysCpuLoad, minSysCpuAgentId, timestamp); - } - - private double roundToScale(double value) { - return Precision.round(value, 1); - } - -} diff --git a/web/src/main/java/com/navercorp/pinpoint/web/mapper/stat/sampling/sampler/JoinDataSourceSampler.java b/web/src/main/java/com/navercorp/pinpoint/web/mapper/stat/sampling/sampler/JoinDataSourceSampler.java deleted file mode 100644 index 074ecf9d9a9e..000000000000 --- a/web/src/main/java/com/navercorp/pinpoint/web/mapper/stat/sampling/sampler/JoinDataSourceSampler.java +++ /dev/null @@ -1,56 +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.web.mapper.stat.sampling.sampler; - -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinDataSourceBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinDataSourceListBo; -import com.navercorp.pinpoint.web.vo.stat.AggreJoinDataSourceBo; -import com.navercorp.pinpoint.web.vo.stat.AggreJoinDataSourceListBo; -import org.apache.commons.collections4.CollectionUtils; -import org.springframework.stereotype.Component; - -import java.util.ArrayList; -import java.util.List; - -/** - * @author minwoo.jung - */ -@Component -public class JoinDataSourceSampler implements ApplicationStatSampler { - - @Override - public AggreJoinDataSourceListBo sampleDataPoints(int index, long timestamp, List joinDataSourceListBoList, JoinDataSourceListBo previousJoinDataSourceListBo) { - if (CollectionUtils.isEmpty(joinDataSourceListBoList)) { - return AggreJoinDataSourceListBo.createUncollectedObject(timestamp); - } - - JoinDataSourceListBo joinDataSourceListBo = JoinDataSourceListBo.joinDataSourceListBoList(joinDataSourceListBoList, timestamp); - String id = joinDataSourceListBo.getId(); - List joinDataSourceBoList = joinDataSourceListBo.getJoinDataSourceBoList(); - List aggreJoinDataSourceBoList = getJoinDataSourceBoList(timestamp, joinDataSourceBoList); - - return new AggreJoinDataSourceListBo(id, aggreJoinDataSourceBoList, timestamp); - } - - public List getJoinDataSourceBoList(long timestamp, List joinDataSourceBoList) { - List aggreJoinDataSourceBoList = new ArrayList<>(joinDataSourceBoList.size()); - for (JoinDataSourceBo ds : joinDataSourceBoList) { - AggreJoinDataSourceBo dataSourceBo = new AggreJoinDataSourceBo(ds.getServiceTypeCode(), ds.getUrl(), ds.getActiveConnectionSizeJoinValue(), timestamp); - aggreJoinDataSourceBoList.add(dataSourceBo); - } - return aggreJoinDataSourceBoList; - } -} diff --git a/web/src/main/java/com/navercorp/pinpoint/web/mapper/stat/sampling/sampler/JoinDirectBufferSampler.java b/web/src/main/java/com/navercorp/pinpoint/web/mapper/stat/sampling/sampler/JoinDirectBufferSampler.java deleted file mode 100644 index 8357b9f7210f..000000000000 --- a/web/src/main/java/com/navercorp/pinpoint/web/mapper/stat/sampling/sampler/JoinDirectBufferSampler.java +++ /dev/null @@ -1,48 +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.web.mapper.stat.sampling.sampler; - -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinDirectBufferBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinLongFieldBo; -import com.navercorp.pinpoint.web.vo.stat.AggreJoinDirectBufferBo; -import org.apache.commons.collections4.CollectionUtils; -import org.springframework.stereotype.Component; - -import java.util.List; - -/** - * @author Roy Kim - */ -@Component -public class JoinDirectBufferSampler implements ApplicationStatSampler { - - @Override - public AggreJoinDirectBufferBo sampleDataPoints(int timeWindowIndex, long timestamp, List joinDirectBufferBoList, JoinDirectBufferBo previousDataPoint) { - if (CollectionUtils.isEmpty(joinDirectBufferBoList)) { - return AggreJoinDirectBufferBo.createUncollectedObject(timestamp); - } - - JoinDirectBufferBo joinDirectBufferBo = JoinDirectBufferBo.joinDirectBufferBoList(joinDirectBufferBoList, timestamp); - - String id = joinDirectBufferBo.getId(); - final JoinLongFieldBo directCountJoinValue = joinDirectBufferBo.getDirectCountJoinValue(); - final JoinLongFieldBo directMemoryUsedJoinValue = joinDirectBufferBo.getDirectMemoryUsedJoinValue(); - final JoinLongFieldBo mappedCountJoinValue = joinDirectBufferBo.getMappedCountJoinValue(); - final JoinLongFieldBo mappedMemoryUsedJoinValue = joinDirectBufferBo.getMappedMemoryUsedJoinValue(); - - return new AggreJoinDirectBufferBo(id, directCountJoinValue, directMemoryUsedJoinValue, mappedCountJoinValue, mappedMemoryUsedJoinValue, timestamp); - } -} diff --git a/web/src/main/java/com/navercorp/pinpoint/web/mapper/stat/sampling/sampler/JoinFileDescriptorSampler.java b/web/src/main/java/com/navercorp/pinpoint/web/mapper/stat/sampling/sampler/JoinFileDescriptorSampler.java deleted file mode 100644 index ca4848dc1cd6..000000000000 --- a/web/src/main/java/com/navercorp/pinpoint/web/mapper/stat/sampling/sampler/JoinFileDescriptorSampler.java +++ /dev/null @@ -1,46 +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.web.mapper.stat.sampling.sampler; - -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinFileDescriptorBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinLongFieldBo; -import com.navercorp.pinpoint.web.vo.stat.AggreJoinFileDescriptorBo; - -import org.apache.commons.collections4.CollectionUtils; -import org.springframework.stereotype.Component; - -import java.util.List; - -/** - * @author Roy Kim - */ -@Component -public class JoinFileDescriptorSampler implements ApplicationStatSampler { - - @Override - public AggreJoinFileDescriptorBo sampleDataPoints(int timeWindowIndex, long timestamp, List joinFileDescriptorBoList, JoinFileDescriptorBo previousDataPoint) { - if (CollectionUtils.isEmpty(joinFileDescriptorBoList)) { - return AggreJoinFileDescriptorBo.createUncollectedObject(timestamp); - } - - JoinFileDescriptorBo joinFileDescriptorBo = JoinFileDescriptorBo.joinFileDescriptorBoList(joinFileDescriptorBoList, timestamp); - - String id = joinFileDescriptorBo.getId(); - final JoinLongFieldBo openFdCountJoinValue = joinFileDescriptorBo.getOpenFdCountJoinValue(); - - return new AggreJoinFileDescriptorBo(id, openFdCountJoinValue, timestamp); - } -} diff --git a/web/src/main/java/com/navercorp/pinpoint/web/mapper/stat/sampling/sampler/JoinLoadedClassSampler.java b/web/src/main/java/com/navercorp/pinpoint/web/mapper/stat/sampling/sampler/JoinLoadedClassSampler.java deleted file mode 100644 index 3a5909967664..000000000000 --- a/web/src/main/java/com/navercorp/pinpoint/web/mapper/stat/sampling/sampler/JoinLoadedClassSampler.java +++ /dev/null @@ -1,44 +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.web.mapper.stat.sampling.sampler; - -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinLoadedClassBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinLongFieldBo; -import com.navercorp.pinpoint.web.vo.stat.AggreJoinLoadedClassBo; -import org.apache.commons.collections4.CollectionUtils; -import org.springframework.stereotype.Component; - -import java.util.List; - -@Component -public class JoinLoadedClassSampler implements ApplicationStatSampler { - - @Override - public AggreJoinLoadedClassBo sampleDataPoints(int timeWindowIndex, long timestamp, List joinLoadedClassBoList, JoinLoadedClassBo previousDataPoint) { - if (CollectionUtils.isEmpty(joinLoadedClassBoList)) { - return AggreJoinLoadedClassBo.createUncollectedObject(timestamp); - } - - JoinLoadedClassBo joinLoadedClassBo = AggreJoinLoadedClassBo.joinLoadedClassBoList(joinLoadedClassBoList, timestamp); - - String id = joinLoadedClassBo.getId(); - JoinLongFieldBo loadedClassJoinValue = joinLoadedClassBo.getLoadedClassJoinValue(); - JoinLongFieldBo unloadedClassJoinValue = joinLoadedClassBo.getUnloadedClassJoinValue(); - - return new AggreJoinLoadedClassBo(id, loadedClassJoinValue, unloadedClassJoinValue, timestamp); - } -} diff --git a/web/src/main/java/com/navercorp/pinpoint/web/mapper/stat/sampling/sampler/JoinMemorySampler.java b/web/src/main/java/com/navercorp/pinpoint/web/mapper/stat/sampling/sampler/JoinMemorySampler.java deleted file mode 100644 index dbd9a2c9c2ca..000000000000 --- a/web/src/main/java/com/navercorp/pinpoint/web/mapper/stat/sampling/sampler/JoinMemorySampler.java +++ /dev/null @@ -1,46 +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.web.mapper.stat.sampling.sampler; - -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinLongFieldBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinMemoryBo; -import com.navercorp.pinpoint.web.vo.stat.AggreJoinMemoryBo; - -import org.apache.commons.collections4.CollectionUtils; -import org.springframework.stereotype.Component; - -import java.util.List; - -/** - * @author minwoo.jung - */ -@Component -public class JoinMemorySampler implements ApplicationStatSampler { - - @Override - public AggreJoinMemoryBo sampleDataPoints(int index, long timestamp, List joinMemoryBoList, JoinMemoryBo previousDataPoint) { - if (CollectionUtils.isEmpty(joinMemoryBoList)) { - return AggreJoinMemoryBo.createUncollectedObject(timestamp); - } - - JoinMemoryBo joinMemoryBo = JoinMemoryBo.joinMemoryBoList(joinMemoryBoList, timestamp); - String id = joinMemoryBo.getId(); - final JoinLongFieldBo heapUsedJoinValue = joinMemoryBo.getHeapUsedJoinValue(); - final JoinLongFieldBo nonHeapUsedJoinValue = joinMemoryBo.getNonHeapUsedJoinValue(); - - return new AggreJoinMemoryBo(id, timestamp, heapUsedJoinValue, nonHeapUsedJoinValue); - } -} diff --git a/web/src/main/java/com/navercorp/pinpoint/web/mapper/stat/sampling/sampler/JoinResponseTimeSampler.java b/web/src/main/java/com/navercorp/pinpoint/web/mapper/stat/sampling/sampler/JoinResponseTimeSampler.java deleted file mode 100644 index dbc61de01d71..000000000000 --- a/web/src/main/java/com/navercorp/pinpoint/web/mapper/stat/sampling/sampler/JoinResponseTimeSampler.java +++ /dev/null @@ -1,45 +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.web.mapper.stat.sampling.sampler; - -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinLongFieldBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinResponseTimeBo; -import com.navercorp.pinpoint.web.vo.stat.AggreJoinResponseTimeBo; - -import org.apache.commons.collections4.CollectionUtils; -import org.springframework.stereotype.Component; - -import java.util.List; - -/** - * @author minwoo.jung - */ -@Component -public class JoinResponseTimeSampler implements ApplicationStatSampler { - - @Override - public AggreJoinResponseTimeBo sampleDataPoints(int index, long timestamp, List joinResponseTimeBoList, JoinResponseTimeBo previousDataPoint) { - if (CollectionUtils.isEmpty(joinResponseTimeBoList)) { - return AggreJoinResponseTimeBo.createUncollectedObject(timestamp); - } - - JoinResponseTimeBo joinResponseTimeBo = JoinResponseTimeBo.joinResponseTimeBoList(joinResponseTimeBoList, timestamp); - String id = joinResponseTimeBo.getId(); - JoinLongFieldBo responseTimeJoinValue = joinResponseTimeBo.getResponseTimeJoinValue(); - - return new AggreJoinResponseTimeBo(id, timestamp, responseTimeJoinValue); - } -} diff --git a/web/src/main/java/com/navercorp/pinpoint/web/mapper/stat/sampling/sampler/JoinTotalThreadCountSampler.java b/web/src/main/java/com/navercorp/pinpoint/web/mapper/stat/sampling/sampler/JoinTotalThreadCountSampler.java deleted file mode 100644 index 85a21c5514db..000000000000 --- a/web/src/main/java/com/navercorp/pinpoint/web/mapper/stat/sampling/sampler/JoinTotalThreadCountSampler.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.web.mapper.stat.sampling.sampler; - -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinLongFieldBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinTotalThreadCountBo; -import com.navercorp.pinpoint.web.vo.stat.AggreJoinTotalThreadCountBo; -import org.apache.commons.collections4.CollectionUtils; -import org.springframework.stereotype.Component; - -import java.util.List; - -@Component -public class JoinTotalThreadCountSampler implements ApplicationStatSampler { - @Override - public AggreJoinTotalThreadCountBo sampleDataPoints(int index, long timestamp, List dataPoints, JoinTotalThreadCountBo previousDataPoint) { - if(CollectionUtils.isEmpty(dataPoints)) { - return AggreJoinTotalThreadCountBo.createUncollectedObject(timestamp); - } - JoinTotalThreadCountBo joinTotalThreadCountBo = JoinTotalThreadCountBo.joinTotalThreadCountBoList(dataPoints, timestamp); - - String id = joinTotalThreadCountBo.getId(); - final JoinLongFieldBo totalThreadCountJoinValue = joinTotalThreadCountBo.getTotalThreadCountJoinValue(); - - return new AggreJoinTotalThreadCountBo(id, timestamp, totalThreadCountJoinValue); - } -} diff --git a/web/src/main/java/com/navercorp/pinpoint/web/mapper/stat/sampling/sampler/JoinTransactionSampler.java b/web/src/main/java/com/navercorp/pinpoint/web/mapper/stat/sampling/sampler/JoinTransactionSampler.java deleted file mode 100644 index c972d759ed0a..000000000000 --- a/web/src/main/java/com/navercorp/pinpoint/web/mapper/stat/sampling/sampler/JoinTransactionSampler.java +++ /dev/null @@ -1,45 +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.web.mapper.stat.sampling.sampler; - -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinLongFieldBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinTransactionBo; -import com.navercorp.pinpoint.web.vo.stat.AggreJoinTransactionBo; -import org.apache.commons.collections4.CollectionUtils; -import org.springframework.stereotype.Component; - -import java.util.List; - -/** - * @author minwoo.jung - */ -@Component -public class JoinTransactionSampler implements ApplicationStatSampler { - - @Override - public AggreJoinTransactionBo sampleDataPoints(int index, long timestamp, List joinTransactionBoList, JoinTransactionBo previousDataPoint) { - if (CollectionUtils.isEmpty(joinTransactionBoList)) { - return AggreJoinTransactionBo.createUncollectedObject(timestamp); - } - - JoinTransactionBo joinTransactionBo = JoinTransactionBo.joinTransactionBoList(joinTransactionBoList, timestamp); - String id = joinTransactionBo.getId(); - long collectInterval = joinTransactionBo.getCollectInterval(); - final JoinLongFieldBo totalCountJoinValue = joinTransactionBo.getTotalCountJoinValue(); - - return new AggreJoinTransactionBo(id, collectInterval, totalCountJoinValue, timestamp); - } -} diff --git a/web/src/main/java/com/navercorp/pinpoint/web/service/appmetric/ApplicationDataSourceService.java b/web/src/main/java/com/navercorp/pinpoint/web/service/appmetric/ApplicationDataSourceService.java deleted file mode 100644 index c5676cd8bba2..000000000000 --- a/web/src/main/java/com/navercorp/pinpoint/web/service/appmetric/ApplicationDataSourceService.java +++ /dev/null @@ -1,98 +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.web.service.appmetric; - -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinDataSourceListBo.DataSourceKey; -import com.navercorp.pinpoint.loader.service.ServiceTypeRegistryService; -import com.navercorp.pinpoint.web.dao.appmetric.ApplicationMetricDao; -import com.navercorp.pinpoint.common.server.util.timewindow.TimeWindow; -import com.navercorp.pinpoint.web.vo.stat.AggreJoinDataSourceBo; -import com.navercorp.pinpoint.web.vo.stat.AggreJoinDataSourceListBo; -import com.navercorp.pinpoint.web.vo.stat.chart.StatChart; -import com.navercorp.pinpoint.web.vo.stat.chart.application.ApplicationDataSourceChart; -import org.springframework.stereotype.Service; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -/** - * @author minwoo.jung - */ -@Service -public class ApplicationDataSourceService { - - private final ApplicationMetricDao metricDao; - - private final ServiceTypeRegistryService serviceTypeRegistryService; - - private static final Comparator comparator - = Comparator.comparingLong(AggreJoinDataSourceBo::getTimestamp); - - public ApplicationDataSourceService(ApplicationMetricDao metricDao, ServiceTypeRegistryService serviceTypeRegistryService) { - this.metricDao = Objects.requireNonNull(metricDao, "metricDao"); - this.serviceTypeRegistryService = Objects.requireNonNull(serviceTypeRegistryService, "serviceTypeRegistryService"); - } - - public List selectApplicationChart(String applicationId, TimeWindow timeWindow) { - Objects.requireNonNull(applicationId, "applicationId"); - Objects.requireNonNull(timeWindow, "timeWindow"); - - List result = new ArrayList<>(); - List aggreJoinDataSourceListBoList = this.metricDao.getApplicationStatList(applicationId, timeWindow); - - if (aggreJoinDataSourceListBoList.isEmpty()) { - result.add(new ApplicationDataSourceChart(timeWindow, "", "", Collections.emptyList())); - return result; - } - - Map> aggreJoinDataSourceBoMap = classifyByDataSourceUrl(aggreJoinDataSourceListBoList); - - for (Map.Entry> entry: aggreJoinDataSourceBoMap.entrySet()) { - DataSourceKey dataSourceKey = entry.getKey(); - String serviceTypeName = serviceTypeRegistryService.findServiceType(dataSourceKey.getServiceTypeCode()).getName(); - result.add(new ApplicationDataSourceChart(timeWindow, dataSourceKey.getUrl(), serviceTypeName, entry.getValue())); - } - - return result; - } - - - protected Map> classifyByDataSourceUrl(List aggreJoinDataSourceListBoList) { - - Map> aggreJoinDataSourceBoMap = new HashMap<>(); - - for (AggreJoinDataSourceListBo aggreJoinDataSourceListBo : aggreJoinDataSourceListBoList) { - for (AggreJoinDataSourceBo aggreJoinDataSourceBo : aggreJoinDataSourceListBo.getAggreJoinDataSourceBoList()) { - DataSourceKey dataSourceKey = new DataSourceKey(aggreJoinDataSourceBo.getUrl(), aggreJoinDataSourceBo.getServiceTypeCode()); - List aggreJoinDataSourceBoList = aggreJoinDataSourceBoMap.computeIfAbsent(dataSourceKey, k -> new ArrayList<>()); - - aggreJoinDataSourceBoList.add(aggreJoinDataSourceBo); - } - } - - for (List aggreJoinDataSourceBoList : aggreJoinDataSourceBoMap.values()) { - aggreJoinDataSourceBoList.sort(comparator); - } - - return aggreJoinDataSourceBoMap; - } - -} diff --git a/web/src/main/java/com/navercorp/pinpoint/web/service/appmetric/ApplicationMetricServiceConfiguration.java b/web/src/main/java/com/navercorp/pinpoint/web/service/appmetric/ApplicationMetricServiceConfiguration.java deleted file mode 100644 index 9a1d95c01b1a..000000000000 --- a/web/src/main/java/com/navercorp/pinpoint/web/service/appmetric/ApplicationMetricServiceConfiguration.java +++ /dev/null @@ -1,75 +0,0 @@ -package com.navercorp.pinpoint.web.service.appmetric; - -import com.navercorp.pinpoint.web.dao.appmetric.ApplicationMetricDao; - -import com.navercorp.pinpoint.web.vo.stat.AggreJoinActiveTraceBo; -import com.navercorp.pinpoint.web.vo.stat.AggreJoinCpuLoadBo; -import com.navercorp.pinpoint.web.vo.stat.AggreJoinDirectBufferBo; -import com.navercorp.pinpoint.web.vo.stat.AggreJoinFileDescriptorBo; -import com.navercorp.pinpoint.web.vo.stat.AggreJoinLoadedClassBo; -import com.navercorp.pinpoint.web.vo.stat.AggreJoinMemoryBo; -import com.navercorp.pinpoint.web.vo.stat.AggreJoinResponseTimeBo; -import com.navercorp.pinpoint.web.vo.stat.AggreJoinTotalThreadCountBo; -import com.navercorp.pinpoint.web.vo.stat.AggreJoinTransactionBo; -import com.navercorp.pinpoint.web.vo.stat.chart.application.ApplicationActiveTraceChart; -import com.navercorp.pinpoint.web.vo.stat.chart.application.ApplicationCpuLoadChart; -import com.navercorp.pinpoint.web.vo.stat.chart.application.ApplicationDirectBufferChart; -import com.navercorp.pinpoint.web.vo.stat.chart.application.ApplicationFileDescriptorChart; -import com.navercorp.pinpoint.web.vo.stat.chart.application.ApplicationLoadedClassChart; -import com.navercorp.pinpoint.web.vo.stat.chart.application.ApplicationMemoryChart; -import com.navercorp.pinpoint.web.vo.stat.chart.application.ApplicationResponseTimeChart; -import com.navercorp.pinpoint.web.vo.stat.chart.application.ApplicationTotalThreadCountChart; -import com.navercorp.pinpoint.web.vo.stat.chart.application.ApplicationTransactionChart; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - - -@Configuration -public class ApplicationMetricServiceConfiguration { - - @Bean - public ApplicationStatChartService getApplicationActiveTraceService(ApplicationMetricDao metricDao) { - return new DefaultApplicationStatChartService<>(metricDao, ApplicationActiveTraceChart::new); - } - - @Bean - public ApplicationStatChartService getApplicationCpuLoadService(ApplicationMetricDao metricDao) { - return new DefaultApplicationStatChartService<>(metricDao, ApplicationCpuLoadChart::new); - } - - @Bean - public ApplicationStatChartService getApplicationDirectBufferService(ApplicationMetricDao metricDao) { - return new DefaultApplicationStatChartService<>(metricDao, ApplicationDirectBufferChart::new); - } - - @Bean - public ApplicationStatChartService getApplicationFileDescriptorService(ApplicationMetricDao metricDao) { - return new DefaultApplicationStatChartService<>(metricDao, ApplicationFileDescriptorChart::new); - } - - @Bean - public ApplicationStatChartService getApplicationMemoryService(ApplicationMetricDao metricDao) { - return new DefaultApplicationStatChartService<>(metricDao, ApplicationMemoryChart::new); - } - - @Bean - public ApplicationStatChartService getApplicationLoadedClassService(ApplicationMetricDao metricDao) { - return new DefaultApplicationStatChartService<>(metricDao, ApplicationLoadedClassChart::new); - } - - - @Bean - public ApplicationStatChartService getApplicationResponseTimeService(ApplicationMetricDao metricDao) { - return new DefaultApplicationStatChartService<>(metricDao, ApplicationResponseTimeChart::new); - } - - @Bean - public ApplicationStatChartService getApplicationTotalThreadCountService(ApplicationMetricDao metricDao) { - return new DefaultApplicationStatChartService<>(metricDao, ApplicationTotalThreadCountChart::new); - } - - @Bean - public ApplicationStatChartService getApplicationTransactionService(ApplicationMetricDao metricDao) { - return new DefaultApplicationStatChartService<>(metricDao, ApplicationTransactionChart::new); - } -} diff --git a/web/src/main/java/com/navercorp/pinpoint/web/view/IntApplicationStatSerializer.java b/web/src/main/java/com/navercorp/pinpoint/web/view/IntApplicationStatSerializer.java deleted file mode 100644 index dc2a488d5b42..000000000000 --- a/web/src/main/java/com/navercorp/pinpoint/web/view/IntApplicationStatSerializer.java +++ /dev/null @@ -1,42 +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.web.view; - -import com.navercorp.pinpoint.web.vo.stat.chart.application.IntApplicationStatPoint; - -import com.fasterxml.jackson.core.JsonGenerator; -import com.fasterxml.jackson.databind.JsonSerializer; -import com.fasterxml.jackson.databind.SerializerProvider; - -import java.io.IOException; - -/** - * @author Taejin Koo - */ -public class IntApplicationStatSerializer extends JsonSerializer { - - @Override - public void serialize(IntApplicationStatPoint intApplicationStatPoint, JsonGenerator jgen, SerializerProvider serializers) throws IOException { - jgen.writeStartArray(); - jgen.writeNumber(intApplicationStatPoint.getYValForMin()); - jgen.writeString(intApplicationStatPoint.getAgentIdForMin()); - jgen.writeNumber(intApplicationStatPoint.getYValForMax()); - jgen.writeString(intApplicationStatPoint.getAgentIdForMax()); - jgen.writeNumber(intApplicationStatPoint.getYValForAvg()); - jgen.writeEndArray(); - } -} diff --git a/web/src/main/java/com/navercorp/pinpoint/web/view/LongApplicationStatSerializer.java b/web/src/main/java/com/navercorp/pinpoint/web/view/LongApplicationStatSerializer.java deleted file mode 100644 index 6e37ea34f2e3..000000000000 --- a/web/src/main/java/com/navercorp/pinpoint/web/view/LongApplicationStatSerializer.java +++ /dev/null @@ -1,43 +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.web.view; - -import com.navercorp.pinpoint.web.vo.stat.chart.application.LongApplicationStatPoint; - -import com.fasterxml.jackson.core.JsonGenerator; -import com.fasterxml.jackson.databind.JsonSerializer; -import com.fasterxml.jackson.databind.SerializerProvider; - -import java.io.IOException; - -/** - * @author Taejin Koo - */ -public class LongApplicationStatSerializer extends JsonSerializer { - - @Override - public void serialize(LongApplicationStatPoint longApplicationStatPoint, JsonGenerator jgen, SerializerProvider serializers) throws IOException { - jgen.writeStartArray(); - jgen.writeNumber(longApplicationStatPoint.getYValForMin()); - jgen.writeString(longApplicationStatPoint.getAgentIdForMin()); - jgen.writeNumber(longApplicationStatPoint.getYValForMax()); - jgen.writeString(longApplicationStatPoint.getAgentIdForMax()); - jgen.writeNumber(longApplicationStatPoint.getYValForAvg()); - jgen.writeEndArray(); - } -} - diff --git a/web/src/main/java/com/navercorp/pinpoint/web/vo/stat/AggreJoinActiveTraceBo.java b/web/src/main/java/com/navercorp/pinpoint/web/vo/stat/AggreJoinActiveTraceBo.java deleted file mode 100644 index 60969f7f43b0..000000000000 --- a/web/src/main/java/com/navercorp/pinpoint/web/vo/stat/AggreJoinActiveTraceBo.java +++ /dev/null @@ -1,42 +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.web.vo.stat; - -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinActiveTraceBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinIntFieldBo; - -/** - * @author minwoo.jung - */ -public class AggreJoinActiveTraceBo extends JoinActiveTraceBo implements AggregationStatData { - - public AggreJoinActiveTraceBo() { - } - - public AggreJoinActiveTraceBo(String id, int histogramSchemaType, short version, int totalCount, int minTotalCount, String minTotalCountAgentId, int maxTotalCount, String maxTotalCountAgentId, long timestamp) { - super(id, histogramSchemaType, version, totalCount, minTotalCount, minTotalCountAgentId, maxTotalCount, maxTotalCountAgentId, timestamp); - } - - public AggreJoinActiveTraceBo(String id, int histogramSchemaType, short version, JoinIntFieldBo totalCountJoinValue, long timestamp) { - super(id, histogramSchemaType, version, totalCountJoinValue, timestamp); - } - - public static AggreJoinActiveTraceBo createUncollectedObject(long timestamp) { - AggreJoinActiveTraceBo aggreJoinActiveTraceBo = new AggreJoinActiveTraceBo(); - aggreJoinActiveTraceBo.setTimestamp(timestamp); - return aggreJoinActiveTraceBo; - } -} diff --git a/web/src/main/java/com/navercorp/pinpoint/web/vo/stat/AggreJoinCpuLoadBo.java b/web/src/main/java/com/navercorp/pinpoint/web/vo/stat/AggreJoinCpuLoadBo.java deleted file mode 100644 index 465858ac5666..000000000000 --- a/web/src/main/java/com/navercorp/pinpoint/web/vo/stat/AggreJoinCpuLoadBo.java +++ /dev/null @@ -1,37 +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.web.vo.stat; - -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinCpuLoadBo; - -/** - * @author minwoo.jung - */ -public class AggreJoinCpuLoadBo extends JoinCpuLoadBo implements AggregationStatData { - - public AggreJoinCpuLoadBo() { - } - - public AggreJoinCpuLoadBo(String id, double jvmCpuLoad, double maxJvmCpuLoad, String maxJvmCpuAgentId, double minJvmCpuLoad, String minJvmCpuAgentId, double systemCpuLoad, double maxSystemCpuLoad, String maxSysCpuAgentId, double minSystemCpuLoad, String minSysCpuAgentId, long timestamp) { - super(id, jvmCpuLoad, maxJvmCpuLoad, maxJvmCpuAgentId, minJvmCpuLoad, minJvmCpuAgentId, systemCpuLoad, maxSystemCpuLoad, maxSysCpuAgentId, minSystemCpuLoad, minSysCpuAgentId, timestamp); - } - - public static AggreJoinCpuLoadBo createUncollectedObject(long timestamp) { - AggreJoinCpuLoadBo aggreJoinCpuLoadBo = new AggreJoinCpuLoadBo(); - aggreJoinCpuLoadBo.setTimestamp(timestamp); - return aggreJoinCpuLoadBo; - } -} diff --git a/web/src/main/java/com/navercorp/pinpoint/web/vo/stat/AggreJoinDataSourceBo.java b/web/src/main/java/com/navercorp/pinpoint/web/vo/stat/AggreJoinDataSourceBo.java deleted file mode 100644 index 428b81068a7c..000000000000 --- a/web/src/main/java/com/navercorp/pinpoint/web/vo/stat/AggreJoinDataSourceBo.java +++ /dev/null @@ -1,62 +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.web.vo.stat; - -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinDataSourceBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinIntFieldBo; - - -/** - * @author minwoo.jung - */ -public class AggreJoinDataSourceBo extends JoinDataSourceBo implements AggregationStatData { - - private final long timestamp; - - - public AggreJoinDataSourceBo(short serviceTypeCode, String url, int avgActiveConnectionSize, int minActiveConnectionSize, String minActiveConnectionAgentId, int maxActiveConnectionSize, String maxActiveConnectionAgentId ,long timestamp) { - super(serviceTypeCode, url, avgActiveConnectionSize, minActiveConnectionSize, minActiveConnectionAgentId, maxActiveConnectionSize, maxActiveConnectionAgentId); - this.timestamp = timestamp; - } - - public AggreJoinDataSourceBo(short serviceTypeCode, String url, JoinIntFieldBo activeConnectionSize, long timestamp) { - super(serviceTypeCode, url, activeConnectionSize); - this.timestamp = timestamp; - } - - @Override - public long getTimestamp() { - return timestamp; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (!(o instanceof AggreJoinDataSourceBo)) return false; - if (!super.equals(o)) return false; - - AggreJoinDataSourceBo that = (AggreJoinDataSourceBo) o; - - return timestamp == that.timestamp; - } - - @Override - public int hashCode() { - int result = super.hashCode(); - result = 31 * result + (int) (timestamp ^ (timestamp >>> 32)); - return result; - } -} diff --git a/web/src/main/java/com/navercorp/pinpoint/web/vo/stat/AggreJoinDataSourceListBo.java b/web/src/main/java/com/navercorp/pinpoint/web/vo/stat/AggreJoinDataSourceListBo.java deleted file mode 100644 index e64f5652edb3..000000000000 --- a/web/src/main/java/com/navercorp/pinpoint/web/vo/stat/AggreJoinDataSourceListBo.java +++ /dev/null @@ -1,56 +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.web.vo.stat; - -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinDataSourceBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinDataSourceListBo; - -import java.util.ArrayList; -import java.util.List; - -/** - * @author minwoo.jung - */ -public class AggreJoinDataSourceListBo extends JoinDataSourceListBo implements AggregationStatData { - - - public AggreJoinDataSourceListBo() { - } - - public AggreJoinDataSourceListBo(String id, List aggreJoinDataSourceBoList, long timestamp) { - super(id, aggreJoinDataSourceBoList, timestamp); - } - - public static AggreJoinDataSourceListBo createUncollectedObject(long timestamp) { - AggreJoinDataSourceListBo aggreJoinDataSourceListBo = new AggreJoinDataSourceListBo(); - aggreJoinDataSourceListBo.setTimestamp(timestamp); - return aggreJoinDataSourceListBo; - } - - public List getAggreJoinDataSourceBoList() { - return castAggreJoinDataSourceBo(getJoinDataSourceBoList()); - } - - private List castAggreJoinDataSourceBo(List joinDataSourceBoList) { - List aggreJoinDataSourceListBoList = new ArrayList<>(joinDataSourceBoList.size()); - - for (JoinDataSourceBo joinDataSourceBo : joinDataSourceBoList) { - aggreJoinDataSourceListBoList.add((AggreJoinDataSourceBo)joinDataSourceBo); - } - - return aggreJoinDataSourceListBoList; - } -} diff --git a/web/src/main/java/com/navercorp/pinpoint/web/vo/stat/AggreJoinDirectBufferBo.java b/web/src/main/java/com/navercorp/pinpoint/web/vo/stat/AggreJoinDirectBufferBo.java deleted file mode 100644 index cd86b9294b1a..000000000000 --- a/web/src/main/java/com/navercorp/pinpoint/web/vo/stat/AggreJoinDirectBufferBo.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.web.vo.stat; - -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinDirectBufferBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinLongFieldBo; - -/** - * @author Roy Kim - */ -public class AggreJoinDirectBufferBo extends JoinDirectBufferBo implements AggregationStatData { - - public AggreJoinDirectBufferBo() { - } - - public AggreJoinDirectBufferBo(String id, long avgDirectCount, long maxDirectCount, String maxDirectCountAgentId, long minDirectCount, String minDirectCountAgentId, long avgDirectMemoryUsed, long maxDirectMemoryUsed, String maxDirectMemoryUsedAgentId, long minDirectMemoryUsed, String minDirectMemoryUsedAgentId, long avgMappedCount, long maxMappedCount, String maxMappedCountAgentId, long minMappedCount, String minMappedCountAgentId, long avgMappedMemoryUsed, long maxMappedMemoryUsed, String maxMappedMemoryUsedAgentId, long minMappedMemoryUsed, String minMappedMemoryUsedAgentId, long timestamp) { - super(id, avgDirectCount, maxDirectCount, maxDirectCountAgentId, minDirectCount, minDirectCountAgentId, avgDirectMemoryUsed, maxDirectMemoryUsed, maxDirectMemoryUsedAgentId, minDirectMemoryUsed, minDirectMemoryUsedAgentId, avgMappedCount, maxMappedCount, maxMappedCountAgentId, minMappedCount, minMappedCountAgentId, avgMappedMemoryUsed, maxMappedMemoryUsed, maxMappedMemoryUsedAgentId, minMappedMemoryUsed, minMappedMemoryUsedAgentId, timestamp); - } - - public AggreJoinDirectBufferBo(String id, JoinLongFieldBo directCountJoinValue, JoinLongFieldBo directMemoryUsedJoinValue, - JoinLongFieldBo mappedCountJoinValue, JoinLongFieldBo mappedMemoryUsedJoinValue, long timestamp) { - super(id, directCountJoinValue, directMemoryUsedJoinValue, mappedCountJoinValue, mappedMemoryUsedJoinValue, timestamp); - } - - public static AggreJoinDirectBufferBo createUncollectedObject(long timestamp) { - AggreJoinDirectBufferBo aggreJoinDirectBufferBo = new AggreJoinDirectBufferBo(); - aggreJoinDirectBufferBo.setTimestamp(timestamp); - return aggreJoinDirectBufferBo; - } -} diff --git a/web/src/main/java/com/navercorp/pinpoint/web/vo/stat/AggreJoinFileDescriptorBo.java b/web/src/main/java/com/navercorp/pinpoint/web/vo/stat/AggreJoinFileDescriptorBo.java deleted file mode 100644 index 294f8c56d49d..000000000000 --- a/web/src/main/java/com/navercorp/pinpoint/web/vo/stat/AggreJoinFileDescriptorBo.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.web.vo.stat; - -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinFileDescriptorBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinLongFieldBo; - -/** - * @author Roy Kim - */ -public class AggreJoinFileDescriptorBo extends JoinFileDescriptorBo implements AggregationStatData { - - public AggreJoinFileDescriptorBo() { - } - - public AggreJoinFileDescriptorBo(String id, long avgOpenFDCount, long maxOpenFDCount, String maxOpenFDCountAgentId, long minOpenFDCount, String minOpenFDCountAgentId, long timestamp) { - super(id, avgOpenFDCount, maxOpenFDCount, maxOpenFDCountAgentId, minOpenFDCount, minOpenFDCountAgentId, timestamp); - } - - public AggreJoinFileDescriptorBo(String id, JoinLongFieldBo openFdCountJoinValue, long timestamp) { - super(id, openFdCountJoinValue, timestamp); - } - - public static AggreJoinFileDescriptorBo createUncollectedObject(long timestamp) { - AggreJoinFileDescriptorBo aggreJoinFileDescriptorBo = new AggreJoinFileDescriptorBo(); - aggreJoinFileDescriptorBo.setTimestamp(timestamp); - return aggreJoinFileDescriptorBo; - } -} diff --git a/web/src/main/java/com/navercorp/pinpoint/web/vo/stat/AggreJoinLoadedClassBo.java b/web/src/main/java/com/navercorp/pinpoint/web/vo/stat/AggreJoinLoadedClassBo.java deleted file mode 100644 index 2ed58a1f7cdf..000000000000 --- a/web/src/main/java/com/navercorp/pinpoint/web/vo/stat/AggreJoinLoadedClassBo.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.web.vo.stat; - -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinLoadedClassBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinLongFieldBo; - -public class AggreJoinLoadedClassBo extends JoinLoadedClassBo implements AggregationStatData { - - public AggreJoinLoadedClassBo() { - } - - public AggreJoinLoadedClassBo(String id, long avgLoadedClass, long maxLoadedClass, String maxLoadedClassAgentId, long minLoadedClass, String minLoadedClassAgentId, - long avgUnloadedClass, long maxUnloadedClass, String maxUnloadedClassAgentId, long minUnloadedClass, String minUnloadedClassAgentId, - long timestamp) { - super(id, avgLoadedClass, maxLoadedClass, maxLoadedClassAgentId, minLoadedClass, minLoadedClassAgentId, avgUnloadedClass, maxUnloadedClass, - maxUnloadedClassAgentId, minUnloadedClass, minUnloadedClassAgentId, timestamp); - - } - - public AggreJoinLoadedClassBo(String id, JoinLongFieldBo loadedClass, JoinLongFieldBo unloadedClass, long timestamp) { - super(id, loadedClass, unloadedClass, timestamp); - } - - public static AggreJoinLoadedClassBo createUncollectedObject(long timestamp) { - AggreJoinLoadedClassBo aggreJoinLoadedClassBo = new AggreJoinLoadedClassBo(); - aggreJoinLoadedClassBo.setTimestamp(timestamp); - return aggreJoinLoadedClassBo; - } -} diff --git a/web/src/main/java/com/navercorp/pinpoint/web/vo/stat/AggreJoinMemoryBo.java b/web/src/main/java/com/navercorp/pinpoint/web/vo/stat/AggreJoinMemoryBo.java deleted file mode 100644 index c221db28032f..000000000000 --- a/web/src/main/java/com/navercorp/pinpoint/web/vo/stat/AggreJoinMemoryBo.java +++ /dev/null @@ -1,42 +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.web.vo.stat; - -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinLongFieldBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinMemoryBo; - -/** - * @author minwoo.jung - */ -public class AggreJoinMemoryBo extends JoinMemoryBo implements AggregationStatData { - - public AggreJoinMemoryBo() { - } - - public AggreJoinMemoryBo(String id, long timestamp, long heapUsed, long minHeapUsed, long maxHeapUsed, String minHeapAgentId, String maxHeapAgentId, long nonHeapUsed, long minNonHeapUsed, long maxNonHeapUsed, String minNonHeapAgentId, String maxNonHeapAgentId) { - super(id, timestamp, heapUsed, minHeapUsed, maxHeapUsed, minHeapAgentId, maxHeapAgentId, nonHeapUsed, minNonHeapUsed, maxNonHeapUsed, minNonHeapAgentId, maxNonHeapAgentId); - } - - public AggreJoinMemoryBo(String id, long timestamp, JoinLongFieldBo heapUsedJoinValue, JoinLongFieldBo nonHeapUsedJoinValue) { - super(id, timestamp, heapUsedJoinValue, nonHeapUsedJoinValue); - } - - public static AggreJoinMemoryBo createUncollectedObject(long timestamp) { - AggreJoinMemoryBo aggreJoinMemoryBo = new AggreJoinMemoryBo(); - aggreJoinMemoryBo.setTimestamp(timestamp); - return aggreJoinMemoryBo; - } -} diff --git a/web/src/main/java/com/navercorp/pinpoint/web/vo/stat/AggreJoinResponseTimeBo.java b/web/src/main/java/com/navercorp/pinpoint/web/vo/stat/AggreJoinResponseTimeBo.java deleted file mode 100644 index ca28869205c8..000000000000 --- a/web/src/main/java/com/navercorp/pinpoint/web/vo/stat/AggreJoinResponseTimeBo.java +++ /dev/null @@ -1,42 +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.web.vo.stat; - -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinLongFieldBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinResponseTimeBo; - -/** - * @author minwoo.jung - */ -public class AggreJoinResponseTimeBo extends JoinResponseTimeBo implements AggregationStatData { - - public AggreJoinResponseTimeBo() { - } - - public AggreJoinResponseTimeBo(String id, long timestamp, long avg, long minAvg, String minAvgAgentId, long maxAvg, String maxAvgAgentId) { - super(id, timestamp, avg, minAvg, minAvgAgentId, maxAvg, maxAvgAgentId); - } - - public AggreJoinResponseTimeBo(String id, long timestamp, JoinLongFieldBo responseTimeJoinValue) { - super(id, timestamp, responseTimeJoinValue); - } - - public static AggreJoinResponseTimeBo createUncollectedObject(long timestamp) { - AggreJoinResponseTimeBo aggreJoinResponseTimeBo = new AggreJoinResponseTimeBo(); - aggreJoinResponseTimeBo.setTimestamp(timestamp); - return aggreJoinResponseTimeBo; - } -} diff --git a/web/src/main/java/com/navercorp/pinpoint/web/vo/stat/AggreJoinTotalThreadCountBo.java b/web/src/main/java/com/navercorp/pinpoint/web/vo/stat/AggreJoinTotalThreadCountBo.java deleted file mode 100644 index 3e0c667aed74..000000000000 --- a/web/src/main/java/com/navercorp/pinpoint/web/vo/stat/AggreJoinTotalThreadCountBo.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.web.vo.stat; - -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinLongFieldBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinTotalThreadCountBo; - -public class AggreJoinTotalThreadCountBo extends JoinTotalThreadCountBo implements AggregationStatData{ - public AggreJoinTotalThreadCountBo() { - - } - - public AggreJoinTotalThreadCountBo(String id, long timestamp, long avg, long min, String minAgentId, long max, String maxAgentId) { - super(id, timestamp, avg, min, minAgentId, max, maxAgentId); - } - - public AggreJoinTotalThreadCountBo(String id, long timestamp, JoinLongFieldBo totalThreadCountJoinValue) { - super(id, timestamp, totalThreadCountJoinValue); - } - - public static AggreJoinTotalThreadCountBo createUncollectedObject(long timestamp) { - AggreJoinTotalThreadCountBo aggreJoinTotalThreadCountBo = new AggreJoinTotalThreadCountBo(); - aggreJoinTotalThreadCountBo.setTimestamp(timestamp); - return aggreJoinTotalThreadCountBo; - } -} diff --git a/web/src/main/java/com/navercorp/pinpoint/web/vo/stat/AggreJoinTransactionBo.java b/web/src/main/java/com/navercorp/pinpoint/web/vo/stat/AggreJoinTransactionBo.java deleted file mode 100644 index dbdeffeda811..000000000000 --- a/web/src/main/java/com/navercorp/pinpoint/web/vo/stat/AggreJoinTransactionBo.java +++ /dev/null @@ -1,42 +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.web.vo.stat; - -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinLongFieldBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinTransactionBo; - -/** - * @author minwoo.jung - */ -public class AggreJoinTransactionBo extends JoinTransactionBo implements AggregationStatData { - - public AggreJoinTransactionBo() { - } - - public AggreJoinTransactionBo(String id, long collectInterval, long totalCount, long minTotalCount, String minTotalCountAgentId, long maxTotalCount, String maxTotalCountAgentId, long timestamp) { - super(id, collectInterval, totalCount, minTotalCount, minTotalCountAgentId, maxTotalCount, maxTotalCountAgentId, timestamp); - } - - public AggreJoinTransactionBo(String id, long collectInterval, JoinLongFieldBo totalCountJoinValue, long timestamp) { - super(id, collectInterval, totalCountJoinValue, timestamp); - } - - public static AggreJoinTransactionBo createUncollectedObject(long timestamp) { - AggreJoinTransactionBo aggreJoinTransactionBo = new AggreJoinTransactionBo(); - aggreJoinTransactionBo.setTimestamp(timestamp); - return aggreJoinTransactionBo; - } -} diff --git a/web/src/main/java/com/navercorp/pinpoint/web/vo/stat/chart/application/ApplicationActiveTraceChart.java b/web/src/main/java/com/navercorp/pinpoint/web/vo/stat/chart/application/ApplicationActiveTraceChart.java deleted file mode 100644 index 721c0be521ee..000000000000 --- a/web/src/main/java/com/navercorp/pinpoint/web/vo/stat/chart/application/ApplicationActiveTraceChart.java +++ /dev/null @@ -1,61 +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.web.vo.stat.chart.application; - -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinActiveTraceBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinIntFieldBo; -import com.navercorp.pinpoint.common.server.util.timewindow.TimeWindow; -import com.navercorp.pinpoint.web.vo.chart.Point; -import com.navercorp.pinpoint.web.vo.stat.AggreJoinActiveTraceBo; -import com.navercorp.pinpoint.web.vo.stat.chart.ChartGroupBuilder; -import com.navercorp.pinpoint.web.vo.stat.chart.StatChartGroup; - -import java.util.List; - - -/** - * @author minwoo.jung - */ -public class ApplicationActiveTraceChart extends DefaultApplicationChart { - - private static final Point.UncollectedPointCreator> UNCOLLECTED_POINT - = new IntApplicationStatPoint.UncollectedCreator(JoinActiveTraceBo.UNCOLLECTED_VALUE); - - public enum ActiveTraceChartType implements StatChartGroup.ApplicationChartType { - ACTIVE_TRACE_COUNT - } - - private static final ChartGroupBuilder> BUILDER = newChartBuilder(); - - static ChartGroupBuilder> newChartBuilder() { - ChartGroupBuilder> builder = new ChartGroupBuilder<>(UNCOLLECTED_POINT); - builder.addPointFunction(ActiveTraceChartType.ACTIVE_TRACE_COUNT, ApplicationActiveTraceChart::newActiveTracePoint); - return builder; - } - - public ApplicationActiveTraceChart(TimeWindow timeWindow, List appStatList) { - super(timeWindow, appStatList, BUILDER); - } - - private static ApplicationStatPoint newActiveTracePoint(AggreJoinActiveTraceBo activeTrace) { - final JoinIntFieldBo totalCountValue = activeTrace.getTotalCountJoinValue(); - long timestamp = activeTrace.getTimestamp(); - - return StatPointUtils.toIntStatPoint(timestamp, totalCountValue); - } - -} diff --git a/web/src/main/java/com/navercorp/pinpoint/web/vo/stat/chart/application/ApplicationCpuLoadChart.java b/web/src/main/java/com/navercorp/pinpoint/web/vo/stat/chart/application/ApplicationCpuLoadChart.java deleted file mode 100644 index 955833cf7b27..000000000000 --- a/web/src/main/java/com/navercorp/pinpoint/web/vo/stat/chart/application/ApplicationCpuLoadChart.java +++ /dev/null @@ -1,66 +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.web.vo.stat.chart.application; - -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinCpuLoadBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinDoubleFieldBo; -import com.navercorp.pinpoint.common.server.util.timewindow.TimeWindow; -import com.navercorp.pinpoint.web.vo.chart.Point; -import com.navercorp.pinpoint.web.vo.stat.AggreJoinCpuLoadBo; -import com.navercorp.pinpoint.web.vo.stat.chart.ChartGroupBuilder; -import com.navercorp.pinpoint.web.vo.stat.chart.StatChartGroup; - -import java.util.List; - -/** - * @author minwoo.jung - */ -public class ApplicationCpuLoadChart extends DefaultApplicationChart { - - private static final Point.UncollectedPointCreator> UNCOLLECTED_POINT - = new DoubleApplicationStatPoint.UncollectedCreator(JoinCpuLoadBo.UNCOLLECTED_VALUE); - - private static final ChartGroupBuilder> BUILDER = newChartBuilder(); - - public enum CpuLoadChartType implements StatChartGroup.ApplicationChartType { - CPU_LOAD_JVM, - CPU_LOAD_SYSTEM - } - - static ChartGroupBuilder> newChartBuilder() { - ChartGroupBuilder> builder = new ChartGroupBuilder<>(UNCOLLECTED_POINT); - builder.addPointFunction(CpuLoadChartType.CPU_LOAD_JVM, ApplicationCpuLoadChart::newJvmCpu); - builder.addPointFunction(CpuLoadChartType.CPU_LOAD_SYSTEM, ApplicationCpuLoadChart::newSystemCpu); - return builder; - } - - public ApplicationCpuLoadChart(TimeWindow timeWindow, List appStatList) { - super(timeWindow, appStatList, BUILDER); - } - - private static ApplicationStatPoint newSystemCpu(AggreJoinCpuLoadBo statBo) { - JoinDoubleFieldBo point = statBo.getSystemCpuLoadJoinValue(); - long timestamp = statBo.getTimestamp(); - return StatPointUtils.toDoubleStatPoint(timestamp, point); - } - - private static ApplicationStatPoint newJvmCpu(AggreJoinCpuLoadBo statBo) { - JoinDoubleFieldBo point = statBo.getJvmCpuLoadJoinValue(); - long timestamp = statBo.getTimestamp(); - return StatPointUtils.toDoubleStatPoint(timestamp, point); - } - -} diff --git a/web/src/main/java/com/navercorp/pinpoint/web/vo/stat/chart/application/ApplicationDataSourceChart.java b/web/src/main/java/com/navercorp/pinpoint/web/vo/stat/chart/application/ApplicationDataSourceChart.java deleted file mode 100644 index 92f6680efb2a..000000000000 --- a/web/src/main/java/com/navercorp/pinpoint/web/vo/stat/chart/application/ApplicationDataSourceChart.java +++ /dev/null @@ -1,114 +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.web.vo.stat.chart.application; - -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinDataSourceBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinIntFieldBo; -import com.navercorp.pinpoint.common.server.util.timewindow.TimeWindow; -import com.navercorp.pinpoint.web.vo.chart.Chart; -import com.navercorp.pinpoint.web.vo.chart.Point; -import com.navercorp.pinpoint.web.vo.stat.AggreJoinDataSourceBo; -import com.navercorp.pinpoint.web.vo.stat.chart.ChartGroupBuilder; -import com.navercorp.pinpoint.web.vo.stat.chart.StatChart; -import com.navercorp.pinpoint.web.vo.stat.chart.StatChartGroup; - -import java.util.List; -import java.util.Map; -import java.util.Objects; - -/** - * @author minwoo.jung - */ -public class ApplicationDataSourceChart implements StatChart> { - private static final Point.UncollectedPointCreator> UNCOLLECTED_POINT - = new IntApplicationStatPoint.UncollectedCreator(JoinDataSourceBo.UNCOLLECTED_VALUE); - - public enum DataSourceChartType implements StatChartGroup.ApplicationChartType { - ACTIVE_CONNECTION_SIZE - } - - private final ApplicationDataSourceChartGroup applicationDataSourceChartGroup; - - private static final ChartGroupBuilder> BUILDER = newChartBuilder(); - - static ChartGroupBuilder> newChartBuilder() { - ChartGroupBuilder> builder = new ChartGroupBuilder<>(UNCOLLECTED_POINT); - builder.addPointFunction(DataSourceChartType.ACTIVE_CONNECTION_SIZE, ApplicationDataSourceChartGroup::newDataSource); - return builder; - } - - public ApplicationDataSourceChart(TimeWindow timeWindow, String url, String serviceTypeCodeName, List appDataSourceBoList) { - this.applicationDataSourceChartGroup = new ApplicationDataSourceChartGroup(timeWindow, url, serviceTypeCodeName, appDataSourceBoList); - } - - @Override - public StatChartGroup> getCharts() { - return applicationDataSourceChartGroup; - } - - public String getServiceType() { - return applicationDataSourceChartGroup.getServiceTypeCodeName(); - } - - public String getJdbcUrl() { - return applicationDataSourceChartGroup.getJdbcUrl(); - } - - public static class ApplicationDataSourceChartGroup implements StatChartGroup> { - - private final TimeWindow timeWindow; - private final String url; - private final String serviceTypeCodeName; - private final Map>> dataSourceChartMap; - - public ApplicationDataSourceChartGroup(TimeWindow timeWindow, String url, String serviceTypeCodeName, List appStatList) { - this.timeWindow = Objects.requireNonNull(timeWindow, "timeWindow"); - this.url = url; - this.serviceTypeCodeName = serviceTypeCodeName; - this.dataSourceChartMap = newChart(appStatList); - } - - private Map>> newChart(List appStatList) { - StatChartGroup> group = BUILDER.build(timeWindow, appStatList); - return group.getCharts(); - } - - - private static ApplicationStatPoint newDataSource(AggreJoinDataSourceBo ds) { - final JoinIntFieldBo activeConnectionSizeJoinValue = ds.getActiveConnectionSizeJoinValue(); - long timestamp = ds.getTimestamp(); - return StatPointUtils.toIntStatPoint(timestamp, activeConnectionSizeJoinValue); - } - - public String getJdbcUrl() { - return url; - } - - public String getServiceTypeCodeName() { - return serviceTypeCodeName; - } - - @Override - public TimeWindow getTimeWindow() { - return timeWindow; - } - - @Override - public Map>> getCharts() { - return dataSourceChartMap; - } - } -} diff --git a/web/src/main/java/com/navercorp/pinpoint/web/vo/stat/chart/application/ApplicationDirectBufferChart.java b/web/src/main/java/com/navercorp/pinpoint/web/vo/stat/chart/application/ApplicationDirectBufferChart.java deleted file mode 100644 index 4c9fdd96c701..000000000000 --- a/web/src/main/java/com/navercorp/pinpoint/web/vo/stat/chart/application/ApplicationDirectBufferChart.java +++ /dev/null @@ -1,82 +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.web.vo.stat.chart.application; - -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinDirectBufferBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinLongFieldBo; -import com.navercorp.pinpoint.common.server.util.timewindow.TimeWindow; -import com.navercorp.pinpoint.web.vo.chart.Point; -import com.navercorp.pinpoint.web.vo.stat.AggreJoinDirectBufferBo; -import com.navercorp.pinpoint.web.vo.stat.chart.ChartGroupBuilder; -import com.navercorp.pinpoint.web.vo.stat.chart.StatChartGroup; - -import java.util.List; - -/** - * @author Roy Kim - */ -public class ApplicationDirectBufferChart extends DefaultApplicationChart { - - private static final Point.UncollectedPointCreator> UNCOLLECTED_POINT - = new LongApplicationStatPoint.UncollectedCreator(JoinDirectBufferBo.UNCOLLECTED_VALUE); - - private static final ChartGroupBuilder> BUILDER = newChartBuilder(); - - public enum DirectBufferChartType implements StatChartGroup.ApplicationChartType { - DIRECT_COUNT, - DIRECT_MEMORY_USED, - MAPPED_COUNT, - MAPPED_MEMORY_USED - } - - static ChartGroupBuilder> newChartBuilder() { - ChartGroupBuilder> builder = new ChartGroupBuilder<>(UNCOLLECTED_POINT); - builder.addPointFunction(DirectBufferChartType.DIRECT_COUNT, ApplicationDirectBufferChart::newDirectCount); - builder.addPointFunction(DirectBufferChartType.DIRECT_MEMORY_USED, ApplicationDirectBufferChart::newDirectMemoryUsed); - builder.addPointFunction(DirectBufferChartType.MAPPED_COUNT, ApplicationDirectBufferChart::newMappedCount); - builder.addPointFunction(DirectBufferChartType.MAPPED_MEMORY_USED, ApplicationDirectBufferChart::newMappedMemoryUsed); - return builder; - } - - public ApplicationDirectBufferChart(TimeWindow timeWindow, List appStatList) { - super(timeWindow, appStatList, BUILDER); - } - - private static ApplicationStatPoint newDirectCount(AggreJoinDirectBufferBo directBuffer) { - final JoinLongFieldBo directCountJoinValue = directBuffer.getDirectCountJoinValue(); - long timestamp = directBuffer.getTimestamp(); - return StatPointUtils.toLongStatPoint(timestamp, directCountJoinValue); - } - - private static ApplicationStatPoint newDirectMemoryUsed(AggreJoinDirectBufferBo directBuffer) { - final JoinLongFieldBo directMemoryUsedJoinValue = directBuffer.getDirectMemoryUsedJoinValue(); - long timestamp = directBuffer.getTimestamp(); - return StatPointUtils.toLongStatPoint(timestamp, directMemoryUsedJoinValue); - } - - private static ApplicationStatPoint newMappedCount(AggreJoinDirectBufferBo directBuffer) { - final JoinLongFieldBo mappedCountJoinValue = directBuffer.getMappedCountJoinValue(); - long timestamp = directBuffer.getTimestamp(); - return StatPointUtils.toLongStatPoint(timestamp, mappedCountJoinValue); - } - - private static ApplicationStatPoint newMappedMemoryUsed(AggreJoinDirectBufferBo directBuffer) { - final JoinLongFieldBo mappedMemoryUsedJoinValue = directBuffer.getMappedMemoryUsedJoinValue(); - long timestamp = directBuffer.getTimestamp(); - return StatPointUtils.toLongStatPoint(timestamp, mappedMemoryUsedJoinValue); - } - -} diff --git a/web/src/main/java/com/navercorp/pinpoint/web/vo/stat/chart/application/ApplicationFileDescriptorChart.java b/web/src/main/java/com/navercorp/pinpoint/web/vo/stat/chart/application/ApplicationFileDescriptorChart.java deleted file mode 100644 index 1ddf1ceee840..000000000000 --- a/web/src/main/java/com/navercorp/pinpoint/web/vo/stat/chart/application/ApplicationFileDescriptorChart.java +++ /dev/null @@ -1,58 +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.web.vo.stat.chart.application; - -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinFileDescriptorBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinLongFieldBo; -import com.navercorp.pinpoint.common.server.util.timewindow.TimeWindow; -import com.navercorp.pinpoint.web.vo.chart.Point; -import com.navercorp.pinpoint.web.vo.stat.AggreJoinFileDescriptorBo; -import com.navercorp.pinpoint.web.vo.stat.chart.ChartGroupBuilder; -import com.navercorp.pinpoint.web.vo.stat.chart.StatChartGroup; - -import java.util.List; - -/** - * @author Roy Kim - */ -public class ApplicationFileDescriptorChart extends DefaultApplicationChart { - - private static final Point.UncollectedPointCreator> UNCOLLECTED_POINT - = new LongApplicationStatPoint.UncollectedCreator(JoinFileDescriptorBo.UNCOLLECTED_VALUE); - - private static final ChartGroupBuilder> BUILDER = newChartBuilder(); - - public enum FileDescriptorChartType implements StatChartGroup.ApplicationChartType { - OPEN_FILE_DESCRIPTOR_COUNT - } - - static ChartGroupBuilder> newChartBuilder() { - ChartGroupBuilder> builder = new ChartGroupBuilder<>(UNCOLLECTED_POINT); - builder.addPointFunction(FileDescriptorChartType.OPEN_FILE_DESCRIPTOR_COUNT, ApplicationFileDescriptorChart::newOpenFileDescriptorCount); - return builder; - } - - public ApplicationFileDescriptorChart(TimeWindow timeWindow, List appStatList) { - super(timeWindow, appStatList, BUILDER); - } - - private static ApplicationStatPoint newOpenFileDescriptorCount(AggreJoinFileDescriptorBo fileDescriptor) { - final JoinLongFieldBo openFdCountJoinValue = fileDescriptor.getOpenFdCountJoinValue(); - long timestamp = fileDescriptor.getTimestamp(); - return StatPointUtils.toLongStatPoint(timestamp, openFdCountJoinValue); - } - -} diff --git a/web/src/main/java/com/navercorp/pinpoint/web/vo/stat/chart/application/ApplicationLoadedClassChart.java b/web/src/main/java/com/navercorp/pinpoint/web/vo/stat/chart/application/ApplicationLoadedClassChart.java deleted file mode 100644 index 1e3af24bddc0..000000000000 --- a/web/src/main/java/com/navercorp/pinpoint/web/vo/stat/chart/application/ApplicationLoadedClassChart.java +++ /dev/null @@ -1,66 +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.web.vo.stat.chart.application; - -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinLoadedClassBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinLongFieldBo; -import com.navercorp.pinpoint.common.server.util.timewindow.TimeWindow; -import com.navercorp.pinpoint.web.vo.chart.Point; -import com.navercorp.pinpoint.web.vo.stat.AggreJoinLoadedClassBo; -import com.navercorp.pinpoint.web.vo.stat.chart.ChartGroupBuilder; -import com.navercorp.pinpoint.web.vo.stat.chart.StatChartGroup; - -import java.util.List; - -public class ApplicationLoadedClassChart extends DefaultApplicationChart { - - private static final Point.UncollectedPointCreator> UNCOLLECTED_POINT - = new LongApplicationStatPoint.UncollectedCreator(JoinLoadedClassBo.UNCOLLECTED_VALUE); - - private static final ChartGroupBuilder> BUILDER = newChartBuilder(); - - - - public enum LoadedClassChartType implements StatChartGroup.ApplicationChartType { - LOADED_CLASS_COUNT, - UNLOADED_CLASS_COUNT - } - - static ChartGroupBuilder> newChartBuilder() { - ChartGroupBuilder> builder = new ChartGroupBuilder<>(UNCOLLECTED_POINT); - builder.addPointFunction(LoadedClassChartType.LOADED_CLASS_COUNT, ApplicationLoadedClassChart::newLoadedClassCount); - builder.addPointFunction(LoadedClassChartType.UNLOADED_CLASS_COUNT, ApplicationLoadedClassChart::newUnloadedClassCount); - return builder; - } - - public ApplicationLoadedClassChart(TimeWindow timeWindow, List appStatList) { - super(timeWindow, appStatList, BUILDER); - } - - private static ApplicationStatPoint newLoadedClassCount(AggreJoinLoadedClassBo loadedClassBo) { - final JoinLongFieldBo loadedClassJoinValue = loadedClassBo.getLoadedClassJoinValue(); - long timestamp = loadedClassBo.getTimestamp(); - return StatPointUtils.toLongStatPoint(timestamp, loadedClassJoinValue); - } - - private static ApplicationStatPoint newUnloadedClassCount(AggreJoinLoadedClassBo loadedClassBo) { - final JoinLongFieldBo unloadedClassJoinValue = loadedClassBo.getUnloadedClassJoinValue(); - long timestamp = loadedClassBo.getTimestamp(); - - return StatPointUtils.toLongStatPoint(timestamp, unloadedClassJoinValue); - } - -} diff --git a/web/src/main/java/com/navercorp/pinpoint/web/vo/stat/chart/application/ApplicationMemoryChart.java b/web/src/main/java/com/navercorp/pinpoint/web/vo/stat/chart/application/ApplicationMemoryChart.java deleted file mode 100644 index b1fa4a9eebe4..000000000000 --- a/web/src/main/java/com/navercorp/pinpoint/web/vo/stat/chart/application/ApplicationMemoryChart.java +++ /dev/null @@ -1,68 +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.web.vo.stat.chart.application; - -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinLongFieldBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinMemoryBo; -import com.navercorp.pinpoint.common.server.util.timewindow.TimeWindow; -import com.navercorp.pinpoint.web.vo.chart.Point; -import com.navercorp.pinpoint.web.vo.stat.AggreJoinMemoryBo; -import com.navercorp.pinpoint.web.vo.stat.chart.ChartGroupBuilder; -import com.navercorp.pinpoint.web.vo.stat.chart.StatChartGroup; - -import java.util.List; - -/** - * @author minwoo.jung - */ -public class ApplicationMemoryChart extends DefaultApplicationChart { - - private static final Point.UncollectedPointCreator> UNCOLLECTED_POINT - = new DoubleApplicationStatPoint.UncollectedCreator(JoinMemoryBo.UNCOLLECTED_VALUE); - - private static final ChartGroupBuilder> BUILDER = newChartBuilder(); - - public enum MemoryChartType implements StatChartGroup.ApplicationChartType { - MEMORY_HEAP, - MEMORY_NON_HEAP - } - - static ChartGroupBuilder> newChartBuilder() { - ChartGroupBuilder> builder = new ChartGroupBuilder<>(UNCOLLECTED_POINT); - builder.addPointFunction(MemoryChartType.MEMORY_HEAP, ApplicationMemoryChart::newHeap); - builder.addPointFunction(MemoryChartType.MEMORY_NON_HEAP, ApplicationMemoryChart::newNonHeap); - return builder; - } - - - public ApplicationMemoryChart(TimeWindow timeWindow, List appStatList) { - super(timeWindow, appStatList, BUILDER); - } - - private static ApplicationStatPoint newHeap(AggreJoinMemoryBo memory) { - final JoinLongFieldBo heapUsedJoinValue = memory.getHeapUsedJoinValue(); - long timestamp = memory.getTimestamp(); - return StatPointUtils.longToDoubleStatPoint(timestamp, heapUsedJoinValue); - } - - private static ApplicationStatPoint newNonHeap(AggreJoinMemoryBo memory) { - final JoinLongFieldBo nonHeapUsedJoinValue = memory.getNonHeapUsedJoinValue(); - long timestamp = memory.getTimestamp(); - return StatPointUtils.longToDoubleStatPoint(timestamp, nonHeapUsedJoinValue); - } - -} diff --git a/web/src/main/java/com/navercorp/pinpoint/web/vo/stat/chart/application/ApplicationResponseTimeChart.java b/web/src/main/java/com/navercorp/pinpoint/web/vo/stat/chart/application/ApplicationResponseTimeChart.java deleted file mode 100644 index 1511ee9cab6a..000000000000 --- a/web/src/main/java/com/navercorp/pinpoint/web/vo/stat/chart/application/ApplicationResponseTimeChart.java +++ /dev/null @@ -1,60 +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.web.vo.stat.chart.application; - -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinLongFieldBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinResponseTimeBo; -import com.navercorp.pinpoint.common.server.util.timewindow.TimeWindow; -import com.navercorp.pinpoint.web.vo.chart.Point; -import com.navercorp.pinpoint.web.vo.stat.AggreJoinResponseTimeBo; -import com.navercorp.pinpoint.web.vo.stat.chart.ChartGroupBuilder; -import com.navercorp.pinpoint.web.vo.stat.chart.StatChartGroup; - -import java.util.List; - -/** - * @author minwoo.jung - */ -public class ApplicationResponseTimeChart extends DefaultApplicationChart { - - private static final Point.UncollectedPointCreator> UNCOLLECTED_POINT - = new DoubleApplicationStatPoint.UncollectedCreator(JoinResponseTimeBo.UNCOLLECTED_VALUE); - - - private static final ChartGroupBuilder> BUILDER = newChartBuilder(); - - public enum ResponseTimeChartType implements StatChartGroup.ApplicationChartType { - RESPONSE_TIME; - } - - static ChartGroupBuilder> newChartBuilder() { - ChartGroupBuilder> builder = new ChartGroupBuilder<>(UNCOLLECTED_POINT); - builder.addPointFunction(ResponseTimeChartType.RESPONSE_TIME, ApplicationResponseTimeChart::newResponseTime); - return builder; - } - - public ApplicationResponseTimeChart(TimeWindow timeWindow, List appStatList) { - super(timeWindow, appStatList, BUILDER); - } - - private static ApplicationStatPoint newResponseTime(AggreJoinResponseTimeBo time) { - final JoinLongFieldBo responseTimeJoinValue = time.getResponseTimeJoinValue(); - long timestamp = time.getTimestamp(); - return StatPointUtils.longToDoubleStatPoint(timestamp, responseTimeJoinValue); - } - -} diff --git a/web/src/main/java/com/navercorp/pinpoint/web/vo/stat/chart/application/ApplicationTotalThreadCountChart.java b/web/src/main/java/com/navercorp/pinpoint/web/vo/stat/chart/application/ApplicationTotalThreadCountChart.java deleted file mode 100644 index 03a9163b2842..000000000000 --- a/web/src/main/java/com/navercorp/pinpoint/web/vo/stat/chart/application/ApplicationTotalThreadCountChart.java +++ /dev/null @@ -1,55 +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.web.vo.stat.chart.application; - -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinLongFieldBo; -import com.navercorp.pinpoint.common.server.util.timewindow.TimeWindow; -import com.navercorp.pinpoint.web.vo.chart.Point; -import com.navercorp.pinpoint.web.vo.stat.AggreJoinTotalThreadCountBo; -import com.navercorp.pinpoint.web.vo.stat.chart.ChartGroupBuilder; -import com.navercorp.pinpoint.web.vo.stat.chart.StatChartGroup; - -import java.util.List; - -public class ApplicationTotalThreadCountChart extends DefaultApplicationChart { - - private static final Point.UncollectedPointCreator> UNCOLLECTED_POINT - = new LongApplicationStatPoint.UncollectedCreator(AggreJoinTotalThreadCountBo.UNCOLLECTED_VALUE); - - private static final ChartGroupBuilder> BUILDER = newChartBuilder(); - - public enum TotalThreadCountChartType implements StatChartGroup.ApplicationChartType { - TOTAL_THREAD_COUNT - } - - static ChartGroupBuilder> newChartBuilder() { - ChartGroupBuilder> builder = new ChartGroupBuilder<>(UNCOLLECTED_POINT); - builder.addPointFunction(TotalThreadCountChartType.TOTAL_THREAD_COUNT, ApplicationTotalThreadCountChart::newTotalThreadCount); - return builder; - } - - public ApplicationTotalThreadCountChart(TimeWindow timeWindow, List appStatList) { - super(timeWindow, appStatList, BUILDER); - } - - private static ApplicationStatPoint newTotalThreadCount(AggreJoinTotalThreadCountBo totalThreadCountBo) { - final JoinLongFieldBo totalThreadCountJoinValue = totalThreadCountBo.getTotalThreadCountJoinValue(); - long timestamp = totalThreadCountBo.getTimestamp(); - return StatPointUtils.toLongStatPoint(timestamp, totalThreadCountJoinValue); - } - -} diff --git a/web/src/main/java/com/navercorp/pinpoint/web/vo/stat/chart/application/ApplicationTransactionChart.java b/web/src/main/java/com/navercorp/pinpoint/web/vo/stat/chart/application/ApplicationTransactionChart.java deleted file mode 100644 index 41d17f47b4f5..000000000000 --- a/web/src/main/java/com/navercorp/pinpoint/web/vo/stat/chart/application/ApplicationTransactionChart.java +++ /dev/null @@ -1,58 +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.web.vo.stat.chart.application; - -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinLongFieldBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinTransactionBo; -import com.navercorp.pinpoint.common.server.util.timewindow.TimeWindow; -import com.navercorp.pinpoint.web.vo.chart.Point; -import com.navercorp.pinpoint.web.vo.stat.AggreJoinTransactionBo; -import com.navercorp.pinpoint.web.vo.stat.chart.ChartGroupBuilder; -import com.navercorp.pinpoint.web.vo.stat.chart.StatChartGroup; - -import java.util.List; - -/** - * @author minwoo.jung - */ -public class ApplicationTransactionChart extends DefaultApplicationChart { - - private static final Point.UncollectedPointCreator> UNCOLLECTED_POINT - = new DoubleApplicationStatPoint.UncollectedCreator(JoinTransactionBo.UNCOLLECTED_VALUE); - - public enum TransactionChartType implements StatChartGroup.ApplicationChartType { - TRANSACTION_COUNT - } - - private static final ChartGroupBuilder> BUILDER = newChartBuilder(); - - static ChartGroupBuilder> newChartBuilder() { - ChartGroupBuilder> builder = new ChartGroupBuilder<>(UNCOLLECTED_POINT); - builder.addPointFunction(TransactionChartType.TRANSACTION_COUNT, ApplicationTransactionChart::newTransactionPoint); - return builder; - } - - public ApplicationTransactionChart(TimeWindow timeWindow, List appStatList) { - super(timeWindow, appStatList, BUILDER); - } - - private static ApplicationStatPoint newTransactionPoint(AggreJoinTransactionBo transaction) { - final JoinLongFieldBo totalCountJoinValue = transaction.getTotalCountJoinValue(); - return new DoubleApplicationStatPoint(transaction.getTimestamp(), (double)totalCountJoinValue.getMin(), totalCountJoinValue.getMinAgentId(), (double)totalCountJoinValue.getMax(), totalCountJoinValue.getMaxAgentId(), (double)totalCountJoinValue.getAvg()); - } - -} diff --git a/web/src/main/java/com/navercorp/pinpoint/web/vo/stat/chart/application/IntApplicationStatPoint.java b/web/src/main/java/com/navercorp/pinpoint/web/vo/stat/chart/application/IntApplicationStatPoint.java deleted file mode 100644 index 6aeb0d78d676..000000000000 --- a/web/src/main/java/com/navercorp/pinpoint/web/vo/stat/chart/application/IntApplicationStatPoint.java +++ /dev/null @@ -1,56 +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.web.vo.stat.chart.application; - -import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinStatBo; -import com.navercorp.pinpoint.web.view.IntApplicationStatSerializer; - -/** - * @author Taejin Koo - */ -@JsonSerialize(using = IntApplicationStatSerializer.class) -public class IntApplicationStatPoint extends ApplicationStatPoint { - - public static final int UNCOLLECTED_VALUE = -1; - - public IntApplicationStatPoint(long xVal, Integer yValForMin, String agentIdForMin, Integer yValForMax, String agentIdForMax, Integer yValForAvg) { - super(xVal, yValForMin, agentIdForMin, yValForMax, agentIdForMax, yValForAvg); - } - - public static class UncollectedCreator implements UncollectedPointCreator> { - - private final int uncollectedValue; - - public UncollectedCreator() { - this(UNCOLLECTED_VALUE); - } - - public UncollectedCreator(int uncollectedValue) { - this.uncollectedValue = uncollectedValue; - } - - @Override - public ApplicationStatPoint createUnCollectedPoint(long xVal) { - return new IntApplicationStatPoint(xVal, uncollectedValue, - JoinStatBo.UNKNOWN_AGENT, uncollectedValue, - JoinStatBo.UNKNOWN_AGENT, uncollectedValue); - } - - } - -} diff --git a/web/src/main/java/com/navercorp/pinpoint/web/vo/stat/chart/application/LongApplicationStatPoint.java b/web/src/main/java/com/navercorp/pinpoint/web/vo/stat/chart/application/LongApplicationStatPoint.java deleted file mode 100644 index c39364d78670..000000000000 --- a/web/src/main/java/com/navercorp/pinpoint/web/vo/stat/chart/application/LongApplicationStatPoint.java +++ /dev/null @@ -1,56 +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.web.vo.stat.chart.application; - -import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinStatBo; -import com.navercorp.pinpoint.web.view.LongApplicationStatSerializer; - -/** - * @author Taejin Koo - */ -@JsonSerialize(using = LongApplicationStatSerializer.class) -public class LongApplicationStatPoint extends ApplicationStatPoint { - - public static final long UNCOLLECTED_VALUE = -1L; - - public LongApplicationStatPoint(long xVal, Long yValForMin, String agentIdForMin, Long yValForMax, String agentIdForMax, Long yValForAvg) { - super(xVal, yValForMin, agentIdForMin, yValForMax, agentIdForMax, yValForAvg); - } - - public static class UncollectedCreator implements UncollectedPointCreator> { - - private final long uncollectedValue; - - public UncollectedCreator() { - this(UNCOLLECTED_VALUE); - } - - public UncollectedCreator(long uncollectedValue) { - this.uncollectedValue = uncollectedValue; - } - - @Override - public ApplicationStatPoint createUnCollectedPoint(long xVal) { - return new LongApplicationStatPoint(xVal, uncollectedValue, - JoinStatBo.UNKNOWN_AGENT, uncollectedValue, - JoinStatBo.UNKNOWN_AGENT, uncollectedValue); - } - - } - -} diff --git a/web/src/main/java/com/navercorp/pinpoint/web/vo/stat/chart/application/StatPointUtils.java b/web/src/main/java/com/navercorp/pinpoint/web/vo/stat/chart/application/StatPointUtils.java deleted file mode 100644 index 0a92d42fd9dd..000000000000 --- a/web/src/main/java/com/navercorp/pinpoint/web/vo/stat/chart/application/StatPointUtils.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.navercorp.pinpoint.web.vo.stat.chart.application; - -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinDoubleFieldBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinIntFieldBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinLongFieldBo; - -public final class StatPointUtils { - private StatPointUtils() { - } - - public static ApplicationStatPoint toLongStatPoint(long timestamp, JoinLongFieldBo field) { - return new LongApplicationStatPoint(timestamp, field.getMin(), field.getMinAgentId(), - field.getMax(), field.getMaxAgentId(), field.getAvg()); - } - - public static ApplicationStatPoint toIntStatPoint(long timestamp, JoinIntFieldBo field) { - return new IntApplicationStatPoint(timestamp, field.getMin(), field.getMinAgentId(), - field.getMax(), field.getMaxAgentId(), field.getAvg()); - } - - public static ApplicationStatPoint toDoubleStatPoint(long timestamp, JoinDoubleFieldBo field) { - return new DoubleApplicationStatPoint(timestamp, field.getMin(), field.getMinAgentId(), - field.getMax(), field.getMaxAgentId(), field.getAvg()); - } - - - public static ApplicationStatPoint longToDoubleStatPoint(long timestamp, JoinLongFieldBo field) { - return new DoubleApplicationStatPoint(timestamp, (double) field.getMin(), field.getMinAgentId(), - (double) field.getMax(), field.getMaxAgentId(), (double) field.getAvg()); - } -} diff --git a/web/src/test/java/com/navercorp/pinpoint/web/mapper/stat/sampling/sampler/JoinActiveTraceSamplerTest.java b/web/src/test/java/com/navercorp/pinpoint/web/mapper/stat/sampling/sampler/JoinActiveTraceSamplerTest.java deleted file mode 100644 index d542ad0b4fde..000000000000 --- a/web/src/test/java/com/navercorp/pinpoint/web/mapper/stat/sampling/sampler/JoinActiveTraceSamplerTest.java +++ /dev/null @@ -1,58 +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.web.mapper.stat.sampling.sampler; - -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinActiveTraceBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinIntFieldBo; -import com.navercorp.pinpoint.web.vo.stat.AggreJoinActiveTraceBo; -import org.junit.jupiter.api.Test; - -import java.util.List; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * @author minwoo.jung - */ -public class JoinActiveTraceSamplerTest { - - @Test - public void sampleDataPointsTest() { - long currentTime = 1487149800000L; - JoinActiveTraceSampler sampler = new JoinActiveTraceSampler(); - List joinActiveTraceBoList = createJoinActiveTraceBoList(currentTime); - AggreJoinActiveTraceBo aggreJoinActiveTraceBo = sampler.sampleDataPoints(1, currentTime, joinActiveTraceBoList, JoinActiveTraceBo.EMPTY_JOIN_ACTIVE_TRACE_BO); - - assertEquals(aggreJoinActiveTraceBo.getId(), "test_app"); - assertEquals(aggreJoinActiveTraceBo.getHistogramSchemaType(), 1); - assertEquals(aggreJoinActiveTraceBo.getVersion(), 2); - assertEquals(aggreJoinActiveTraceBo.getTotalCountJoinValue(), new JoinIntFieldBo(130, 10, "app_1_1", 560, "app_4_2")); - assertEquals(aggreJoinActiveTraceBo.getTimestamp(), 1487149800000L); - } - - private List createJoinActiveTraceBoList(long currentTime) { - final String id = "test_app"; - return List.of( - new JoinActiveTraceBo(id, 1, (short) 2, 150, 10, "app_1_1", 230, "app_1_2", currentTime), - new JoinActiveTraceBo(id, 1, (short) 2, 110, 22, "app_2_1", 330, "app_2_2", currentTime + 5000), - new JoinActiveTraceBo(id, 1, (short) 2, 120, 24, "app_3_1", 540, "app_3_2", currentTime + 10000), - new JoinActiveTraceBo(id, 1, (short) 2, 130, 25, "app_4_1", 560, "app_4_2", currentTime + 15000), - new JoinActiveTraceBo(id, 1, (short) 2, 140, 12, "app_5_1", 260, "app_5_2", currentTime + 20000) - ); - } - -} \ No newline at end of file diff --git a/web/src/test/java/com/navercorp/pinpoint/web/mapper/stat/sampling/sampler/JoinCpuLoadSamplerTest.java b/web/src/test/java/com/navercorp/pinpoint/web/mapper/stat/sampling/sampler/JoinCpuLoadSamplerTest.java deleted file mode 100644 index ebbf6fddeba3..000000000000 --- a/web/src/test/java/com/navercorp/pinpoint/web/mapper/stat/sampling/sampler/JoinCpuLoadSamplerTest.java +++ /dev/null @@ -1,52 +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.web.mapper.stat.sampling.sampler; - -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinCpuLoadBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinDoubleFieldBo; -import com.navercorp.pinpoint.web.vo.stat.AggreJoinCpuLoadBo; -import org.junit.jupiter.api.Test; - -import java.util.Date; -import java.util.List; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * @author minwoo.jung - */ -public class JoinCpuLoadSamplerTest { - @Test - public void sampleDataPoints() throws Exception { - JoinCpuLoadSampler joinCpuLoadSampler = new JoinCpuLoadSampler(); - - long timeStamp = System.currentTimeMillis(); - List joinCpuLoadBoList = List.of( - new JoinCpuLoadBo("testApp", 0.11, 0.60, "agent1_1", 0.20, "agent1_2", 0.1, 0.60, "agent1_3", 0.47, "agent1_4", timeStamp + 5000), - new JoinCpuLoadBo("testApp", 0.22, 0.52, "agent2_1", 0.10, "agent2_2", 0.2, 0.70, "agent2_3", 0.24, "agent2_4", timeStamp + 10000), - new JoinCpuLoadBo("testApp", 0.33, 0.39, "agent3_1", 0.9, "agent3_2", 0.3, 0.85, "agent3_3", 0.33, "agent3_4", timeStamp + 15000), - new JoinCpuLoadBo("testApp", 0.44, 0.42, "agent4_1", 0.25, "agent4_2", 0.4, 0.58, "agent4_3", 0.56, "agent4_4", timeStamp + 20000), - new JoinCpuLoadBo("testApp", 0.55, 0.55, "agent5_1", 0.54, "agent5_2", 0.5, 0.86, "agent5_3", 0.76, "agent5_4", timeStamp + 25000) - ); - - AggreJoinCpuLoadBo aggreJoinCpuLoadBo = joinCpuLoadSampler.sampleDataPoints(0, new Date().getTime(), joinCpuLoadBoList, new JoinCpuLoadBo()); - assertEquals(aggreJoinCpuLoadBo.getId(), "testApp"); - assertEquals(aggreJoinCpuLoadBo.getJvmCpuLoadJoinValue(), new JoinDoubleFieldBo(33.0, 10.0, "agent2_2", 60.0, "agent1_1")); - assertEquals(aggreJoinCpuLoadBo.getSystemCpuLoadJoinValue(), new JoinDoubleFieldBo(30.0, (double) 24, "agent2_4", 86.0, "agent5_3")); - } - -} \ No newline at end of file diff --git a/web/src/test/java/com/navercorp/pinpoint/web/mapper/stat/sampling/sampler/JoinDataSourceSamplerTest.java b/web/src/test/java/com/navercorp/pinpoint/web/mapper/stat/sampling/sampler/JoinDataSourceSamplerTest.java deleted file mode 100644 index 5a3212615b5f..000000000000 --- a/web/src/test/java/com/navercorp/pinpoint/web/mapper/stat/sampling/sampler/JoinDataSourceSamplerTest.java +++ /dev/null @@ -1,100 +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.web.mapper.stat.sampling.sampler; - -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinDataSourceBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinDataSourceListBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinIntFieldBo; -import com.navercorp.pinpoint.web.vo.stat.AggreJoinDataSourceBo; -import com.navercorp.pinpoint.web.vo.stat.AggreJoinDataSourceListBo; -import org.assertj.core.api.Assertions; -import org.junit.jupiter.api.Test; - -import java.util.Comparator; -import java.util.List; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * @author minwoo.jung - */ -public class JoinDataSourceSamplerTest { - - private final Comparator COMPARATOR = Comparator.comparingInt(JoinDataSourceBo::getServiceTypeCode); - - @Test - public void sampleDataPointsTest() { - final String id = "test_app"; - JoinDataSourceSampler sampler = new JoinDataSourceSampler(); - long timestamp = System.currentTimeMillis(); - - AggreJoinDataSourceListBo aggreJoinDataSourceListBo = sampler.sampleDataPoints(0, timestamp, createJoinDataSourceListBoList(id, timestamp), new JoinDataSourceListBo()); - - assertEquals(aggreJoinDataSourceListBo.getId(), id); - assertEquals(aggreJoinDataSourceListBo.getTimestamp(), timestamp); - List joinDataSourceBoList = aggreJoinDataSourceListBo.getAggreJoinDataSourceBoList(); - joinDataSourceBoList.sort(COMPARATOR); - - Assertions.assertThat(joinDataSourceBoList).hasSize(5); - - AggreJoinDataSourceBo aggreJoinDataSourceBo1 = joinDataSourceBoList.get(0); - assertEquals(aggreJoinDataSourceBo1.getServiceTypeCode(), 1000); - assertEquals(aggreJoinDataSourceBo1.getUrl(), "jdbc:mysql"); - assertEquals(aggreJoinDataSourceBo1.getActiveConnectionSizeJoinValue(), new JoinIntFieldBo(60, 35, "agent_id_1_10", 110, "agent_id_6_50")); - - AggreJoinDataSourceBo aggreJoinDataSourceBo2 = joinDataSourceBoList.get(1); - assertEquals(aggreJoinDataSourceBo2.getServiceTypeCode(), 2000); - assertEquals(aggreJoinDataSourceBo2.getUrl(), "jdbc:mssql"); - assertEquals(aggreJoinDataSourceBo2.getActiveConnectionSizeJoinValue(), new JoinIntFieldBo(50, 15, "agent_id_2_10", 80, "agent_id_7_50")); - - AggreJoinDataSourceBo aggreJoinDataSourceBo3 = joinDataSourceBoList.get(2); - assertEquals(aggreJoinDataSourceBo3.getServiceTypeCode(), 3000); - assertEquals(aggreJoinDataSourceBo3.getUrl(), "jdbc:postgre"); - assertEquals(aggreJoinDataSourceBo3.getActiveConnectionSizeJoinValue(), new JoinIntFieldBo(40, 35, "agent_id_3_10", 100, "agent_id_8_50")); - - AggreJoinDataSourceBo aggreJoinDataSourceBo4 = joinDataSourceBoList.get(3); - assertEquals(aggreJoinDataSourceBo4.getServiceTypeCode(), 4000); - assertEquals(aggreJoinDataSourceBo4.getUrl(), "jdbc:oracle"); - assertEquals(aggreJoinDataSourceBo4.getActiveConnectionSizeJoinValue(), new JoinIntFieldBo(70, 20, "agent_id_4_10", 120, "agent_id_9_50")); - - AggreJoinDataSourceBo aggreJoinDataSourceBo5 = joinDataSourceBoList.get(4); - assertEquals(aggreJoinDataSourceBo5.getServiceTypeCode(), 5000); - assertEquals(aggreJoinDataSourceBo5.getUrl(), "jdbc:cubrid"); - assertEquals(aggreJoinDataSourceBo5.getActiveConnectionSizeJoinValue(), new JoinIntFieldBo(80, 35, "agent_id_5_10", 130, "agent_id_10_50")); - } - - - private List createJoinDataSourceListBoList(String id, long currentTime) { - return List.of( - new JoinDataSourceListBo(id, createJoinDataSourceBoList(10), currentTime + 5000), - new JoinDataSourceListBo(id, createJoinDataSourceBoList(20), currentTime + 10000), - new JoinDataSourceListBo(id, createJoinDataSourceBoList(30), currentTime + 15000), - new JoinDataSourceListBo(id, createJoinDataSourceBoList(40), currentTime + 20000), - new JoinDataSourceListBo(id, createJoinDataSourceBoList(50), currentTime + 25000) - ); - } - - private List createJoinDataSourceBoList(int plus) { - return List.of( - new JoinDataSourceBo((short) 1000, "jdbc:mysql", 30 + plus, 25 + plus, "agent_id_1_" + plus, 60 + plus, "agent_id_6_" + plus), - new JoinDataSourceBo((short) 2000, "jdbc:mssql", 20 + plus, 5 + plus, "agent_id_2_" + plus, 30 + plus, "agent_id_7_" + plus), - new JoinDataSourceBo((short) 3000, "jdbc:postgre", 10 + plus, 25 + plus, "agent_id_3_" + plus, 50 + plus, "agent_id_8_" + plus), - new JoinDataSourceBo((short) 4000, "jdbc:oracle", 40 + plus, 10 + plus, "agent_id_4_" + plus, 70 + plus, "agent_id_9_" + plus), - new JoinDataSourceBo((short) 5000, "jdbc:cubrid", 50 + plus, 25 + plus, "agent_id_5_" + plus, 80 + plus, "agent_id_10_" + plus) - ); - } -} \ No newline at end of file diff --git a/web/src/test/java/com/navercorp/pinpoint/web/mapper/stat/sampling/sampler/JoinDirectBufferSamplerTest.java b/web/src/test/java/com/navercorp/pinpoint/web/mapper/stat/sampling/sampler/JoinDirectBufferSamplerTest.java deleted file mode 100644 index 319df0ab451b..000000000000 --- a/web/src/test/java/com/navercorp/pinpoint/web/mapper/stat/sampling/sampler/JoinDirectBufferSamplerTest.java +++ /dev/null @@ -1,57 +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.web.mapper.stat.sampling.sampler; - -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinDirectBufferBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinLongFieldBo; -import com.navercorp.pinpoint.web.vo.stat.AggreJoinDirectBufferBo; -import org.junit.jupiter.api.Test; - -import java.util.Date; -import java.util.List; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * @author Roy Kim - */ -public class JoinDirectBufferSamplerTest { - @Test - public void sampleDataPoints() throws Exception { - JoinDirectBufferSampler joinDirectBufferSampler = new JoinDirectBufferSampler(); - - long timeStamp = System.currentTimeMillis(); - List joinDirectBufferBoList = List.of( - new JoinDirectBufferBo("testApp", 11, 60, "agent1_1", 20, "agent1_2", 10, 60, "agent1_3", 47, "agent1_4", 11, 61, "agent1_5", 21, "agent1_6", 10, 60, "agent1_7", 46, "agent1_8", timeStamp + 5000), - new JoinDirectBufferBo("testApp", 22, 52, "agent2_1", 10, "agent2_2", 20, 70, "agent2_3", 24, "agent2_4", 22, 53, "agent2_5", 11, "agent2_6", 20, 70, "agent2_7", 23, "agent2_8", timeStamp + 10000), - new JoinDirectBufferBo("testApp", 33, 39, "agent3_1", 90, "agent3_2", 30, 85, "agent3_3", 33, "agent3_4", 33, 40, "agent3_5", 91, "agent3_6", 30, 85, "agent3_7", 32, "agent3_8", timeStamp + 15000), - new JoinDirectBufferBo("testApp", 44, 42, "agent4_1", 25, "agent4_2", 40, 58, "agent4_3", 56, "agent4_4", 44, 43, "agent4_5", 26, "agent4_6", 40, 58, "agent4_7", 55, "agent4_8", timeStamp + 20000), - new JoinDirectBufferBo("testApp", 55, 55, "agent5_1", 54, "agent5_2", 50, 86, "agent5_3", 76, "agent5_4", 55, 56, "agent5_5", 55, "agent5_6", 50, 86, "agent5_7", 75, "agent5_8", timeStamp + 25000) - ); - - AggreJoinDirectBufferBo aggreJoinDirectBufferBo = joinDirectBufferSampler.sampleDataPoints(0, new Date().getTime(), joinDirectBufferBoList, new JoinDirectBufferBo()); - assertEquals(aggreJoinDirectBufferBo.getId(), "testApp"); - assertEquals(aggreJoinDirectBufferBo.getDirectCountJoinValue(), new JoinLongFieldBo(33L, 10L, "agent2_2", 60L, "agent1_1")); - assertEquals(aggreJoinDirectBufferBo.getDirectMemoryUsedJoinValue(), new JoinLongFieldBo(30L, 24L, "agent2_4", 86L, "agent5_3")); - - assertEquals(aggreJoinDirectBufferBo.getId(), "testApp"); - - assertEquals(aggreJoinDirectBufferBo.getMappedCountJoinValue(), new JoinLongFieldBo(33L, 11L, "agent2_6", 61L, "agent1_5")); - assertEquals(aggreJoinDirectBufferBo.getMappedMemoryUsedJoinValue(), new JoinLongFieldBo(30L, 23L, "agent2_8", 86L, "agent5_7")); - } - -} \ No newline at end of file diff --git a/web/src/test/java/com/navercorp/pinpoint/web/mapper/stat/sampling/sampler/JoinFileDescriptorSamplerTest.java b/web/src/test/java/com/navercorp/pinpoint/web/mapper/stat/sampling/sampler/JoinFileDescriptorSamplerTest.java deleted file mode 100644 index 3dfaf4413a0b..000000000000 --- a/web/src/test/java/com/navercorp/pinpoint/web/mapper/stat/sampling/sampler/JoinFileDescriptorSamplerTest.java +++ /dev/null @@ -1,51 +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.web.mapper.stat.sampling.sampler; - -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinFileDescriptorBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinLongFieldBo; -import com.navercorp.pinpoint.web.vo.stat.AggreJoinFileDescriptorBo; -import org.junit.jupiter.api.Test; - -import java.util.Date; -import java.util.List; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * @author Roy Kim - */ -public class JoinFileDescriptorSamplerTest { - @Test - public void sampleDataPoints() throws Exception { - JoinFileDescriptorSampler joinFileDescriptorSampler = new JoinFileDescriptorSampler(); - - long timeStamp = new Date().getTime(); - List joinFileDescriptorBoList = List.of( - new JoinFileDescriptorBo("testApp", 11, 60, "agent1_1", 20, "agent1_2", timeStamp + 5000), - new JoinFileDescriptorBo("testApp", 22, 52, "agent2_1", 10, "agent2_2", timeStamp + 10000), - new JoinFileDescriptorBo("testApp", 33, 39, "agent3_1", 90, "agent3_2", timeStamp + 15000), - new JoinFileDescriptorBo("testApp", 44, 42, "agent4_1", 25, "agent4_2", timeStamp + 20000), - new JoinFileDescriptorBo("testApp", 55, 55, "agent5_1", 54, "agent5_2", timeStamp + 25000) - ); - - AggreJoinFileDescriptorBo aggreJoinFileDescriptorBo = joinFileDescriptorSampler.sampleDataPoints(0, new Date().getTime(), joinFileDescriptorBoList, new JoinFileDescriptorBo()); - assertEquals(aggreJoinFileDescriptorBo.getId(), "testApp"); - assertEquals(aggreJoinFileDescriptorBo.getOpenFdCountJoinValue(), new JoinLongFieldBo(33L, 10L, "agent2_2", 60L, "agent1_1")); - } - -} \ No newline at end of file diff --git a/web/src/test/java/com/navercorp/pinpoint/web/mapper/stat/sampling/sampler/JoinLoadedClassSamplerTest.java b/web/src/test/java/com/navercorp/pinpoint/web/mapper/stat/sampling/sampler/JoinLoadedClassSamplerTest.java deleted file mode 100644 index 59832d04e675..000000000000 --- a/web/src/test/java/com/navercorp/pinpoint/web/mapper/stat/sampling/sampler/JoinLoadedClassSamplerTest.java +++ /dev/null @@ -1,48 +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.web.mapper.stat.sampling.sampler; - -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinLoadedClassBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinLongFieldBo; -import com.navercorp.pinpoint.web.vo.stat.AggreJoinLoadedClassBo; -import org.junit.jupiter.api.Test; - -import java.util.Date; -import java.util.List; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -public class JoinLoadedClassSamplerTest { - @Test - public void sampleDataPoints() { - JoinLoadedClassSampler joinLoadedClassSampler = new JoinLoadedClassSampler(); - - long timeStamp = System.currentTimeMillis(); - List joinLoadedClassBoList = List.of( - new JoinLoadedClassBo("testApp", 11, 60, "agent1_1", 20, "agent1_2", 11, 60, "agent1_1", 20, "agent1_2", timeStamp + 5000), - new JoinLoadedClassBo("testApp", 22, 52, "agent2_1", 10, "agent2_2", 22, 52, "agent2_1", 10, "agent2_2", timeStamp + 10000), - new JoinLoadedClassBo("testApp", 33, 39, "agent3_1", 90, "agent3_2", 33, 39, "agent3_1", 90, "agent3_2", timeStamp + 15000), - new JoinLoadedClassBo("testApp", 44, 42, "agent4_1", 25, "agent4_2", 44, 42, "agent4_1", 25, "agent4_2", timeStamp + 20000), - new JoinLoadedClassBo("testApp", 55, 55, "agent5_1", 54, "agent5_2", 55, 55, "agent5_1", 54, "agent5_2", timeStamp + 25000) - ); - - AggreJoinLoadedClassBo aggreJoinLoadedClassBo = joinLoadedClassSampler.sampleDataPoints(0, new Date().getTime(), joinLoadedClassBoList, new JoinLoadedClassBo()); - assertEquals(aggreJoinLoadedClassBo.getId(), "testApp"); - assertEquals(aggreJoinLoadedClassBo.getLoadedClassJoinValue(), new JoinLongFieldBo(33L, 10L, "agent2_2", 60L, "agent1_1")); - assertEquals(aggreJoinLoadedClassBo.getUnloadedClassJoinValue(), new JoinLongFieldBo(33L, 10L, "agent2_2", 60L, "agent1_1")); - } -} diff --git a/web/src/test/java/com/navercorp/pinpoint/web/mapper/stat/sampling/sampler/JoinMemorySamplerTest.java b/web/src/test/java/com/navercorp/pinpoint/web/mapper/stat/sampling/sampler/JoinMemorySamplerTest.java deleted file mode 100644 index 4208d7cf35f2..000000000000 --- a/web/src/test/java/com/navercorp/pinpoint/web/mapper/stat/sampling/sampler/JoinMemorySamplerTest.java +++ /dev/null @@ -1,55 +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.web.mapper.stat.sampling.sampler; - -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinLongFieldBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinMemoryBo; -import com.navercorp.pinpoint.web.vo.stat.AggreJoinMemoryBo; -import org.junit.jupiter.api.Test; - -import java.util.List; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * @author minwoo.jung - */ -public class JoinMemorySamplerTest { - public static final String ID = "test_app"; - - @Test - public void sampleDataPointsTest() throws Exception { - long currentTime = 1487149800000L; - List joinMemoryBoList = createJoinMemoryBoList(currentTime); - AggreJoinMemoryBo aggreJoinMemoryBo = new JoinMemorySampler().sampleDataPoints(1, currentTime, joinMemoryBoList, JoinMemoryBo.EMPTY_JOIN_MEMORY_BO); - assertEquals(aggreJoinMemoryBo.getId(), ID); - assertEquals(aggreJoinMemoryBo.getTimestamp(), currentTime); - assertEquals(aggreJoinMemoryBo.getHeapUsedJoinValue(), new JoinLongFieldBo(3000L, 100L, "app_4_1", 8000L, "app_3_2")); - assertEquals(aggreJoinMemoryBo.getNonHeapUsedJoinValue(), new JoinLongFieldBo(300L, 50L, "app_1_3", 2900L, "app_5_4")); - } - - private List createJoinMemoryBoList(long currentTime) { - return List.of( - new JoinMemoryBo(ID, currentTime + 5000, 3000, 2000, 5000, "app_1_1", "app_1_2", 500, 50, 600, "app_1_3", "app_1_4"), - new JoinMemoryBo(ID, currentTime + 10000, 4000, 1000, 7000, "app_2_1", "app_2_2", 400, 150, 600, "app_2_3", "app_2_4"), - new JoinMemoryBo(ID, currentTime + 15000, 5000, 3000, 8000, "app_3_1", "app_3_2", 200, 100, 200, "app_3_3", "app_3_4"), - new JoinMemoryBo(ID, currentTime + 20000, 1000, 100, 3000, "app_4_1", "app_4_2", 100, 900, 1000, "app_4_3", "app_4_4"), - new JoinMemoryBo(ID, currentTime + 25000, 2000, 1000, 6000, "app_5_1", "app_5_2", 300, 100, 2900, "app_5_3", "app_5_4") - ); - } - -} \ No newline at end of file diff --git a/web/src/test/java/com/navercorp/pinpoint/web/mapper/stat/sampling/sampler/JoinResponseTimeSamplerTest.java b/web/src/test/java/com/navercorp/pinpoint/web/mapper/stat/sampling/sampler/JoinResponseTimeSamplerTest.java deleted file mode 100644 index 7f64ade45981..000000000000 --- a/web/src/test/java/com/navercorp/pinpoint/web/mapper/stat/sampling/sampler/JoinResponseTimeSamplerTest.java +++ /dev/null @@ -1,65 +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.web.mapper.stat.sampling.sampler; - -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinLongFieldBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinResponseTimeBo; -import com.navercorp.pinpoint.web.vo.stat.AggreJoinResponseTimeBo; -import org.junit.jupiter.api.Test; - -import java.util.List; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * @author minwoo.jung - */ -public class JoinResponseTimeSamplerTest { - - @Test - public void sampleDataPointsTest() { - long currentTime = 1487149800000L; - JoinResponseTimeSampler joinResponseTimeSampler = new JoinResponseTimeSampler(); - List joinResponseTimeBoList = createJoinResponseTimeList(currentTime); - AggreJoinResponseTimeBo aggreJoinResponseTimeBo = joinResponseTimeSampler.sampleDataPoints(1, currentTime, joinResponseTimeBoList, JoinResponseTimeBo.EMPTY_JOIN_RESPONSE_TIME_BO); - assertEquals(aggreJoinResponseTimeBo.getId(), "test_app"); - assertEquals(aggreJoinResponseTimeBo.getTimestamp(), 1487149800000L); - assertEquals(aggreJoinResponseTimeBo.getResponseTimeJoinValue(), new JoinLongFieldBo(3000L, 2L, "app_1_1", 9000L, "app_2_1")); - } - - private List createJoinResponseTimeList(long currentTime) { - final String id = "test_app"; - return List.of( - new JoinResponseTimeBo(id, currentTime, 3000, 2, "app_1_1", 6000, "app_1_1"), - new JoinResponseTimeBo(id, currentTime + 5000, 4000, 200, "app_2_1", 9000, "app_2_1"), - new JoinResponseTimeBo(id, currentTime + 10000, 2000, 20, "app_3_1", 7000, "app_3_1"), - new JoinResponseTimeBo(id, currentTime + 15000, 5000, 20, "app_4_1", 8000, "app_4_1"), - new JoinResponseTimeBo(id, currentTime + 20000, 1000, 10, "app_5_1", 6600, "app_5_1") - ); - } - - @Test - public void sampleDataPoints2Test() { - long currentTime = 1487149800000L; - JoinResponseTimeSampler joinResponseTimeSampler = new JoinResponseTimeSampler(); - - AggreJoinResponseTimeBo aggreJoinResponseTimeBo = joinResponseTimeSampler.sampleDataPoints(1, currentTime, List.of(), JoinResponseTimeBo.EMPTY_JOIN_RESPONSE_TIME_BO); - assertEquals(aggreJoinResponseTimeBo.getId(), JoinResponseTimeBo.UNKNOWN_ID); - assertEquals(aggreJoinResponseTimeBo.getTimestamp(), 1487149800000L); - assertEquals(aggreJoinResponseTimeBo.getResponseTimeJoinValue(), new JoinLongFieldBo(JoinResponseTimeBo.UNCOLLECTED_VALUE, JoinResponseTimeBo.UNCOLLECTED_VALUE, JoinResponseTimeBo.UNKNOWN_AGENT, JoinResponseTimeBo.UNCOLLECTED_VALUE, JoinResponseTimeBo.UNKNOWN_AGENT)); - } -} \ No newline at end of file diff --git a/web/src/test/java/com/navercorp/pinpoint/web/mapper/stat/sampling/sampler/JoinTotalThreadSamplerTest.java b/web/src/test/java/com/navercorp/pinpoint/web/mapper/stat/sampling/sampler/JoinTotalThreadSamplerTest.java deleted file mode 100644 index 0b0c8cda6427..000000000000 --- a/web/src/test/java/com/navercorp/pinpoint/web/mapper/stat/sampling/sampler/JoinTotalThreadSamplerTest.java +++ /dev/null @@ -1,47 +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.web.mapper.stat.sampling.sampler; - -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinLongFieldBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinTotalThreadCountBo; -import com.navercorp.pinpoint.web.vo.stat.AggreJoinTotalThreadCountBo; -import org.junit.jupiter.api.Test; - -import java.util.Date; -import java.util.List; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -public class JoinTotalThreadSamplerTest { - @Test - public void sampleDataPoints() { - JoinTotalThreadCountSampler joinTotalThreadCountSampler = new JoinTotalThreadCountSampler(); - - long timeStamp = System.currentTimeMillis(); - List joinTotalThreadCountBoList = List.of( - new JoinTotalThreadCountBo("testApp", timeStamp + 5000, 11, 60, "agent1_1", 20, "agent1_2"), - new JoinTotalThreadCountBo("testApp", timeStamp + 10000, 22, 52, "agent2_1", 10, "agent2_2"), - new JoinTotalThreadCountBo("testApp", timeStamp + 15000, 33, 39, "agent3_1", 90, "agent3_2"), - new JoinTotalThreadCountBo("testApp", timeStamp + 20000, 44, 42, "agent4_1", 25, "agent4_2"), - new JoinTotalThreadCountBo("testApp", timeStamp + 25000, 55, 55, "agent5_1", 54, "agent5_2") - ); - - AggreJoinTotalThreadCountBo aggreJoinTotalThraedCountBo = joinTotalThreadCountSampler.sampleDataPoints(0, new Date().getTime(), joinTotalThreadCountBoList, new JoinTotalThreadCountBo()); - assertEquals(aggreJoinTotalThraedCountBo.getId(), "testApp"); - assertEquals(aggreJoinTotalThraedCountBo.getTotalThreadCountJoinValue(), new JoinLongFieldBo(33L, 39L, "agent3_1", 90L, "agent3_2")); - } -} diff --git a/web/src/test/java/com/navercorp/pinpoint/web/mapper/stat/sampling/sampler/JoinTransactionSamplerTest.java b/web/src/test/java/com/navercorp/pinpoint/web/mapper/stat/sampling/sampler/JoinTransactionSamplerTest.java deleted file mode 100644 index 24001e912075..000000000000 --- a/web/src/test/java/com/navercorp/pinpoint/web/mapper/stat/sampling/sampler/JoinTransactionSamplerTest.java +++ /dev/null @@ -1,57 +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.web.mapper.stat.sampling.sampler; - -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinLongFieldBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinTransactionBo; -import com.navercorp.pinpoint.web.vo.stat.AggreJoinTransactionBo; -import org.junit.jupiter.api.Test; - -import java.util.List; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * @author minwoo.jung - */ -public class JoinTransactionSamplerTest { - - @Test - public void sampleDataPointsTest() { - long currentTime = 1487149800000L; - JoinTransactionSampler joinTransactionSampler = new JoinTransactionSampler(); - List joinTransactionBoList = createJoinTransactionBoList(currentTime); - AggreJoinTransactionBo aggreJoinTransactionBo = joinTransactionSampler.sampleDataPoints(1, currentTime, joinTransactionBoList, JoinTransactionBo.EMPTY_JOIN_TRANSACTION_BO); - - assertEquals(aggreJoinTransactionBo.getId(), "test_app"); - assertEquals(aggreJoinTransactionBo.getCollectInterval(), 5000); - assertEquals(aggreJoinTransactionBo.getTotalCountJoinValue(), new JoinLongFieldBo(130l, 10l, "app_1_1", 560l, "app_4_2")); - assertEquals(aggreJoinTransactionBo.getTimestamp(), 1487149800000L); - } - - private List createJoinTransactionBoList(long currentTime) { - final String id = "test_app"; - return List.of( - new JoinTransactionBo(id, 5000, 150, 10, "app_1_1", 230, "app_1_2", currentTime), - new JoinTransactionBo(id, 5000, 110, 22, "app_2_1", 330, "app_2_2", currentTime + 5000), - new JoinTransactionBo(id, 5000, 120, 24, "app_3_1", 540, "app_3_2", currentTime + 10000), - new JoinTransactionBo(id, 5000, 130, 25, "app_4_1", 560, "app_4_2", currentTime + 15000), - new JoinTransactionBo(id, 5000, 140, 12, "app_5_1", 260, "app_5_2", currentTime + 20000) - ); - } - -} \ No newline at end of file diff --git a/web/src/test/java/com/navercorp/pinpoint/web/service/appmetric/ApplicationDataSourceServiceTest.java b/web/src/test/java/com/navercorp/pinpoint/web/service/appmetric/ApplicationDataSourceServiceTest.java deleted file mode 100644 index f8a1a4eeee78..000000000000 --- a/web/src/test/java/com/navercorp/pinpoint/web/service/appmetric/ApplicationDataSourceServiceTest.java +++ /dev/null @@ -1,72 +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.web.service.appmetric; - -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinDataSourceBo; -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinDataSourceListBo; -import com.navercorp.pinpoint.loader.service.ServiceTypeRegistryService; -import com.navercorp.pinpoint.web.dao.appmetric.ApplicationMetricDao; -import com.navercorp.pinpoint.web.vo.stat.AggreJoinDataSourceBo; -import com.navercorp.pinpoint.web.vo.stat.AggreJoinDataSourceListBo; -import org.junit.jupiter.api.Test; - -import java.util.Date; -import java.util.List; -import java.util.Map; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Mockito.mock; - -/** - * @author minwoo.jung - */ -public class ApplicationDataSourceServiceTest { - @Test - public void classifyByDataSourceUrlTest() { - final String id = "test_app"; - long timestamp = new Date().getTime(); - - final ApplicationMetricDao applicationDataSourceDao = mock(ApplicationMetricDao.class); - final ServiceTypeRegistryService serviceTypeRegistryService = mock(ServiceTypeRegistryService.class); - ApplicationDataSourceService applicationDataSourceService = new ApplicationDataSourceService(applicationDataSourceDao, serviceTypeRegistryService); - - Map> dataSourceKeyListMap = applicationDataSourceService.classifyByDataSourceUrl(createJoinDataSourceListBoList(id, timestamp)); - - assertThat(dataSourceKeyListMap).hasSize(5); - } - - private List createJoinDataSourceListBoList(String id, long currentTime) { - return List.of( - new AggreJoinDataSourceListBo(id, createJoinDataSourceBoList(10, currentTime + 5000), currentTime + 5000), - new AggreJoinDataSourceListBo(id, createJoinDataSourceBoList(20, currentTime + 10000), currentTime + 10000), - new AggreJoinDataSourceListBo(id, createJoinDataSourceBoList(30, currentTime + 15000), currentTime + 15000), - new AggreJoinDataSourceListBo(id, createJoinDataSourceBoList(40, currentTime + 20000), currentTime + 20000), - new AggreJoinDataSourceListBo(id, createJoinDataSourceBoList(50, currentTime + 25000), currentTime + 25000) - ); - } - - private List createJoinDataSourceBoList(int plus, long timestamp) { - return List.of( - new AggreJoinDataSourceBo((short) 1000, "jdbc:mysql", 30 + plus, 25 + plus, "agent_id_1_" + plus, 60 + plus, "agent_id_6_" + plus, timestamp), - new AggreJoinDataSourceBo((short) 2000, "jdbc:mssql", 20 + plus, 5 + plus, "agent_id_2_" + plus, 30 + plus, "agent_id_7_" + plus, timestamp), - new AggreJoinDataSourceBo((short) 3000, "jdbc:postgre", 10 + plus, 25 + plus, "agent_id_3_" + plus, 50 + plus, "agent_id_8_" + plus, timestamp), - new AggreJoinDataSourceBo((short) 4000, "jdbc:oracle", 40 + plus, 10 + plus, "agent_id_4_" + plus, 70 + plus, "agent_id_9_" + plus, timestamp), - new AggreJoinDataSourceBo((short) 5000, "jdbc:cubrid", 50 + plus, 25 + plus, "agent_id_5_" + plus, 80 + plus, "agent_id_10_" + plus, timestamp) - ); - } - -} \ No newline at end of file diff --git a/web/src/test/java/com/navercorp/pinpoint/web/vo/stat/chart/application/ApplicationActiveTraceChartGroupTest.java b/web/src/test/java/com/navercorp/pinpoint/web/vo/stat/chart/application/ApplicationActiveTraceChartGroupTest.java deleted file mode 100644 index 613599713a8f..000000000000 --- a/web/src/test/java/com/navercorp/pinpoint/web/vo/stat/chart/application/ApplicationActiveTraceChartGroupTest.java +++ /dev/null @@ -1,75 +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.web.vo.stat.chart.application; - -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinIntFieldBo; -import com.navercorp.pinpoint.common.server.util.time.Range; -import com.navercorp.pinpoint.common.server.util.timewindow.TimeWindow; -import com.navercorp.pinpoint.web.vo.chart.Chart; -import com.navercorp.pinpoint.web.vo.stat.AggreJoinActiveTraceBo; -import com.navercorp.pinpoint.web.vo.stat.chart.ChartGroupBuilder; -import com.navercorp.pinpoint.web.vo.stat.chart.StatChartGroup; -import org.junit.jupiter.api.Test; - -import java.util.List; -import java.util.Map; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * @author minwoo.jung - */ -public class ApplicationActiveTraceChartGroupTest { - - @Test - public void createApplicationActiveTraceChartGroupTest() { - long time = 1495418083250L; - String id = "testApp"; - Range range = Range.between(time - 240000, time); - TimeWindow timeWindow = new TimeWindow(range); - List aggreJoinActiveTraceBoList = List.of( - new AggreJoinActiveTraceBo(id, 1, (short) 2, 150, 10, "app_1_1", 230, "app_1_2", time), - new AggreJoinActiveTraceBo(id, 1, (short) 2, 110, 22, "app_2_1", 330, "app_2_2", time - 60000), - new AggreJoinActiveTraceBo(id, 1, (short) 2, 120, 24, "app_3_1", 540, "app_3_2", time - 120000), - new AggreJoinActiveTraceBo(id, 1, (short) 2, 130, 25, "app_4_1", 560, "app_4_2", time - 180000), - new AggreJoinActiveTraceBo(id, 1, (short) 2, 140, 12, "app_5_1", 260, "app_5_2", time - 240000) - ); - - ChartGroupBuilder> builder = ApplicationActiveTraceChart.newChartBuilder(); - StatChartGroup> statChartGroup = builder.build(timeWindow, aggreJoinActiveTraceBoList); - Map>> charts = statChartGroup.getCharts(); - - Chart> activeTraceChart = charts.get(ApplicationActiveTraceChart.ActiveTraceChartType.ACTIVE_TRACE_COUNT); - List> activeTracePointList = activeTraceChart.getPoints(); - assertThat(activeTracePointList).hasSize(5); - int index = activeTracePointList.size(); - for (ApplicationStatPoint point : activeTracePointList) { - testActiveTraceCount(point, aggreJoinActiveTraceBoList.get(--index)); - } - } - - private void testActiveTraceCount(ApplicationStatPoint activeTracePoint, AggreJoinActiveTraceBo aggreJoinActiveTraceBo) { - final JoinIntFieldBo totalCountJoinValue = aggreJoinActiveTraceBo.getTotalCountJoinValue(); - assertEquals(activeTracePoint.getYValForAvg(), totalCountJoinValue.getAvg()); - assertEquals(activeTracePoint.getYValForMin(), totalCountJoinValue.getMin()); - assertEquals(activeTracePoint.getYValForMax(), totalCountJoinValue.getMax()); - assertEquals(activeTracePoint.getAgentIdForMin(), totalCountJoinValue.getMinAgentId()); - assertEquals(activeTracePoint.getAgentIdForMax(), totalCountJoinValue.getMaxAgentId()); - } - -} \ No newline at end of file diff --git a/web/src/test/java/com/navercorp/pinpoint/web/vo/stat/chart/application/ApplicationCpuLoadChartGroupTest.java b/web/src/test/java/com/navercorp/pinpoint/web/vo/stat/chart/application/ApplicationCpuLoadChartGroupTest.java deleted file mode 100644 index 0946f96968f9..000000000000 --- a/web/src/test/java/com/navercorp/pinpoint/web/vo/stat/chart/application/ApplicationCpuLoadChartGroupTest.java +++ /dev/null @@ -1,94 +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.web.vo.stat.chart.application; - -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinDoubleFieldBo; -import com.navercorp.pinpoint.common.server.util.time.Range; -import com.navercorp.pinpoint.common.server.util.timewindow.TimeWindow; -import com.navercorp.pinpoint.web.vo.chart.Chart; -import com.navercorp.pinpoint.web.vo.stat.AggreJoinCpuLoadBo; -import com.navercorp.pinpoint.web.vo.stat.chart.ChartGroupBuilder; -import com.navercorp.pinpoint.web.vo.stat.chart.StatChartGroup; -import org.junit.jupiter.api.Test; - -import java.util.List; -import java.util.Map; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * @author minwoo.jung - */ -public class ApplicationCpuLoadChartGroupTest { - - @Test - public void createApplicationCpuLoadChartGroupTest() { - long time = 1495418083250L; - Range range = Range.between(time - 240000, time); - TimeWindow timeWindow = new TimeWindow(range); - List aggreCpuLoadList = List.of( - new AggreJoinCpuLoadBo("testApp", 0.11, 0.60, "agent1_1", 0.20, "agent1_2", 0.1, 0.60, "agent1_3", 0.47, "agent1_4", time), - new AggreJoinCpuLoadBo("testApp", 0.22, 0.52, "agent2_1", 0.10, "agent2_2", 0.2, 0.70, "agent2_3", 0.24, "agent2_4", time - 60000), - new AggreJoinCpuLoadBo("testApp", 0.33, 0.39, "agent3_1", 0.9, "agent3_2", 0.3, 0.85, "agent3_3", 0.33, "agent3_4", time - 120000), - new AggreJoinCpuLoadBo("testApp", 0.44, 0.42, "agent4_1", 0.25, "agent4_2", 0.4, 0.58, "agent4_3", 0.56, "agent4_4", time - 180000), - new AggreJoinCpuLoadBo("testApp", 0.55, 0.55, "agent5_1", 0.54, "agent5_2", 0.5, 0.86, "agent5_3", 0.76, "agent5_4", time - 240000) - ); - - ChartGroupBuilder> builder = ApplicationCpuLoadChart.newChartBuilder(); - StatChartGroup> statChartGroup = builder.build(timeWindow, aggreCpuLoadList); - Map>> charts = statChartGroup.getCharts(); - assertThat(charts).hasSize(2); - - Chart> jvmCpuLodChart = charts.get(ApplicationCpuLoadChart.CpuLoadChartType.CPU_LOAD_JVM); - List> jvmCpuLoadPoints = jvmCpuLodChart.getPoints(); - assertThat(jvmCpuLoadPoints).hasSize(5); - int index = jvmCpuLoadPoints.size(); - for (ApplicationStatPoint point : jvmCpuLoadPoints) { - testJvmCpuLoad(point, aggreCpuLoadList.get(--index)); - } - - Chart> sysCpuLoadChart = charts.get(ApplicationCpuLoadChart.CpuLoadChartType.CPU_LOAD_SYSTEM); - List> sysCpuLoadPoints = sysCpuLoadChart.getPoints(); - assertThat(sysCpuLoadPoints).hasSize(5); - index = sysCpuLoadPoints.size(); - for (ApplicationStatPoint point : sysCpuLoadPoints) { - testSysCpuLoad(point, aggreCpuLoadList.get(--index)); - } - - } - - private void testSysCpuLoad(ApplicationStatPoint cpuLoadPoint, AggreJoinCpuLoadBo aggreJoinCpuLoadBo) { - assertEquals(cpuLoadPoint.getXVal(), aggreJoinCpuLoadBo.getTimestamp()); - final JoinDoubleFieldBo systemCpuLoadJoinValue = aggreJoinCpuLoadBo.getSystemCpuLoadJoinValue(); - assertEquals(cpuLoadPoint.getYValForAvg(), systemCpuLoadJoinValue.getAvg(), 0); - assertEquals(cpuLoadPoint.getYValForMin(), systemCpuLoadJoinValue.getMin(), 0); - assertEquals(cpuLoadPoint.getYValForMax(), systemCpuLoadJoinValue.getMax(), 0); - assertEquals(cpuLoadPoint.getAgentIdForMin(), systemCpuLoadJoinValue.getMinAgentId()); - assertEquals(cpuLoadPoint.getAgentIdForMax(), systemCpuLoadJoinValue.getMaxAgentId()); - } - - private void testJvmCpuLoad(ApplicationStatPoint cpuLoadPoint, AggreJoinCpuLoadBo aggreJoinCpuLoadBo) { - final JoinDoubleFieldBo jvmCpuLoadJoinValue = aggreJoinCpuLoadBo.getJvmCpuLoadJoinValue(); - assertEquals(cpuLoadPoint.getYValForAvg(), jvmCpuLoadJoinValue.getAvg(), 0); - assertEquals(cpuLoadPoint.getYValForMin(), jvmCpuLoadJoinValue.getMin(), 0); - assertEquals(cpuLoadPoint.getYValForMax(), jvmCpuLoadJoinValue.getMax(), 0); - assertEquals(cpuLoadPoint.getAgentIdForMin(), jvmCpuLoadJoinValue.getMinAgentId()); - assertEquals(cpuLoadPoint.getAgentIdForMax(), jvmCpuLoadJoinValue.getMaxAgentId()); - } - -} \ No newline at end of file diff --git a/web/src/test/java/com/navercorp/pinpoint/web/vo/stat/chart/application/ApplicationDataSourceChartGroupTest.java b/web/src/test/java/com/navercorp/pinpoint/web/vo/stat/chart/application/ApplicationDataSourceChartGroupTest.java deleted file mode 100644 index df5870322f08..000000000000 --- a/web/src/test/java/com/navercorp/pinpoint/web/vo/stat/chart/application/ApplicationDataSourceChartGroupTest.java +++ /dev/null @@ -1,78 +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.web.vo.stat.chart.application; - -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinIntFieldBo; -import com.navercorp.pinpoint.common.server.util.time.Range; -import com.navercorp.pinpoint.common.server.util.timewindow.TimeWindow; -import com.navercorp.pinpoint.web.vo.chart.Chart; -import com.navercorp.pinpoint.web.vo.stat.AggreJoinDataSourceBo; -import com.navercorp.pinpoint.web.vo.stat.chart.StatChartGroup; -import org.junit.jupiter.api.Test; - -import java.util.List; -import java.util.Map; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * @author minwoo.jung - */ -public class ApplicationDataSourceChartGroupTest { - - @Test - public void createApplicationDataSourceChartGroup() { - long time = 1495418083250L; - Range range = Range.between(time - 240000, time); - TimeWindow timeWindow = new TimeWindow(range); - - List aggreJoinDataSourceBoList = List.of( - new AggreJoinDataSourceBo((short) 1000, "jdbc:mysql", 30, 25, "agent_id_1", 60, "agent_id_6", time), - new AggreJoinDataSourceBo((short) 1000, "jdbc:mysql", 20, 5, "agent_id_2", 30, "agent_id_7", time - 60000), - new AggreJoinDataSourceBo((short) 1000, "jdbc:mysql", 10, 25, "agent_id_3", 50, "agent_id_8", time - 120000), - new AggreJoinDataSourceBo((short) 1000, "jdbc:mysql", 40, 4, "agent_id_4", 70, "agent_id_9", time - 180000), - new AggreJoinDataSourceBo((short) 1000, "jdbc:mysql", 50, 25, "agent_id_5", 80, "agent_id_10", time - 240000) - ); - - - StatChartGroup> applicationDataSourceChartGroup = new ApplicationDataSourceChart.ApplicationDataSourceChartGroup(timeWindow, "jdbc:mysql", "dbcp2", aggreJoinDataSourceBoList); - Map>> charts = applicationDataSourceChartGroup.getCharts(); - assertThat(charts).hasSize(1); - - Chart> dataSourceChart = charts.get(ApplicationDataSourceChart.DataSourceChartType.ACTIVE_CONNECTION_SIZE); - List> dataSourcePoints = dataSourceChart.getPoints(); - assertThat(dataSourcePoints).hasSize(5); - int index = dataSourcePoints.size(); - - for (ApplicationStatPoint point : dataSourcePoints) { - testDataSource(point, aggreJoinDataSourceBoList.get(--index)); - } - } - - private void testDataSource(ApplicationStatPoint dataSourcePoint, AggreJoinDataSourceBo aggreJoinDataSourceBo) { - assertEquals(dataSourcePoint.getXVal(), aggreJoinDataSourceBo.getTimestamp()); - final JoinIntFieldBo activeConnectionSizeJoinValue = aggreJoinDataSourceBo.getActiveConnectionSizeJoinValue(); - assertEquals(dataSourcePoint.getYValForAvg(), activeConnectionSizeJoinValue.getAvg(), 0); - assertEquals(dataSourcePoint.getYValForMin(), activeConnectionSizeJoinValue.getMin(), 0); - assertEquals(dataSourcePoint.getYValForMax(), activeConnectionSizeJoinValue.getMax(), 0); - assertEquals(dataSourcePoint.getAgentIdForMin(), activeConnectionSizeJoinValue.getMinAgentId()); - assertEquals(dataSourcePoint.getAgentIdForMax(), activeConnectionSizeJoinValue.getMaxAgentId()); - } - - -} \ No newline at end of file diff --git a/web/src/test/java/com/navercorp/pinpoint/web/vo/stat/chart/application/ApplicationDirectBufferChartGroupTest.java b/web/src/test/java/com/navercorp/pinpoint/web/vo/stat/chart/application/ApplicationDirectBufferChartGroupTest.java deleted file mode 100644 index 1a97b807f179..000000000000 --- a/web/src/test/java/com/navercorp/pinpoint/web/vo/stat/chart/application/ApplicationDirectBufferChartGroupTest.java +++ /dev/null @@ -1,131 +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.web.vo.stat.chart.application; - -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinLongFieldBo; -import com.navercorp.pinpoint.common.server.util.time.Range; -import com.navercorp.pinpoint.common.server.util.timewindow.TimeWindow; -import com.navercorp.pinpoint.web.vo.chart.Chart; -import com.navercorp.pinpoint.web.vo.stat.AggreJoinDirectBufferBo; -import com.navercorp.pinpoint.web.vo.stat.chart.ChartGroupBuilder; -import com.navercorp.pinpoint.web.vo.stat.chart.StatChartGroup; -import org.junit.jupiter.api.Test; - -import java.util.List; -import java.util.Map; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * @author Roy Kim - */ -public class ApplicationDirectBufferChartGroupTest { - - @Test - public void createApplicationDirectBufferChartGroupTest() { - long time = 1495418083250L; - Range range = Range.between(time - 240000, time); - TimeWindow timeWindow = new TimeWindow(range); - - List aggreDirectBufferList = List.of( - new AggreJoinDirectBufferBo("testApp", 11, 60, "agent1_1", 20, "agent1_2", 11, 60, "agent1_1", 20, "agent1_2", 11, 60, "agent1_1", 20, "agent1_2", 11, 60, "agent1_1", 20, "agent1_2", time), - new AggreJoinDirectBufferBo("testApp", 22, 52, "agent2_1", 10, "agent2_2", 22, 52, "agent2_1", 10, "agent2_2", 22, 52, "agent2_1", 10, "agent2_2", 22, 52, "agent2_1", 10, "agent2_2", time - 60000), - new AggreJoinDirectBufferBo("testApp", 33, 39, "agent3_1", 9, "agent3_2", 33, 39, "agent3_1", 9, "agent3_2", 33, 39, "agent3_1", 9, "agent3_2", 33, 39, "agent3_1", 9, "agent3_2", time - 120000), - new AggreJoinDirectBufferBo("testApp", 44, 42, "agent4_1", 25, "agent4_2", 44, 42, "agent4_1", 25, "agent4_2", 44, 42, "agent4_1", 25, "agent4_2", 44, 42, "agent4_1", 25, "agent4_2", time - 180000), - new AggreJoinDirectBufferBo("testApp", 55, 55, "agent5_1", 54, "agent5_2", 55, 55, "agent5_1", 54, "agent5_2", 55, 55, "agent5_1", 54, "agent5_2", 55, 55, "agent5_1", 54, "agent5_2", time - 240000) - ); - - - ChartGroupBuilder> builder = ApplicationDirectBufferChart.newChartBuilder(); - StatChartGroup> group = builder.build(timeWindow, aggreDirectBufferList); - Map>> charts = group.getCharts(); - assertThat(charts).hasSize(4); - - Chart> directCountChart = charts.get(ApplicationDirectBufferChart.DirectBufferChartType.DIRECT_COUNT); - List> directCountPoints = directCountChart.getPoints(); - assertThat(directCountPoints).hasSize(5); - int index = directCountPoints.size(); - for (ApplicationStatPoint point : directCountPoints) { - testDirectCount(point, aggreDirectBufferList.get(--index)); - } - - Chart> directMemoryUsedChart = charts.get(ApplicationDirectBufferChart.DirectBufferChartType.DIRECT_MEMORY_USED); - List> directMemoryUsedPoints = directMemoryUsedChart.getPoints(); - assertThat(directMemoryUsedPoints).hasSize(5); - index = directMemoryUsedPoints.size(); - for (ApplicationStatPoint point : directMemoryUsedPoints) { - testDirectMemoryUsed(point, aggreDirectBufferList.get(--index)); - } - - Chart> mappedCountChart = charts.get(ApplicationDirectBufferChart.DirectBufferChartType.MAPPED_COUNT); - List> mappeedCountPoints = mappedCountChart.getPoints(); - assertThat(mappeedCountPoints).hasSize(5); - index = mappeedCountPoints.size(); - for (ApplicationStatPoint point : mappeedCountPoints) { - testMappedCount(point, aggreDirectBufferList.get(--index)); - } - - Chart> mappedMemoryUsedChart = charts.get(ApplicationDirectBufferChart.DirectBufferChartType.MAPPED_MEMORY_USED); - List> mappedMemoryUsedPoints = mappedMemoryUsedChart.getPoints(); - assertThat(mappedMemoryUsedPoints).hasSize(5); - index = mappedMemoryUsedPoints.size(); - for (ApplicationStatPoint point : mappedMemoryUsedPoints) { - testMappedMemoryUsed(point, aggreDirectBufferList.get(--index)); - } - } - - private void testDirectCount(ApplicationStatPoint directBufferPoint, AggreJoinDirectBufferBo aggreJoinDirectBufferBo) { - final JoinLongFieldBo directCountJoinValue = aggreJoinDirectBufferBo.getDirectCountJoinValue(); - assertEquals(directBufferPoint.getXVal(), aggreJoinDirectBufferBo.getTimestamp()); - assertEquals(directBufferPoint.getYValForAvg(), directCountJoinValue.getAvg(), 0); - assertEquals(directBufferPoint.getYValForMin(), directCountJoinValue.getMin(), 0); - assertEquals(directBufferPoint.getYValForMax(), directCountJoinValue.getMax(), 0); - assertEquals(directBufferPoint.getAgentIdForMin(), directCountJoinValue.getMinAgentId()); - assertEquals(directBufferPoint.getAgentIdForMax(), directCountJoinValue.getMaxAgentId()); - } - - private void testDirectMemoryUsed(ApplicationStatPoint directBufferPoint, AggreJoinDirectBufferBo aggreJoinDirectBufferBo) { - final JoinLongFieldBo directMemoryUsedJoinValue = aggreJoinDirectBufferBo.getDirectMemoryUsedJoinValue(); - assertEquals(directBufferPoint.getXVal(), aggreJoinDirectBufferBo.getTimestamp()); - assertEquals(directBufferPoint.getYValForAvg(), directMemoryUsedJoinValue.getAvg(), 0); - assertEquals(directBufferPoint.getYValForMin(), directMemoryUsedJoinValue.getMin(), 0); - assertEquals(directBufferPoint.getYValForMax(), directMemoryUsedJoinValue.getMax(), 0); - assertEquals(directBufferPoint.getAgentIdForMin(), directMemoryUsedJoinValue.getMinAgentId()); - assertEquals(directBufferPoint.getAgentIdForMax(), directMemoryUsedJoinValue.getMaxAgentId()); - } - - private void testMappedCount(ApplicationStatPoint directBufferPoint, AggreJoinDirectBufferBo aggreJoinDirectBufferBo) { - final JoinLongFieldBo mappedCountJoinValue = aggreJoinDirectBufferBo.getMappedCountJoinValue(); - assertEquals(directBufferPoint.getXVal(), aggreJoinDirectBufferBo.getTimestamp()); - assertEquals(directBufferPoint.getYValForAvg(), mappedCountJoinValue.getAvg(), 0); - assertEquals(directBufferPoint.getYValForMin(), mappedCountJoinValue.getMin(), 0); - assertEquals(directBufferPoint.getYValForMax(), mappedCountJoinValue.getMax(), 0); - assertEquals(directBufferPoint.getAgentIdForMin(), mappedCountJoinValue.getMinAgentId()); - assertEquals(directBufferPoint.getAgentIdForMax(), mappedCountJoinValue.getMaxAgentId()); - } - - private void testMappedMemoryUsed(ApplicationStatPoint directBufferPoint, AggreJoinDirectBufferBo aggreJoinDirectBufferBo) { - final JoinLongFieldBo mappedMemoryUsedJoinValue = aggreJoinDirectBufferBo.getMappedMemoryUsedJoinValue(); - assertEquals(directBufferPoint.getXVal(), aggreJoinDirectBufferBo.getTimestamp()); - assertEquals(directBufferPoint.getYValForAvg(), mappedMemoryUsedJoinValue.getAvg(), 0); - assertEquals(directBufferPoint.getYValForMin(), mappedMemoryUsedJoinValue.getMin(), 0); - assertEquals(directBufferPoint.getYValForMax(), mappedMemoryUsedJoinValue.getMax(), 0); - assertEquals(directBufferPoint.getAgentIdForMin(), mappedMemoryUsedJoinValue.getMinAgentId()); - assertEquals(directBufferPoint.getAgentIdForMax(), mappedMemoryUsedJoinValue.getMaxAgentId()); - } -} \ No newline at end of file diff --git a/web/src/test/java/com/navercorp/pinpoint/web/vo/stat/chart/application/ApplicationFileDescriptorChartGroupTest.java b/web/src/test/java/com/navercorp/pinpoint/web/vo/stat/chart/application/ApplicationFileDescriptorChartGroupTest.java deleted file mode 100644 index 1b3552af06f4..000000000000 --- a/web/src/test/java/com/navercorp/pinpoint/web/vo/stat/chart/application/ApplicationFileDescriptorChartGroupTest.java +++ /dev/null @@ -1,77 +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.web.vo.stat.chart.application; - -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinLongFieldBo; -import com.navercorp.pinpoint.common.server.util.time.Range; -import com.navercorp.pinpoint.common.server.util.timewindow.TimeWindow; -import com.navercorp.pinpoint.web.vo.chart.Chart; -import com.navercorp.pinpoint.web.vo.stat.AggreJoinFileDescriptorBo; -import com.navercorp.pinpoint.web.vo.stat.chart.ChartGroupBuilder; -import com.navercorp.pinpoint.web.vo.stat.chart.StatChartGroup; -import org.junit.jupiter.api.Test; - -import java.util.List; -import java.util.Map; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * @author Roy Kim - */ -public class ApplicationFileDescriptorChartGroupTest { - - @Test - public void createApplicationFileDescriptorChartGroupTest() { - long time = 1495418083250L; - Range range = Range.between(time - 240000, time); - TimeWindow timeWindow = new TimeWindow(range); - - List aggreFileDescriptorList = List.of( - new AggreJoinFileDescriptorBo("testApp", 11, 60, "agent1_1", 20, "agent1_2", time), - new AggreJoinFileDescriptorBo("testApp", 22, 52, "agent2_1", 10, "agent2_2", time - 60000), - new AggreJoinFileDescriptorBo("testApp", 33, 39, "agent3_1", 9, "agent3_2", time - 120000), - new AggreJoinFileDescriptorBo("testApp", 44, 42, "agent4_1", 25, "agent4_2", time - 180000), - new AggreJoinFileDescriptorBo("testApp", 55, 55, "agent5_1", 54, "agent5_2", time - 240000) - ); - - ChartGroupBuilder> builder = ApplicationFileDescriptorChart.newChartBuilder(); - StatChartGroup> applicationFileDescriptorChartGroup = builder.build(timeWindow, aggreFileDescriptorList); - Map>> charts = applicationFileDescriptorChartGroup.getCharts(); - assertThat(charts).hasSize(1); - - Chart> fileDescriptorChart = charts.get(ApplicationFileDescriptorChart.FileDescriptorChartType.OPEN_FILE_DESCRIPTOR_COUNT); - List> fileDescriptorPoints = fileDescriptorChart.getPoints(); - assertThat(fileDescriptorPoints).hasSize(5); - int index = fileDescriptorPoints.size(); - - for (ApplicationStatPoint point : fileDescriptorPoints) { - testOpenFileDescriptor(point, aggreFileDescriptorList.get(--index)); - } - } - - private void testOpenFileDescriptor(ApplicationStatPoint fileDescriptorPoint, AggreJoinFileDescriptorBo aggreJoinFileDescriptorBo) { - assertEquals(fileDescriptorPoint.getXVal(), aggreJoinFileDescriptorBo.getTimestamp()); - final JoinLongFieldBo openFdCountJoinValue = aggreJoinFileDescriptorBo.getOpenFdCountJoinValue(); - assertEquals(fileDescriptorPoint.getYValForAvg(), openFdCountJoinValue.getAvg(), 0); - assertEquals(fileDescriptorPoint.getYValForMin(), openFdCountJoinValue.getMin(), 0); - assertEquals(fileDescriptorPoint.getYValForMax(), openFdCountJoinValue.getMax(), 0); - assertEquals(fileDescriptorPoint.getAgentIdForMin(), openFdCountJoinValue.getMinAgentId()); - assertEquals(fileDescriptorPoint.getAgentIdForMax(), openFdCountJoinValue.getMaxAgentId()); - } -} \ No newline at end of file diff --git a/web/src/test/java/com/navercorp/pinpoint/web/vo/stat/chart/application/ApplicationLoadedClassChartGroupTest.java b/web/src/test/java/com/navercorp/pinpoint/web/vo/stat/chart/application/ApplicationLoadedClassChartGroupTest.java deleted file mode 100644 index 13d1c5a0f439..000000000000 --- a/web/src/test/java/com/navercorp/pinpoint/web/vo/stat/chart/application/ApplicationLoadedClassChartGroupTest.java +++ /dev/null @@ -1,91 +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.web.vo.stat.chart.application; - -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinLongFieldBo; -import com.navercorp.pinpoint.common.server.util.time.Range; -import com.navercorp.pinpoint.common.server.util.timewindow.TimeWindow; -import com.navercorp.pinpoint.web.vo.chart.Chart; -import com.navercorp.pinpoint.web.vo.stat.AggreJoinLoadedClassBo; -import com.navercorp.pinpoint.web.vo.stat.chart.ChartGroupBuilder; -import com.navercorp.pinpoint.web.vo.stat.chart.StatChartGroup; -import org.junit.jupiter.api.Test; - -import java.util.List; -import java.util.Map; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.jupiter.api.Assertions.assertEquals; - -public class ApplicationLoadedClassChartGroupTest { - @Test - public void createApplicationLoadedClassChartGroupTest() { - long time = 1495418083250L; - Range range = Range.between(time - 240000, time); - TimeWindow timeWindow = new TimeWindow(range); - List aggreJoinLoadedClassBoList = List.of( - new AggreJoinLoadedClassBo("testApp", 11, 20, "agent1_1", 60, "agent1_2", 11, 20, "agent1_1", 60, "agent1_2", time), - new AggreJoinLoadedClassBo("testApp", 22, 10, "agent2_1", 52, "agent2_2", 22, 10, "agent2_1", 52, "agent2_2", time - 60000), - new AggreJoinLoadedClassBo("testApp", 33, 9, "agent3_1", 39, "agent3_2", 33, 9, "agent3_1", 39, "agent3_2", time - 120000), - new AggreJoinLoadedClassBo("testApp", 44, 25, "agent4_1", 42, "agent4_2", 44, 25, "agent4_1", 42, "agent4_2", time - 180000), - new AggreJoinLoadedClassBo("testApp", 55, 54, "agent5_1", 55, "agent5_2", 55, 54, "agent5_1", 55, "agent5_2", time - 240000) - ); - - ChartGroupBuilder> builder = ApplicationLoadedClassChart.newChartBuilder(); - StatChartGroup> statChartGroup = builder.build(timeWindow, aggreJoinLoadedClassBoList); - Map>> charts = statChartGroup.getCharts(); - assertThat(charts).hasSize(2); - - Chart> loadedClassChart = charts.get(ApplicationLoadedClassChart.LoadedClassChartType.LOADED_CLASS_COUNT); - List> loadedClassChartPoints = loadedClassChart.getPoints(); - assertThat(loadedClassChartPoints).hasSize(5); - int index = loadedClassChartPoints.size(); - - for (ApplicationStatPoint point : loadedClassChartPoints) { - testLoadedCLass(point, aggreJoinLoadedClassBoList.get(--index)); - } - - Chart> unloadedClassChart = charts.get(ApplicationLoadedClassChart.LoadedClassChartType.UNLOADED_CLASS_COUNT); - List> unloadedClassChartPoints = unloadedClassChart.getPoints(); - assertThat(unloadedClassChartPoints).hasSize(5); - - index = unloadedClassChartPoints.size(); - for (ApplicationStatPoint point : unloadedClassChartPoints) { - testUnloadedCLass(point, aggreJoinLoadedClassBoList.get(--index)); - } - } - - private void testLoadedCLass(ApplicationStatPoint point, AggreJoinLoadedClassBo loadedClassBo) { - final JoinLongFieldBo loadedClass = loadedClassBo.getLoadedClassJoinValue(); - assertEquals(point.getXVal(), loadedClassBo.getTimestamp()); - assertEquals(point.getYValForAvg(), loadedClass.getAvg(), 0); - assertEquals(point.getYValForMin(), loadedClass.getMin(), 0); - assertEquals(point.getYValForMax(), loadedClass.getMax(), 0); - assertEquals(point.getAgentIdForMin(), loadedClass.getMinAgentId()); - assertEquals(point.getAgentIdForMax(), loadedClass.getMaxAgentId()); - } - - private void testUnloadedCLass(ApplicationStatPoint point, AggreJoinLoadedClassBo loadedClassBo) { - final JoinLongFieldBo unloadedClass = loadedClassBo.getUnloadedClassJoinValue(); - assertEquals(point.getXVal(), loadedClassBo.getTimestamp()); - assertEquals(point.getYValForAvg(), unloadedClass.getAvg(), 0); - assertEquals(point.getYValForMin(), unloadedClass.getMin(), 0); - assertEquals(point.getYValForMax(), unloadedClass.getMax(), 0); - assertEquals(point.getAgentIdForMin(), unloadedClass.getMinAgentId()); - assertEquals(point.getAgentIdForMax(), unloadedClass.getMaxAgentId()); - } -} diff --git a/web/src/test/java/com/navercorp/pinpoint/web/vo/stat/chart/application/ApplicationMemoryChartGroupTest.java b/web/src/test/java/com/navercorp/pinpoint/web/vo/stat/chart/application/ApplicationMemoryChartGroupTest.java deleted file mode 100644 index 9a31caac4e06..000000000000 --- a/web/src/test/java/com/navercorp/pinpoint/web/vo/stat/chart/application/ApplicationMemoryChartGroupTest.java +++ /dev/null @@ -1,82 +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.web.vo.stat.chart.application; - -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinLongFieldBo; -import com.navercorp.pinpoint.common.server.util.time.Range; -import com.navercorp.pinpoint.common.server.util.timewindow.TimeWindow; -import com.navercorp.pinpoint.web.vo.chart.Chart; -import com.navercorp.pinpoint.web.vo.stat.AggreJoinMemoryBo; -import com.navercorp.pinpoint.web.vo.stat.chart.ChartGroupBuilder; -import com.navercorp.pinpoint.web.vo.stat.chart.StatChartGroup; -import org.junit.jupiter.api.Test; - -import java.util.List; -import java.util.Map; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * @author minwoo.jung - */ -public class ApplicationMemoryChartGroupTest { - - @Test - public void createApplicationMemoryChartGroupTest() { - long time = 1495418083250L; - Range range = Range.between(time - 240000, time); - TimeWindow timeWindow = new TimeWindow(range); - List aggreJoinMemoryList = List.of( - new AggreJoinMemoryBo("testApp", time, 3000, 1000, 5000, "agent1_1", "agent1_2", 300, 100, 500, "agent1_3", "agent1_4"), - new AggreJoinMemoryBo("testApp", time - 60000, 2000, 1200, 5000, "agent2_1", "agent2_2", 200, 100, 600, "agent2_3", "agent2_4"), - new AggreJoinMemoryBo("testApp", time - 120000, 1000, 1300, 7000, "agent3_1", "agent3_2", 400, 200, 700, "agent3_3", "agent3_4"), - new AggreJoinMemoryBo("testApp", time - 180000, 5000, 1400, 8000, "agent4_1", "agent4_2", 500, 300, 800, "agent4_3", "agent4_4"), - new AggreJoinMemoryBo("testApp", time - 240000, 4000, 1500, 9000, "agent5_1", "agent5_2", 400, 400, 900, "agent5_3", "agent5_4") - ); - - ChartGroupBuilder> builder = ApplicationMemoryChart.newChartBuilder(); - StatChartGroup> statChartGroup = builder.build(timeWindow, aggreJoinMemoryList); - Map>> charts = statChartGroup.getCharts(); - - Chart> heapChart = charts.get(ApplicationMemoryChart.MemoryChartType.MEMORY_HEAP); - List> heapPoints = heapChart.getPoints(); - assertThat(heapPoints).hasSize(5); - int index = heapPoints.size(); - for (ApplicationStatPoint point : heapPoints) { - testHeap(point, aggreJoinMemoryList.get(--index)); - } - - Chart> nonHeapChart = charts.get(ApplicationMemoryChart.MemoryChartType.MEMORY_NON_HEAP); - List> nonHeapPoints = heapChart.getPoints(); - assertThat(nonHeapPoints).hasSize(5); - index = nonHeapPoints.size(); - for (ApplicationStatPoint point : nonHeapPoints) { - testHeap(point, aggreJoinMemoryList.get(--index)); - } - } - - private void testHeap(ApplicationStatPoint memoryPoint, AggreJoinMemoryBo aggreJoinMemoryBo) { - final JoinLongFieldBo heapUsedJoinValue = aggreJoinMemoryBo.getHeapUsedJoinValue(); - assertEquals(memoryPoint.getYValForAvg(), heapUsedJoinValue.getAvg(), 0); - assertEquals(memoryPoint.getYValForMin(), heapUsedJoinValue.getMin(), 0); - assertEquals(memoryPoint.getYValForMax(), heapUsedJoinValue.getMax(), 0); - assertEquals(memoryPoint.getAgentIdForMin(), heapUsedJoinValue.getMinAgentId()); - assertEquals(memoryPoint.getAgentIdForMax(), heapUsedJoinValue.getMaxAgentId()); - } - -} \ No newline at end of file diff --git a/web/src/test/java/com/navercorp/pinpoint/web/vo/stat/chart/application/ApplicationResponseTimeChartGroupTest.java b/web/src/test/java/com/navercorp/pinpoint/web/vo/stat/chart/application/ApplicationResponseTimeChartGroupTest.java deleted file mode 100644 index c6c2279bd583..000000000000 --- a/web/src/test/java/com/navercorp/pinpoint/web/vo/stat/chart/application/ApplicationResponseTimeChartGroupTest.java +++ /dev/null @@ -1,78 +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.web.vo.stat.chart.application; - -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinLongFieldBo; -import com.navercorp.pinpoint.common.server.util.time.Range; -import com.navercorp.pinpoint.common.server.util.timewindow.TimeWindow; -import com.navercorp.pinpoint.web.vo.chart.Chart; -import com.navercorp.pinpoint.web.vo.stat.AggreJoinResponseTimeBo; -import com.navercorp.pinpoint.web.vo.stat.chart.ChartGroupBuilder; -import com.navercorp.pinpoint.web.vo.stat.chart.StatChartGroup; -import org.junit.jupiter.api.Test; - -import java.util.List; -import java.util.Map; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * @author minwoo.jung - */ -public class ApplicationResponseTimeChartGroupTest { - - @Test - public void createApplicationResponseTimeChartGroupTest() { - long time = 1495418083250L; - Range range = Range.between(time - 240000, time); - TimeWindow timeWindow = new TimeWindow(range); - - final String id = "test_app"; - List aggreJoinResponseTimeBoList = List.of( - new AggreJoinResponseTimeBo(id, time, 3000, 2, "app_1_1", 6000, "app_1_1"), - new AggreJoinResponseTimeBo(id, time - 60000, 4000, 200, "app_2_1", 9000, "app_2_1"), - new AggreJoinResponseTimeBo(id, time - 120000, 2000, 20, "app_3_1", 7000, "app_3_1"), - new AggreJoinResponseTimeBo(id, time - 180000, 5000, 20, "app_4_1", 8000, "app_4_1"), - new AggreJoinResponseTimeBo(id, time - 240000, 1000, 10, "app_5_1", 6600, "app_5_1") - ); - - ChartGroupBuilder> builder = ApplicationResponseTimeChart.newChartBuilder(); - StatChartGroup> statChartGroup = builder.build(timeWindow, aggreJoinResponseTimeBoList); - Map>> charts = statChartGroup.getCharts(); - - Chart> responseTimeChart = charts.get(ApplicationResponseTimeChart.ResponseTimeChartType.RESPONSE_TIME); - List> responseTimePointList = responseTimeChart.getPoints(); - assertThat(responseTimePointList).hasSize(5); - int index = responseTimePointList.size(); - - for (ApplicationStatPoint point : responseTimePointList) { - testResponseTimeCount(point, aggreJoinResponseTimeBoList.get(--index)); - } - } - - private void testResponseTimeCount(ApplicationStatPoint responseTimePoint, AggreJoinResponseTimeBo aggreJoinResponseTimeBo) { - final JoinLongFieldBo responseTimeJoinValue = aggreJoinResponseTimeBo.getResponseTimeJoinValue(); - assertEquals(responseTimePoint.getYValForAvg(), responseTimeJoinValue.getAvg(), 0); - assertEquals(responseTimePoint.getYValForMin(), responseTimeJoinValue.getMin(), 0); - assertEquals(responseTimePoint.getYValForMax(), responseTimeJoinValue.getMax(), 0); - assertEquals(responseTimePoint.getAgentIdForMax(), responseTimeJoinValue.getMaxAgentId()); - assertEquals(responseTimePoint.getAgentIdForMin(), responseTimeJoinValue.getMinAgentId()); - } - - -} \ No newline at end of file diff --git a/web/src/test/java/com/navercorp/pinpoint/web/vo/stat/chart/application/ApplicationTotalThreadCountChartGroupTest.java b/web/src/test/java/com/navercorp/pinpoint/web/vo/stat/chart/application/ApplicationTotalThreadCountChartGroupTest.java deleted file mode 100644 index 8cfe94a322f8..000000000000 --- a/web/src/test/java/com/navercorp/pinpoint/web/vo/stat/chart/application/ApplicationTotalThreadCountChartGroupTest.java +++ /dev/null @@ -1,72 +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.web.vo.stat.chart.application; - -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinLongFieldBo; -import com.navercorp.pinpoint.common.server.util.time.Range; -import com.navercorp.pinpoint.common.server.util.timewindow.TimeWindow; -import com.navercorp.pinpoint.web.vo.chart.Chart; -import com.navercorp.pinpoint.web.vo.stat.AggreJoinTotalThreadCountBo; -import com.navercorp.pinpoint.web.vo.stat.chart.ChartGroupBuilder; -import com.navercorp.pinpoint.web.vo.stat.chart.StatChartGroup; -import org.junit.jupiter.api.Test; - -import java.util.List; -import java.util.Map; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.jupiter.api.Assertions.assertEquals; - -public class ApplicationTotalThreadCountChartGroupTest { - @Test - public void createApplicationTotalThreadCountChartGroupTest() { - long time = 1495418083250L; - Range range = Range.between(time - 240000, time); - TimeWindow timeWindow = new TimeWindow(range); - List aggreJoinTotalThreadCountBoList = List.of( - new AggreJoinTotalThreadCountBo("testApp", time, 11, 20, "agent1_1", 60, "agent1_2"), - new AggreJoinTotalThreadCountBo("testApp", time - 60000, 22, 10, "agent2_1", 52, "agent2_2"), - new AggreJoinTotalThreadCountBo("testApp", time - 120000, 33, 9, "agent3_1", 39, "agent3_2"), - new AggreJoinTotalThreadCountBo("testApp", time - 180000, 44, 25, "agent4_1", 42, "agent4_2"), - new AggreJoinTotalThreadCountBo("testApp", time - 240000, 55, 54, "agent5_1", 55, "agent5_2") - ); - - ChartGroupBuilder> builder = ApplicationTotalThreadCountChart.newChartBuilder(); - StatChartGroup> group = builder.build(timeWindow, aggreJoinTotalThreadCountBoList); - Map>> charts = group.getCharts(); - assertThat(charts).hasSize(1); - - Chart> totalThreadCountChart = charts.get(ApplicationTotalThreadCountChart.TotalThreadCountChartType.TOTAL_THREAD_COUNT); - List> totalThreadCountChartPoints = totalThreadCountChart.getPoints(); - assertThat(totalThreadCountChartPoints).hasSize(5); - int index = totalThreadCountChartPoints.size(); - - for (ApplicationStatPoint point : totalThreadCountChartPoints) { - testTotalThreadCount(point, aggreJoinTotalThreadCountBoList.get(--index)); - } - } - - private void testTotalThreadCount(ApplicationStatPoint point, AggreJoinTotalThreadCountBo totalThreadCountBo) { - assertEquals(point.getXVal(), totalThreadCountBo.getTimestamp()); - final JoinLongFieldBo totalThreadCountJoinValue = totalThreadCountBo.getTotalThreadCountJoinValue(); - assertEquals(point.getYValForAvg(), totalThreadCountJoinValue.getAvg(), 0); - assertEquals(point.getYValForMin(), totalThreadCountJoinValue.getMin(), 0); - assertEquals(point.getYValForMax(), totalThreadCountJoinValue.getMax(), 0); - assertEquals(point.getAgentIdForMin(), totalThreadCountJoinValue.getMinAgentId()); - assertEquals(point.getAgentIdForMax(), totalThreadCountJoinValue.getMaxAgentId()); - } -} diff --git a/web/src/test/java/com/navercorp/pinpoint/web/vo/stat/chart/application/ApplicationTransactionChartGroupTest.java b/web/src/test/java/com/navercorp/pinpoint/web/vo/stat/chart/application/ApplicationTransactionChartGroupTest.java deleted file mode 100644 index 7356c5cd8a46..000000000000 --- a/web/src/test/java/com/navercorp/pinpoint/web/vo/stat/chart/application/ApplicationTransactionChartGroupTest.java +++ /dev/null @@ -1,76 +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.web.vo.stat.chart.application; - -import com.navercorp.pinpoint.common.server.bo.stat.join.JoinLongFieldBo; -import com.navercorp.pinpoint.common.server.util.time.Range; -import com.navercorp.pinpoint.common.server.util.timewindow.TimeWindow; -import com.navercorp.pinpoint.web.vo.chart.Chart; -import com.navercorp.pinpoint.web.vo.stat.AggreJoinTransactionBo; -import com.navercorp.pinpoint.web.vo.stat.chart.ChartGroupBuilder; -import com.navercorp.pinpoint.web.vo.stat.chart.StatChartGroup; -import org.junit.jupiter.api.Test; - -import java.util.List; -import java.util.Map; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * @author minwoo.jung - */ -public class ApplicationTransactionChartGroupTest { - - @Test - public void createApplicationTransactionChartGroupTest() { - long time = 1495418083250L; - Range range = Range.between(time - 240000, time); - TimeWindow timeWindow = new TimeWindow(range); - - final String id = "test_app"; - List aggreJoinTransactionBoList = List.of( - new AggreJoinTransactionBo(id, 5000, 150, 10, "app_1_1", 230, "app_1_2", time), - new AggreJoinTransactionBo(id, 5000, 110, 22, "app_2_1", 330, "app_2_2", time - 60000), - new AggreJoinTransactionBo(id, 5000, 120, 24, "app_3_1", 540, "app_3_2", time - 120000), - new AggreJoinTransactionBo(id, 5000, 130, 25, "app_4_1", 560, "app_4_2", time - 180000), - new AggreJoinTransactionBo(id, 5000, 140, 12, "app_5_1", 260, "app_5_2", time - 240000) - ); - - ChartGroupBuilder> builder = ApplicationTransactionChart.newChartBuilder(); - StatChartGroup> statChartGroup = builder.build(timeWindow, aggreJoinTransactionBoList); - Map>> charts = statChartGroup.getCharts(); - - Chart> tranCountChart = charts.get(ApplicationTransactionChart.TransactionChartType.TRANSACTION_COUNT); - List> tranCountPointList = tranCountChart.getPoints(); - assertThat(tranCountPointList).hasSize(5); - int index = tranCountPointList.size(); - for (ApplicationStatPoint point : tranCountPointList) { - testTranCount(point, aggreJoinTransactionBoList.get(--index)); - } - - } - - private void testTranCount(ApplicationStatPoint transactionPoint, AggreJoinTransactionBo aggreJoinTransactionBo) { - final JoinLongFieldBo totalCountJoinValue = aggreJoinTransactionBo.getTotalCountJoinValue(); - assertEquals(transactionPoint.getYValForAvg(), totalCountJoinValue.getAvg(), 0); - assertEquals(transactionPoint.getYValForMin(), totalCountJoinValue.getMin(), 0); - assertEquals(transactionPoint.getYValForMax(), totalCountJoinValue.getMax(), 0); - assertEquals(transactionPoint.getAgentIdForMin(), totalCountJoinValue.getMinAgentId()); - assertEquals(transactionPoint.getAgentIdForMax(), totalCountJoinValue.getMaxAgentId()); - } -} \ No newline at end of file