From 6dd6e9c4f86531f2d5312f5d0c7a10bef82f25b3 Mon Sep 17 00:00:00 2001 From: peng-yongsheng <8082209@qq.com> Date: Wed, 15 Nov 2017 22:23:03 +0800 Subject: [PATCH] delete the collector 3.2.3 backup files. --- .../apm-collector-agentjvm/pom.xml | 55 --- .../handler/JVMMetricsServiceHandler.java | 167 ------- .../cpu/CpuMetricPersistenceWorker.java | 89 ---- .../worker/cpu/dao/CpuMetricEsDAO.java | 57 --- .../worker/cpu/dao/CpuMetricH2DAO.java | 61 --- .../worker/cpu/dao/ICpuMetricDAO.java | 25 -- .../cpu/define/CpuMetricEsTableDefine.java | 43 -- .../cpu/define/CpuMetricH2TableDefine.java | 40 -- .../worker/gc/GCMetricPersistenceWorker.java | 89 ---- .../agentjvm/worker/gc/dao/GCMetricEsDAO.java | 54 --- .../agentjvm/worker/gc/dao/GCMetricH2DAO.java | 58 --- .../agentjvm/worker/gc/dao/IGCMetricDAO.java | 25 -- .../gc/define/GCMetricEsTableDefine.java | 45 -- .../gc/define/GCMetricH2TableDefine.java | 42 -- .../InstHeartBeatPersistenceWorker.java | 89 ---- .../heartbeat/dao/IInstanceHeartBeatDAO.java | 25 -- .../heartbeat/dao/InstanceHeartBeatEsDAO.java | 66 --- .../heartbeat/dao/InstanceHeartBeatH2DAO.java | 79 ---- .../define/InstanceHeartBeatDataDefine.java | 116 ----- .../memory/MemoryMetricPersistenceWorker.java | 89 ---- .../worker/memory/dao/IMemoryMetricDAO.java | 25 -- .../worker/memory/dao/MemoryMetricEsDAO.java | 56 --- .../worker/memory/dao/MemoryMetricH2DAO.java | 60 --- .../define/MemoryMetricEsTableDefine.java | 47 -- .../define/MemoryMetricH2TableDefine.java | 44 -- .../MemoryPoolMetricPersistenceWorker.java | 89 ---- .../memorypool/dao/IMemoryPoolMetricDAO.java | 25 -- .../memorypool/dao/MemoryPoolMetricEsDAO.java | 56 --- .../memorypool/dao/MemoryPoolMetricH2DAO.java | 60 --- .../define/MemoryPoolMetricEsTableDefine.java | 47 -- .../define/MemoryPoolMetricH2TableDefine.java | 44 -- .../resources/META-INF/defines/es_dao.define | 5 - .../resources/META-INF/defines/h2_dao.define | 5 - .../defines/local_worker_provider.define | 5 - .../resources/META-INF/defines/storage.define | 11 - .../JVMMetricsServiceHandlerTestCase.java | 141 ------ .../apm-collector-agentregister/pom.xml | 60 --- .../application/ApplicationIDService.java | 53 --- .../ApplicationRegisterServiceHandler.java | 58 --- .../InstanceDiscoveryServiceHandler.java | 77 ---- .../ServiceNameDiscoveryServiceHandler.java | 63 --- .../instance/InstanceIDService.java | 64 --- .../ApplicationRegisterServletHandler.java | 70 --- .../InstanceDiscoveryServletHandler.java | 73 --- .../ServiceNameDiscoveryServiceHandler.java | 77 ---- .../servicename/ServiceNameService.java | 55 --- .../agentregister/worker/IdAutoIncrement.java | 42 -- .../application/ApplicationEsTableDefine.java | 42 -- .../application/ApplicationH2TableDefine.java | 40 -- .../ApplicationRegisterRemoteWorker.java | 83 ---- .../ApplicationRegisterSerialWorker.java | 115 ----- .../application/dao/ApplicationEsDAO.java | 57 --- .../application/dao/ApplicationH2DAO.java | 65 --- .../application/dao/IApplicationDAO.java | 32 -- .../instance/InstanceEsTableDefine.java | 46 -- .../instance/InstanceH2TableDefine.java | 43 -- .../InstanceRegisterRemoteWorker.java | 83 ---- .../InstanceRegisterSerialWorker.java | 117 ----- .../worker/instance/dao/IInstanceDAO.java | 36 -- .../worker/instance/dao/InstanceEsDAO.java | 103 ----- .../worker/instance/dao/InstanceH2DAO.java | 97 ---- .../servicename/ServiceNameEsTableDefine.java | 43 -- .../servicename/ServiceNameH2TableDefine.java | 40 -- .../ServiceNameRegisterRemoteWorker.java | 83 ---- .../ServiceNameRegisterSerialWorker.java | 115 ----- .../servicename/dao/IServiceNameDAO.java | 32 -- .../servicename/dao/ServiceNameEsDAO.java | 58 --- .../servicename/dao/ServiceNameH2DAO.java | 66 --- .../resources/META-INF/defines/es_dao.define | 3 - .../resources/META-INF/defines/h2_dao.define | 3 - .../defines/local_worker_provider.define | 3 - .../resources/META-INF/defines/storage.define | 8 - ...icationRegisterServiceHandlerTestCase.java | 46 -- .../apm-collector-agentserver/pom.xml | 60 --- .../agentserver/AgentServerModuleContext.java | 31 -- .../agentserver/AgentServerModuleDefine.java | 37 -- .../AgentServerModuleException.java | 35 -- .../AgentServerModuleGroupDefine.java | 53 --- .../AgentServerModuleInstaller.java | 41 -- .../jetty/AgentServerJettyConfig.java | 28 -- .../jetty/AgentServerJettyConfigParser.java | 54 --- .../jetty/AgentServerJettyDataListener.java | 41 -- .../jetty/AgentServerJettyModuleDefine.java | 77 ---- .../AgentServerJettyModuleRegistration.java | 31 -- .../handler/AgentStreamGRPCServerHandler.java | 51 --- .../AgentStreamJettyServerHandler.java | 51 --- .../jetty/handler/UIJettyServerHandler.java | 51 --- .../resources/META-INF/defines/group.define | 1 - .../resources/META-INF/defines/module.define | 1 - .../apm-collector-agentstream/pom.xml | 70 --- .../agentstream/AgentStreamModuleContext.java | 31 -- .../agentstream/AgentStreamModuleDefine.java | 41 -- .../AgentStreamModuleException.java | 34 -- .../AgentStreamModuleGroupConfigParser.java | 80 ---- .../AgentStreamModuleGroupDefine.java | 53 --- .../AgentStreamModuleInstaller.java | 51 --- .../agentstream/config/BufferFileConfig.java | 27 -- .../grpc/AgentStreamGRPCConfig.java | 27 -- .../grpc/AgentStreamGRPCConfigParser.java | 48 -- .../grpc/AgentStreamGRPCDataListener.java | 43 -- .../grpc/AgentStreamGRPCModuleDefine.java | 77 ---- .../AgentStreamGRPCModuleRegistration.java | 31 -- .../handler/TraceSegmentServiceHandler.java | 55 --- .../jetty/AgentStreamJettyConfig.java | 28 -- .../jetty/AgentStreamJettyConfigParser.java | 54 --- .../jetty/AgentStreamJettyDataListener.java | 43 -- .../jetty/AgentStreamJettyModuleDefine.java | 75 ---- .../AgentStreamJettyModuleRegistration.java | 31 -- .../handler/TraceSegmentServletHandler.java | 73 --- .../reader/KeyWithStringValueJsonReader.java | 54 --- .../jetty/handler/reader/LogJsonReader.java | 55 --- .../handler/reader/ReferenceJsonReader.java | 92 ---- .../handler/reader/SegmentJsonReader.java | 87 ---- .../jetty/handler/reader/SpanJsonReader.java | 117 ----- .../handler/reader/StreamJsonReader.java | 29 -- .../jetty/handler/reader/TraceSegment.java | 47 -- .../reader/TraceSegmentJsonReader.java | 65 --- .../handler/reader/UniqueIdJsonReader.java | 40 -- .../AgentStreamModuleDefineException.java | 35 -- .../global/GlobalTracePersistenceWorker.java | 89 ---- .../global/GlobalTraceSpanListener.java | 86 ---- .../worker/global/dao/GlobalTraceEsDAO.java | 57 --- .../worker/global/dao/GlobalTraceH2DAO.java | 62 --- .../worker/global/dao/IGlobalTraceDAO.java | 25 -- .../define/GlobalTraceEsTableDefine.java | 43 -- .../define/GlobalTraceH2TableDefine.java | 40 -- .../InstPerformancePersistenceWorker.java | 89 ---- .../InstPerformanceSpanListener.java | 79 ---- .../performance/dao/IInstPerformanceDAO.java | 25 -- .../performance/dao/InstPerformanceEsDAO.java | 79 ---- .../performance/dao/InstPerformanceH2DAO.java | 97 ---- .../define/InstPerformanceEsTableDefine.java | 45 -- .../define/InstPerformanceH2TableDefine.java | 42 -- .../NodeComponentAggregationWorker.java | 84 ---- .../NodeComponentPersistenceWorker.java | 89 ---- .../component/NodeComponentRemoteWorker.java | 78 ---- .../component/NodeComponentSpanListener.java | 113 ----- .../node/component/dao/INodeComponentDAO.java | 25 -- .../component/dao/NodeComponentEsDAO.java | 74 --- .../component/dao/NodeComponentH2DAO.java | 101 ----- .../define/NodeComponentEsTableDefine.java | 45 -- .../define/NodeComponentH2TableDefine.java | 42 -- .../mapping/NodeMappingAggregationWorker.java | 84 ---- .../mapping/NodeMappingPersistenceWorker.java | 89 ---- .../node/mapping/NodeMappingRemoteWorker.java | 78 ---- .../node/mapping/NodeMappingSpanListener.java | 81 ---- .../node/mapping/dao/INodeMappingDAO.java | 25 -- .../node/mapping/dao/NodeMappingEsDAO.java | 71 --- .../node/mapping/dao/NodeMappingH2DAO.java | 96 ---- .../define/NodeMappingEsTableDefine.java | 44 -- .../define/NodeMappingH2TableDefine.java | 41 -- .../NodeReferenceAggregationWorker.java | 84 ---- .../NodeReferencePersistenceWorker.java | 89 ---- .../noderef/NodeReferenceRemoteWorker.java | 78 ---- .../noderef/NodeReferenceSpanListener.java | 136 ------ .../worker/noderef/dao/INodeReferenceDAO.java | 25 -- .../noderef/dao/NodeReferenceEsDAO.java | 89 ---- .../noderef/dao/NodeReferenceH2DAO.java | 113 ----- .../define/NodeReferenceEsTableDefine.java | 50 --- .../define/NodeReferenceH2TableDefine.java | 47 -- .../worker/segment/EntrySpanListener.java | 28 -- .../worker/segment/ExitSpanListener.java | 28 -- .../worker/segment/FirstSpanListener.java | 28 -- .../segment/GlobalTraceIdsListener.java | 28 -- .../worker/segment/LocalSpanListener.java | 28 -- .../worker/segment/RefsListener.java | 28 -- .../worker/segment/SegmentParse.java | 238 ---------- .../worker/segment/SpanListener.java | 26 -- .../worker/segment/buffer/Offset.java | 99 ---- .../worker/segment/buffer/OffsetManager.java | 148 ------ .../segment/buffer/SegmentBufferConfig.java | 28 -- .../segment/buffer/SegmentBufferManager.java | 103 ----- .../segment/buffer/SegmentBufferReader.java | 147 ------ .../cost/SegmentCostPersistenceWorker.java | 89 ---- .../segment/cost/SegmentCostSpanListener.java | 104 ----- .../segment/cost/dao/ISegmentCostDAO.java | 25 -- .../segment/cost/dao/SegmentCostEsDAO.java | 62 --- .../segment/cost/dao/SegmentCostH2DAO.java | 67 --- .../cost/define/SegmentCostEsTableDefine.java | 48 -- .../cost/define/SegmentCostH2TableDefine.java | 45 -- .../origin/SegmentPersistenceWorker.java | 89 ---- .../segment/origin/dao/ISegmentDAO.java | 25 -- .../segment/origin/dao/SegmentEsDAO.java | 55 --- .../segment/origin/dao/SegmentH2DAO.java | 60 --- .../origin/define/SegmentEsTableDefine.java | 41 -- .../origin/define/SegmentH2TableDefine.java | 38 -- .../segment/standardization/IdExchanger.java | 26 -- .../standardization/ReferenceDecorator.java | 190 -------- .../standardization/ReferenceIdExchanger.java | 85 ---- .../standardization/SegmentDecorator.java | 86 ---- .../SegmentStandardizationWorker.java | 98 ---- .../standardization/SpanDecorator.java | 200 --------- .../standardization/SpanIdExchanger.java | 69 --- .../standardization/StandardBuilder.java | 26 -- .../entry/ServiceEntryAggregationWorker.java | 84 ---- .../entry/ServiceEntryPersistenceWorker.java | 89 ---- .../entry/ServiceEntryRemoteWorker.java | 78 ---- .../entry/ServiceEntrySpanListener.java | 92 ---- .../service/entry/dao/IServiceEntryDAO.java | 25 -- .../service/entry/dao/ServiceEntryEsDAO.java | 73 --- .../service/entry/dao/ServiceEntryH2DAO.java | 97 ---- .../define/ServiceEntryEsTableDefine.java | 45 -- .../define/ServiceEntryH2TableDefine.java | 42 -- .../ServiceReferenceAggregationWorker.java | 84 ---- .../ServiceReferencePersistenceWorker.java | 89 ---- .../ServiceReferenceRemoteWorker.java | 78 ---- .../ServiceReferenceSpanListener.java | 149 ------- .../serviceref/dao/IServiceReferenceDAO.java | 25 -- .../serviceref/dao/ServiceReferenceEsDAO.java | 105 ----- .../serviceref/dao/ServiceReferenceH2DAO.java | 129 ------ .../define/ServiceReferenceEsTableDefine.java | 55 --- .../define/ServiceReferenceH2TableDefine.java | 51 --- .../worker/storage/PersistenceTimer.java | 74 --- .../agentstream/worker/util/FileUtils.java | 89 ---- .../resources/META-INF/defines/es_dao.define | 9 - .../resources/META-INF/defines/group.define | 1 - .../resources/META-INF/defines/h2_dao.define | 9 - .../defines/local_worker_provider.define | 22 - .../resources/META-INF/defines/module.define | 2 - .../defines/remote_worker_provider.define | 6 - .../resources/META-INF/defines/storage.define | 26 -- .../agentstream/HttpClientTools.java | 95 ---- .../TraceSegmentServiceHandlerTestCase.java | 136 ------ .../TraceSegmentJsonReaderTestCase.java | 45 -- .../agentstream/mock/JsonFileReader.java | 42 -- .../agentstream/mock/SegmentPost.java | 138 ------ .../mock/grpc/ApplicationRegister.java | 43 -- .../mock/grpc/GrpcSegmentPost.java | 422 ------------------ .../mock/grpc/InstanceRegister.java | 57 --- .../mock/grpc/ServiceRegister.java | 50 --- .../grpc/SingleHasEntryHasExitNoRefSpan.java | 133 ------ .../grpc/SingleHasEntryNoExitHasRefSpan.java | 150 ------- .../grpc/SingleHasEntryNoExitNoRefSpan.java | 120 ----- .../grpc/SingleNoEntryHasExitNoRefSpan.java | 121 ----- .../SegmentBufferWriteWorkerTestCase.java | 95 ---- .../segment/normal/application-register.json | 4 - .../json/segment/normal/dubbox-consumer.json | 71 --- .../json/segment/normal/dubbox-provider.json | 67 --- .../segment/normal/instance-register.json | 5 - .../src/test/resources/log4j2.xml | 34 -- .../src/test/resources/logback.xml | 34 -- .../bin/collector-service.bat | 23 - .../bin/collector-service.sh | 38 -- .../apm-collector-boot/bin/startup.bat | 5 - .../apm-collector-boot/bin/startup.sh | 7 - .../apm-collector-boot/docker/Dockerfile | 28 -- .../apm-collector-boot/docker/application.yml | 33 -- .../docker/collector-service.sh | 13 - .../docker/docker-entrypoint.sh | 37 -- .../apm-collector-boot/docker/log4j2.xml | 34 -- .../apm-collector-boot/pom.xml | 152 ------- .../src/main/assembly/assembly.xml | 60 --- .../src/main/assembly/log4j2.xml | 44 -- .../collector/boot/CollectorBootStartUp.java | 40 -- .../apm/collector/boot/CollectorStarter.java | 101 ----- .../src/main/resources/application.yml | 40 -- .../src/main/resources/log4j2.xml | 35 -- .../apm-collector-cache/pom.xml | 27 -- .../apm/collector/cache/ApplicationCache.java | 78 ---- .../apm/collector/cache/InstanceCache.java | 55 --- .../apm/collector/cache/ServiceIdCache.java | 57 --- .../apm/collector/cache/ServiceNameCache.java | 72 --- .../cache/dao/ApplicationEsCacheDAO.java | 70 --- .../cache/dao/ApplicationH2CacheDAO.java | 71 --- .../cache/dao/IApplicationCacheDAO.java | 28 -- .../cache/dao/IInstanceCacheDAO.java | 26 -- .../cache/dao/IServiceNameCacheDAO.java | 28 -- .../cache/dao/InstanceEsCacheDAO.java | 42 -- .../cache/dao/InstanceH2CacheDAO.java | 54 --- .../cache/dao/ServiceNameEsCacheDAO.java | 68 --- .../cache/dao/ServiceNameH2CacheDAO.java | 73 --- .../resources/META-INF/defines/es_dao.define | 3 - .../resources/META-INF/defines/h2_dao.define | 3 - .../apm-collector-client/pom.xml | 81 ---- .../elasticsearch/ElasticSearchClient.java | 164 ------- .../ElasticSearchClientException.java | 34 -- .../apm/collector/client/grpc/GRPCClient.java | 57 --- .../client/grpc/GRPCClientException.java | 35 -- .../apm/collector/client/h2/H2Client.java | 119 ----- .../client/h2/H2ClientException.java | 35 -- .../collector/client/redis/RedisClient.java | 51 --- .../client/redis/RedisClientException.java | 35 -- .../client/zookeeper/ZookeeperClient.java | 112 ----- .../zookeeper/ZookeeperClientException.java | 34 -- .../client/zookeeper/util/PathUtils.java | 34 -- .../apm-collector-cluster/pom.xml | 45 -- .../cluster/ClusterModuleDefine.java | 80 ---- .../cluster/ClusterModuleGroupDefine.java | 54 --- .../cluster/ClusterModuleInstaller.java | 53 --- .../cluster/ClusterNodeExistException.java | 35 -- .../cluster/redis/ClusterRedisConfig.java | 27 -- .../redis/ClusterRedisConfigParser.java | 41 -- .../redis/ClusterRedisModuleDefine.java | 63 --- .../ClusterRedisModuleRegistrationReader.java | 32 -- .../ClusterStandaloneConfigParser.java | 31 -- .../ClusterStandaloneDataMonitor.java | 89 ---- .../ClusterStandaloneModuleDefine.java | 69 --- ...terStandaloneModuleRegistrationReader.java | 32 -- .../cluster/zookeeper/ClusterZKConfig.java | 27 -- .../zookeeper/ClusterZKConfigParser.java | 46 -- .../zookeeper/ClusterZKDataMonitor.java | 164 ------- .../zookeeper/ClusterZKModuleDefine.java | 68 --- .../ClusterZKModuleRegistrationReader.java | 32 -- .../resources/META-INF/defines/group.define | 1 - .../resources/META-INF/defines/module.define | 3 - .../apm-collector-core/pom.xml | 45 -- .../collector/core/CollectorException.java | 33 -- .../apm/collector/core/client/Client.java | 28 -- .../core/client/ClientException.java | 34 -- .../collector/core/client/DataMonitor.java | 38 -- .../core/cluster/ClusterDataListener.java | 53 --- .../cluster/ClusterDataListenerDefine.java | 26 -- .../core/cluster/ClusterModuleContext.java | 52 --- .../core/cluster/ClusterModuleDiscovery.java | 27 -- .../core/cluster/ClusterModuleException.java | 35 -- .../ClusterModuleRegistrationReader.java | 38 -- .../core/config/ConfigException.java | 35 -- .../collector/core/config/ConfigLoader.java | 27 -- .../core/config/ConfigLoaderException.java | 33 -- .../core/config/ConfigParseException.java | 33 -- .../core/config/GroupConfigParser.java | 30 -- .../collector/core/config/SystemConfig.java | 26 -- .../core/config/SystemConfigParser.java | 36 -- .../framework/CollectorContextHelper.java | 53 --- .../apm/collector/core/framework/Context.java | 34 -- .../core/framework/DataInitializer.java | 33 -- .../collector/core/framework/Decision.java | 25 -- .../apm/collector/core/framework/Define.java | 26 -- .../core/framework/DefineException.java | 35 -- .../core/framework/DefinitionFile.java | 33 -- .../collector/core/framework/Executor.java | 26 -- .../apm/collector/core/framework/Handler.java | 25 -- .../collector/core/framework/Listener.java | 25 -- .../apm/collector/core/framework/Loader.java | 26 -- .../core/framework/PriorityDecision.java | 49 -- .../collector/core/framework/Provider.java | 26 -- .../apm/collector/core/framework/Starter.java | 28 -- .../core/framework/UnexpectedException.java | 29 -- .../core/module/CommonModuleInstaller.java | 55 --- .../apm/collector/core/module/Module.java | 28 -- .../core/module/ModuleConfigLoader.java | 52 --- .../core/module/ModuleConfigParser.java | 29 -- .../collector/core/module/ModuleContext.java | 36 -- .../collector/core/module/ModuleDefine.java | 47 -- .../core/module/ModuleDefineException.java | 34 -- .../core/module/ModuleDefineLoader.java | 53 --- .../core/module/ModuleDefinitionFile.java | 30 -- .../core/module/ModuleException.java | 35 -- .../core/module/ModuleGroupDefine.java | 35 -- .../core/module/ModuleGroupDefineFile.java | 30 -- .../core/module/ModuleGroupDefineLoader.java | 51 --- .../core/module/ModuleInstaller.java | 51 --- .../core/module/ModuleRegistration.java | 55 --- .../core/module/MultipleModuleInstaller.java | 88 ---- .../core/module/SingleModuleInstaller.java | 107 ----- .../core/queue/DaemonThreadFactory.java | 35 -- .../core/queue/EndOfBatchCommand.java | 25 -- .../collector/core/queue/MessageHolder.java | 38 -- .../collector/core/queue/QueueCreator.java | 26 -- .../core/queue/QueueEventHandler.java | 26 -- .../collector/core/queue/QueueExecutor.java | 27 -- .../apm/collector/core/remote/Remote.java | 26 -- .../apm/collector/core/server/Server.java | 37 -- .../core/server/ServerException.java | 35 -- .../collector/core/server/ServerHolder.java | 73 --- .../core/server/ServerModuleDefine.java | 27 -- .../collector/core/storage/ColumnDefine.java | 40 -- .../core/storage/StorageBatchBuilder.java | 29 -- .../core/storage/StorageDefineLoader.java | 48 -- .../core/storage/StorageDefinitionFile.java | 30 -- .../core/storage/StorageException.java | 34 -- .../core/storage/StorageInstallException.java | 33 -- .../core/storage/StorageInstaller.java | 64 --- .../collector/core/storage/TableDefine.java | 49 -- .../core/stream/AbstractHashMessage.java | 39 -- .../apm/collector/core/stream/Data.java | 132 ------ .../apm/collector/core/stream/Operation.java | 36 -- .../apm/collector/core/stream/Transform.java | 28 -- .../core/stream/operate/AddOperation.java | 51 --- .../core/stream/operate/CoverOperation.java | 50 --- .../core/stream/operate/NonOperation.java | 50 --- .../apm/collector/core/util/BytesUtils.java | 43 -- .../collector/core/util/CollectionUtils.java | 48 -- .../collector/core/util/ColumnNameUtils.java | 44 -- .../apm/collector/core/util/Const.java | 35 -- .../collector/core/util/DefinitionLoader.java | 96 ---- .../apm/collector/core/util/ObjectUtils.java | 32 -- .../collector/core/util/ResourceUtils.java | 40 -- .../apm/collector/core/util/StringUtils.java | 35 -- .../collector/core/util/TimeBucketUtils.java | 126 ------ .../main/resources/application-default.yml | 36 -- .../src/main/resources/logback.xml | 33 -- .../module/ModuleConfigLoaderTestCase.java | 40 -- .../core/utils/ColumnNameUtilsTestCase.java | 35 -- .../core/utils/ResourceUtilsTestCase.java | 40 -- .../core/utils/TimeBucketUtilsTestCase.java | 46 -- .../resources/META-INF/defines/module.define | 1 - .../src/test/resources/application.yml | 8 - .../src/test/resources/logback-test.xml | 30 -- .../apm-collector-queue/pom.xml | 45 -- .../collector/queue/QueueModuleContext.java | 41 -- .../collector/queue/QueueModuleDefine.java | 48 -- .../collector/queue/QueueModuleException.java | 34 -- .../queue/QueueModuleGroupDefine.java | 53 --- .../collector/queue/QueueModuleInstaller.java | 66 --- .../DataCarrierQueueConfigParser.java | 33 -- .../datacarrier/DataCarrierQueueCreator.java | 33 -- .../QueueDataCarrierModuleDefine.java | 51 --- .../disruptor/DisruptorEventHandler.java | 76 ---- .../disruptor/DisruptorQueueConfigParser.java | 33 -- .../disruptor/DisruptorQueueCreator.java | 72 --- .../queue/disruptor/MessageHolderFactory.java | 34 -- .../disruptor/QueueDisruptorModuleDefine.java | 51 --- .../resources/META-INF/defines/group.define | 1 - .../resources/META-INF/defines/module.define | 2 - .../apm-collector-remote/pom.xml | 122 ----- .../src/main/proto/RemoteCommonService.proto | 32 -- .../apm-collector-server/pom.xml | 59 --- .../collector/server/grpc/GRPCHandler.java | 27 -- .../apm/collector/server/grpc/GRPCServer.java | 73 --- .../server/grpc/GRPCServerException.java | 35 -- .../server/jetty/ArgumentsParseException.java | 35 -- .../collector/server/jetty/JettyHandler.java | 174 -------- .../collector/server/jetty/JettyServer.java | 81 ---- .../server/jetty/JettyServerException.java | 35 -- .../apm-collector-storage/pom.xml | 50 --- .../storage/StorageModuleContext.java | 42 -- .../storage/StorageModuleDefine.java | 74 --- .../storage/StorageModuleException.java | 34 -- .../storage/StorageModuleGroupDefine.java | 53 --- .../storage/StorageModuleInstaller.java | 46 -- .../apm/collector/storage/dao/DAO.java | 36 -- .../collector/storage/dao/DAOContainer.java | 39 -- .../apm/collector/storage/dao/IBatchDAO.java | 28 -- .../collector/storage/define/Attribute.java | 48 -- .../storage/define/AttributeType.java | 26 -- .../collector/storage/define/CommonTable.java | 29 -- .../collector/storage/define/DataDefine.java | 112 ----- .../define/global/GlobalTraceDataDefine.java | 109 ----- .../define/global/GlobalTraceTable.java | 30 -- .../instance/InstPerformanceDataDefine.java | 152 ------- .../define/instance/InstPerformanceTable.java | 32 -- .../define/jvm/CpuMetricDataDefine.java | 122 ----- .../storage/define/jvm/CpuMetricTable.java | 30 -- .../define/jvm/GCMetricDataDefine.java | 147 ------ .../storage/define/jvm/GCMetricTable.java | 32 -- .../define/jvm/MemoryMetricDataDefine.java | 154 ------- .../storage/define/jvm/MemoryMetricTable.java | 34 -- .../jvm/MemoryPoolMetricDataDefine.java | 154 ------- .../define/jvm/MemoryPoolMetricTable.java | 34 -- .../define/node/NodeComponentDataDefine.java | 151 ------- .../define/node/NodeComponentTable.java | 32 -- .../define/node/NodeMappingDataDefine.java | 137 ------ .../storage/define/node/NodeMappingTable.java | 31 -- .../noderef/NodeReferenceDataDefine.java | 210 --------- .../define/noderef/NodeReferenceTable.java | 37 -- .../register/ApplicationDataDefine.java | 94 ---- .../define/register/ApplicationTable.java | 30 -- .../define/register/InstanceDataDefine.java | 151 ------- .../define/register/InstanceTable.java | 34 -- .../register/ServiceNameDataDefine.java | 107 ----- .../define/register/ServiceNameTable.java | 31 -- .../define/segment/SegmentCostDataDefine.java | 164 ------- .../define/segment/SegmentCostTable.java | 35 -- .../define/segment/SegmentDataDefine.java | 87 ---- .../storage/define/segment/SegmentTable.java | 29 -- .../service/ServiceEntryDataDefine.java | 162 ------- .../define/service/ServiceEntryTable.java | 33 -- .../ServiceReferenceDataDefine.java | 277 ------------ .../serviceref/ServiceReferenceTable.java | 41 -- .../ElasticSearchStorageException.java | 34 -- .../StorageElasticSearchConfig.java | 30 -- .../StorageElasticSearchConfigParser.java | 59 --- .../StorageElasticSearchModuleDefine.java | 74 --- .../storage/elasticsearch/dao/BatchEsDAO.java | 59 --- .../storage/elasticsearch/dao/EsDAO.java | 73 --- .../elasticsearch/dao/EsDAODefineLoader.java | 48 -- .../dao/EsDAODefinitionFile.java | 31 -- .../define/ElasticSearchColumnDefine.java | 34 -- .../define/ElasticSearchStorageInstaller.java | 126 ------ .../define/ElasticSearchTableDefine.java | 37 -- .../apm/collector/storage/h2/SqlBuilder.java | 57 --- .../collector/storage/h2/StorageH2Config.java | 28 -- .../storage/h2/StorageH2ConfigParser.java | 51 --- .../storage/h2/StorageH2ModuleDefine.java | 74 --- .../collector/storage/h2/dao/BatchH2DAO.java | 85 ---- .../apm/collector/storage/h2/dao/H2DAO.java | 61 --- .../storage/h2/dao/H2DAODefineLoader.java | 48 -- .../storage/h2/dao/H2DAODefinitionFile.java | 31 -- .../storage/h2/define/H2ColumnDefine.java | 35 -- .../storage/h2/define/H2SqlEntity.java | 43 -- .../storage/h2/define/H2StorageInstaller.java | 110 ----- .../storage/h2/define/H2TableDefine.java | 31 -- .../resources/META-INF/defines/es_dao.define | 1 - .../resources/META-INF/defines/group.define | 1 - .../resources/META-INF/defines/h2_dao.define | 1 - .../resources/META-INF/defines/module.define | 2 - .../apm-collector-stream/pom.xml | 65 --- .../collector/stream/StreamModuleContext.java | 55 --- .../collector/stream/StreamModuleDefine.java | 36 -- .../stream/StreamModuleException.java | 35 -- .../stream/StreamModuleGroupDefine.java | 53 --- .../stream/StreamModuleInstaller.java | 86 ---- .../stream/grpc/StreamGRPCConfig.java | 27 -- .../stream/grpc/StreamGRPCConfigParser.java | 48 -- .../stream/grpc/StreamGRPCDataListener.java | 100 ----- .../stream/grpc/StreamGRPCModuleDefine.java | 74 --- .../grpc/StreamGRPCModuleRegistration.java | 31 -- .../handler/RemoteCommonServiceHandler.java | 66 --- .../worker/AbstractLocalAsyncWorker.java | 72 --- .../AbstractLocalAsyncWorkerProvider.java | 53 --- .../stream/worker/AbstractRemoteWorker.java | 66 --- .../worker/AbstractRemoteWorkerProvider.java | 52 --- .../stream/worker/AbstractWorker.java | 70 --- .../stream/worker/AbstractWorkerProvider.java | 39 -- .../stream/worker/ClusterWorkerContext.java | 39 -- .../worker/ClusterWorkerRefCounter.java | 40 -- .../apm/collector/stream/worker/Context.java | 35 -- .../LocalAsyncWorkerProviderDefineLoader.java | 48 -- .../stream/worker/LocalAsyncWorkerRef.java | 39 -- .../LocalWorkerProviderDefinitionFile.java | 30 -- .../apm/collector/stream/worker/LookUp.java | 27 -- .../apm/collector/stream/worker/Provider.java | 27 -- .../worker/ProviderNotFoundException.java | 25 -- .../RemoteWorkerProviderDefineLoader.java | 48 -- .../RemoteWorkerProviderDefinitionFile.java | 30 -- .../stream/worker/RemoteWorkerRef.java | 148 ------ .../apm/collector/stream/worker/Role.java | 34 -- .../stream/worker/UsedRoleNameException.java | 25 -- .../stream/worker/WorkerContext.java | 91 ---- .../stream/worker/WorkerException.java | 37 -- .../stream/worker/WorkerInvokeException.java | 36 -- .../worker/WorkerNotFoundException.java | 25 -- .../collector/stream/worker/WorkerRef.java | 36 -- .../collector/stream/worker/WorkerRefs.java | 57 --- .../stream/worker/impl/AggregationWorker.java | 100 ----- .../stream/worker/impl/FlushAndSwitch.java | 25 -- .../stream/worker/impl/GRPCRemoteWorker.java | 43 -- .../stream/worker/impl/PersistenceWorker.java | 154 ------- .../impl/PersistenceWorkerContainer.java | 39 -- .../worker/impl/dao/IPersistenceDAO.java | 33 -- .../stream/worker/impl/data/DataCache.java | 54 --- .../worker/impl/data/DataCollection.java | 86 ---- .../stream/worker/impl/data/Window.java | 84 ---- .../worker/selector/ForeverFirstSelector.java | 37 -- .../worker/selector/HashCodeSelector.java | 54 --- .../worker/selector/RollingSelector.java | 50 --- .../worker/selector/WorkerSelector.java | 44 -- .../resources/META-INF/defines/group.define | 1 - .../resources/META-INF/defines/module.define | 1 - .../worker/util/TimeBucketUtilsTestCase.java | 63 --- apm-collector-3.2.3/apm-collector-ui/pom.xml | 60 --- .../apm/collector/ui/UIModuleContext.java | 31 -- .../apm/collector/ui/UIModuleDefine.java | 41 -- .../apm/collector/ui/UIModuleException.java | 34 -- .../apm/collector/ui/UIModuleGroupDefine.java | 53 --- .../apm/collector/ui/UIModuleInstaller.java | 41 -- .../apm/collector/ui/dao/CpuMetricEsDAO.java | 69 --- .../apm/collector/ui/dao/CpuMetricH2DAO.java | 87 ---- .../apm/collector/ui/dao/GCMetricEsDAO.java | 149 ------- .../apm/collector/ui/dao/GCMetricH2DAO.java | 154 ------- .../collector/ui/dao/GlobalTraceEsDAO.java | 77 ---- .../collector/ui/dao/GlobalTraceH2DAO.java | 76 ---- .../apm/collector/ui/dao/ICpuMetricDAO.java | 30 -- .../apm/collector/ui/dao/IGCMetricDAO.java | 63 --- .../apm/collector/ui/dao/IGlobalTraceDAO.java | 30 -- .../collector/ui/dao/IInstPerformanceDAO.java | 60 --- .../apm/collector/ui/dao/IInstanceDAO.java | 56 --- .../collector/ui/dao/IMemoryMetricDAO.java | 30 -- .../ui/dao/IMemoryPoolMetricDAO.java | 30 -- .../collector/ui/dao/INodeComponentDAO.java | 28 -- .../apm/collector/ui/dao/INodeMappingDAO.java | 28 -- .../collector/ui/dao/INodeReferenceDAO.java | 28 -- .../apm/collector/ui/dao/ISegmentCostDAO.java | 38 -- .../apm/collector/ui/dao/ISegmentDAO.java | 28 -- .../collector/ui/dao/IServiceEntryDAO.java | 28 -- .../ui/dao/IServiceReferenceDAO.java | 29 -- .../ui/dao/InstPerformanceEsDAO.java | 137 ------ .../ui/dao/InstPerformanceH2DAO.java | 162 ------- .../apm/collector/ui/dao/InstanceEsDAO.java | 164 ------- .../apm/collector/ui/dao/InstanceH2DAO.java | 149 ------- .../collector/ui/dao/MemoryMetricEsDAO.java | 83 ---- .../collector/ui/dao/MemoryMetricH2DAO.java | 100 ----- .../ui/dao/MemoryPoolMetricEsDAO.java | 82 ---- .../ui/dao/MemoryPoolMetricH2DAO.java | 100 ----- .../collector/ui/dao/NodeComponentEsDAO.java | 130 ------ .../collector/ui/dao/NodeComponentH2DAO.java | 83 ---- .../collector/ui/dao/NodeMappingEsDAO.java | 90 ---- .../collector/ui/dao/NodeMappingH2DAO.java | 76 ---- .../collector/ui/dao/NodeReferenceEsDAO.java | 135 ------ .../collector/ui/dao/NodeReferenceH2DAO.java | 92 ---- .../collector/ui/dao/SegmentCostEsDAO.java | 124 ----- .../collector/ui/dao/SegmentCostH2DAO.java | 159 ------- .../apm/collector/ui/dao/SegmentEsDAO.java | 53 --- .../apm/collector/ui/dao/SegmentH2DAO.java | 59 --- .../collector/ui/dao/ServiceEntryEsDAO.java | 95 ---- .../collector/ui/dao/ServiceEntryH2DAO.java | 98 ---- .../ui/dao/ServiceReferenceEsDAO.java | 129 ------ .../ui/dao/ServiceReferenceH2DAO.java | 109 ----- .../apm/collector/ui/jetty/UIJettyConfig.java | 28 -- .../ui/jetty/UIJettyConfigParser.java | 54 --- .../ui/jetty/UIJettyDataListener.java | 42 -- .../ui/jetty/UIJettyModuleDefine.java | 93 ---- .../ui/jetty/UIJettyModuleRegistration.java | 31 -- .../jetty/handler/SegmentTopGetHandler.java | 135 ------ .../ui/jetty/handler/SpanGetHandler.java | 60 --- .../ui/jetty/handler/TraceDagGetHandler.java | 71 --- .../jetty/handler/TraceStackGetHandler.java | 52 --- .../application/ApplicationsGetHandler.java | 71 --- .../InstanceHealthGetHandler.java | 79 ---- ...InstanceMetricGetOneTimeBucketHandler.java | 80 ---- ...stanceMetricGetRangeTimeBucketHandler.java | 88 ---- .../InstanceOsInfoGetHandler.java | 59 --- .../servicetree/EntryServiceGetHandler.java | 98 ---- .../ServiceTreeGetByIdHandler.java | 79 ---- .../time/AllInstanceLastTimeGetHandler.java | 65 --- .../time/OneInstanceLastTimeGetHandler.java | 64 --- .../ui/service/ApplicationService.java | 34 -- .../ui/service/InstanceHealthService.java | 102 ----- .../ui/service/InstanceJVMService.java | 149 ------- .../ui/service/SegmentTopService.java | 51 --- .../ui/service/ServiceTreeService.java | 112 ----- .../apm/collector/ui/service/SpanService.java | 121 ----- .../ui/service/TimeSynchronousService.java | 42 -- .../ui/service/TraceDagDataBuilder.java | 140 ------ .../collector/ui/service/TraceDagService.java | 53 --- .../ui/service/TraceStackService.java | 257 ----------- .../resources/META-INF/defines/es_dao.define | 14 - .../resources/META-INF/defines/group.define | 1 - .../resources/META-INF/defines/h2_dao.define | 14 - .../resources/META-INF/defines/module.define | 1 - apm-collector-3.2.3/pom.xml | 84 ---- 632 files changed, 37341 deletions(-) delete mode 100644 apm-collector-3.2.3/apm-collector-agentjvm/pom.xml delete mode 100644 apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/grpc/handler/JVMMetricsServiceHandler.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/cpu/CpuMetricPersistenceWorker.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/cpu/dao/CpuMetricEsDAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/cpu/dao/CpuMetricH2DAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/cpu/dao/ICpuMetricDAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/cpu/define/CpuMetricEsTableDefine.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/cpu/define/CpuMetricH2TableDefine.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/gc/GCMetricPersistenceWorker.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/gc/dao/GCMetricEsDAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/gc/dao/GCMetricH2DAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/gc/dao/IGCMetricDAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/gc/define/GCMetricEsTableDefine.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/gc/define/GCMetricH2TableDefine.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/heartbeat/InstHeartBeatPersistenceWorker.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/heartbeat/dao/IInstanceHeartBeatDAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/heartbeat/dao/InstanceHeartBeatEsDAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/heartbeat/dao/InstanceHeartBeatH2DAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/heartbeat/define/InstanceHeartBeatDataDefine.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/memory/MemoryMetricPersistenceWorker.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/memory/dao/IMemoryMetricDAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/memory/dao/MemoryMetricEsDAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/memory/dao/MemoryMetricH2DAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/memory/define/MemoryMetricEsTableDefine.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/memory/define/MemoryMetricH2TableDefine.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/memorypool/MemoryPoolMetricPersistenceWorker.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/memorypool/dao/IMemoryPoolMetricDAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/memorypool/dao/MemoryPoolMetricEsDAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/memorypool/dao/MemoryPoolMetricH2DAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/memorypool/define/MemoryPoolMetricEsTableDefine.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/memorypool/define/MemoryPoolMetricH2TableDefine.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentjvm/src/main/resources/META-INF/defines/es_dao.define delete mode 100644 apm-collector-3.2.3/apm-collector-agentjvm/src/main/resources/META-INF/defines/h2_dao.define delete mode 100644 apm-collector-3.2.3/apm-collector-agentjvm/src/main/resources/META-INF/defines/local_worker_provider.define delete mode 100644 apm-collector-3.2.3/apm-collector-agentjvm/src/main/resources/META-INF/defines/storage.define delete mode 100644 apm-collector-3.2.3/apm-collector-agentjvm/src/test/java/org/skywalking/apm/collector/agentjvm/grpc/handler/JVMMetricsServiceHandlerTestCase.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentregister/pom.xml delete mode 100644 apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/application/ApplicationIDService.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/grpc/handler/ApplicationRegisterServiceHandler.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/grpc/handler/InstanceDiscoveryServiceHandler.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/grpc/handler/ServiceNameDiscoveryServiceHandler.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/instance/InstanceIDService.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/jetty/handler/ApplicationRegisterServletHandler.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/jetty/handler/InstanceDiscoveryServletHandler.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/jetty/handler/ServiceNameDiscoveryServiceHandler.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/servicename/ServiceNameService.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/IdAutoIncrement.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/application/ApplicationEsTableDefine.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/application/ApplicationH2TableDefine.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/application/ApplicationRegisterRemoteWorker.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/application/ApplicationRegisterSerialWorker.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/application/dao/ApplicationEsDAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/application/dao/ApplicationH2DAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/application/dao/IApplicationDAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/instance/InstanceEsTableDefine.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/instance/InstanceH2TableDefine.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/instance/InstanceRegisterRemoteWorker.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/instance/InstanceRegisterSerialWorker.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/instance/dao/IInstanceDAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/instance/dao/InstanceEsDAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/instance/dao/InstanceH2DAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/servicename/ServiceNameEsTableDefine.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/servicename/ServiceNameH2TableDefine.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/servicename/ServiceNameRegisterRemoteWorker.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/servicename/ServiceNameRegisterSerialWorker.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/servicename/dao/IServiceNameDAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/servicename/dao/ServiceNameEsDAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/servicename/dao/ServiceNameH2DAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentregister/src/main/resources/META-INF/defines/es_dao.define delete mode 100644 apm-collector-3.2.3/apm-collector-agentregister/src/main/resources/META-INF/defines/h2_dao.define delete mode 100644 apm-collector-3.2.3/apm-collector-agentregister/src/main/resources/META-INF/defines/local_worker_provider.define delete mode 100644 apm-collector-3.2.3/apm-collector-agentregister/src/main/resources/META-INF/defines/storage.define delete mode 100644 apm-collector-3.2.3/apm-collector-agentregister/src/test/java/org/skywalking/apm/collector/agentregister/grpc/handler/ApplicationRegisterServiceHandlerTestCase.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentserver/pom.xml delete mode 100644 apm-collector-3.2.3/apm-collector-agentserver/src/main/java/org/skywalking/apm/collector/agentserver/AgentServerModuleContext.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentserver/src/main/java/org/skywalking/apm/collector/agentserver/AgentServerModuleDefine.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentserver/src/main/java/org/skywalking/apm/collector/agentserver/AgentServerModuleException.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentserver/src/main/java/org/skywalking/apm/collector/agentserver/AgentServerModuleGroupDefine.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentserver/src/main/java/org/skywalking/apm/collector/agentserver/AgentServerModuleInstaller.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentserver/src/main/java/org/skywalking/apm/collector/agentserver/jetty/AgentServerJettyConfig.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentserver/src/main/java/org/skywalking/apm/collector/agentserver/jetty/AgentServerJettyConfigParser.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentserver/src/main/java/org/skywalking/apm/collector/agentserver/jetty/AgentServerJettyDataListener.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentserver/src/main/java/org/skywalking/apm/collector/agentserver/jetty/AgentServerJettyModuleDefine.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentserver/src/main/java/org/skywalking/apm/collector/agentserver/jetty/AgentServerJettyModuleRegistration.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentserver/src/main/java/org/skywalking/apm/collector/agentserver/jetty/handler/AgentStreamGRPCServerHandler.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentserver/src/main/java/org/skywalking/apm/collector/agentserver/jetty/handler/AgentStreamJettyServerHandler.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentserver/src/main/java/org/skywalking/apm/collector/agentserver/jetty/handler/UIJettyServerHandler.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentserver/src/main/resources/META-INF/defines/group.define delete mode 100644 apm-collector-3.2.3/apm-collector-agentserver/src/main/resources/META-INF/defines/module.define delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/pom.xml delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/AgentStreamModuleContext.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/AgentStreamModuleDefine.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/AgentStreamModuleException.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/AgentStreamModuleGroupConfigParser.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/AgentStreamModuleGroupDefine.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/AgentStreamModuleInstaller.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/config/BufferFileConfig.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/grpc/AgentStreamGRPCConfig.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/grpc/AgentStreamGRPCConfigParser.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/grpc/AgentStreamGRPCDataListener.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/grpc/AgentStreamGRPCModuleDefine.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/grpc/AgentStreamGRPCModuleRegistration.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/grpc/handler/TraceSegmentServiceHandler.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/jetty/AgentStreamJettyConfig.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/jetty/AgentStreamJettyConfigParser.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/jetty/AgentStreamJettyDataListener.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/jetty/AgentStreamJettyModuleDefine.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/jetty/AgentStreamJettyModuleRegistration.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/jetty/handler/TraceSegmentServletHandler.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/jetty/handler/reader/KeyWithStringValueJsonReader.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/jetty/handler/reader/LogJsonReader.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/jetty/handler/reader/ReferenceJsonReader.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/jetty/handler/reader/SegmentJsonReader.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/jetty/handler/reader/SpanJsonReader.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/jetty/handler/reader/StreamJsonReader.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/jetty/handler/reader/TraceSegment.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/jetty/handler/reader/TraceSegmentJsonReader.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/jetty/handler/reader/UniqueIdJsonReader.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/AgentStreamModuleDefineException.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/global/GlobalTracePersistenceWorker.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/global/GlobalTraceSpanListener.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/global/dao/GlobalTraceEsDAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/global/dao/GlobalTraceH2DAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/global/dao/IGlobalTraceDAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/global/define/GlobalTraceEsTableDefine.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/global/define/GlobalTraceH2TableDefine.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/instance/performance/InstPerformancePersistenceWorker.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/instance/performance/InstPerformanceSpanListener.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/instance/performance/dao/IInstPerformanceDAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/instance/performance/dao/InstPerformanceEsDAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/instance/performance/dao/InstPerformanceH2DAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/instance/performance/define/InstPerformanceEsTableDefine.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/instance/performance/define/InstPerformanceH2TableDefine.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/node/component/NodeComponentAggregationWorker.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/node/component/NodeComponentPersistenceWorker.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/node/component/NodeComponentRemoteWorker.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/node/component/NodeComponentSpanListener.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/node/component/dao/INodeComponentDAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/node/component/dao/NodeComponentEsDAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/node/component/dao/NodeComponentH2DAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/node/component/define/NodeComponentEsTableDefine.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/node/component/define/NodeComponentH2TableDefine.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/node/mapping/NodeMappingAggregationWorker.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/node/mapping/NodeMappingPersistenceWorker.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/node/mapping/NodeMappingRemoteWorker.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/node/mapping/NodeMappingSpanListener.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/node/mapping/dao/INodeMappingDAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/node/mapping/dao/NodeMappingEsDAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/node/mapping/dao/NodeMappingH2DAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/node/mapping/define/NodeMappingEsTableDefine.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/node/mapping/define/NodeMappingH2TableDefine.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/noderef/NodeReferenceAggregationWorker.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/noderef/NodeReferencePersistenceWorker.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/noderef/NodeReferenceRemoteWorker.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/noderef/NodeReferenceSpanListener.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/noderef/dao/INodeReferenceDAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/noderef/dao/NodeReferenceEsDAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/noderef/dao/NodeReferenceH2DAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/noderef/define/NodeReferenceEsTableDefine.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/noderef/define/NodeReferenceH2TableDefine.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/EntrySpanListener.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/ExitSpanListener.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/FirstSpanListener.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/GlobalTraceIdsListener.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/LocalSpanListener.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/RefsListener.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/SegmentParse.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/SpanListener.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/buffer/Offset.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/buffer/OffsetManager.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/buffer/SegmentBufferConfig.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/buffer/SegmentBufferManager.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/buffer/SegmentBufferReader.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/cost/SegmentCostPersistenceWorker.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/cost/SegmentCostSpanListener.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/cost/dao/ISegmentCostDAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/cost/dao/SegmentCostEsDAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/cost/dao/SegmentCostH2DAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/cost/define/SegmentCostEsTableDefine.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/cost/define/SegmentCostH2TableDefine.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/origin/SegmentPersistenceWorker.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/origin/dao/ISegmentDAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/origin/dao/SegmentEsDAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/origin/dao/SegmentH2DAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/origin/define/SegmentEsTableDefine.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/origin/define/SegmentH2TableDefine.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/standardization/IdExchanger.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/standardization/ReferenceDecorator.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/standardization/ReferenceIdExchanger.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/standardization/SegmentDecorator.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/standardization/SegmentStandardizationWorker.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/standardization/SpanDecorator.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/standardization/SpanIdExchanger.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/standardization/StandardBuilder.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/service/entry/ServiceEntryAggregationWorker.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/service/entry/ServiceEntryPersistenceWorker.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/service/entry/ServiceEntryRemoteWorker.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/service/entry/ServiceEntrySpanListener.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/service/entry/dao/IServiceEntryDAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/service/entry/dao/ServiceEntryEsDAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/service/entry/dao/ServiceEntryH2DAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/service/entry/define/ServiceEntryEsTableDefine.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/service/entry/define/ServiceEntryH2TableDefine.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/serviceref/ServiceReferenceAggregationWorker.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/serviceref/ServiceReferencePersistenceWorker.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/serviceref/ServiceReferenceRemoteWorker.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/serviceref/ServiceReferenceSpanListener.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/serviceref/dao/IServiceReferenceDAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/serviceref/dao/ServiceReferenceEsDAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/serviceref/dao/ServiceReferenceH2DAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/serviceref/define/ServiceReferenceEsTableDefine.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/serviceref/define/ServiceReferenceH2TableDefine.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/storage/PersistenceTimer.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/util/FileUtils.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/resources/META-INF/defines/es_dao.define delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/resources/META-INF/defines/group.define delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/resources/META-INF/defines/h2_dao.define delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/resources/META-INF/defines/local_worker_provider.define delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/resources/META-INF/defines/module.define delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/resources/META-INF/defines/remote_worker_provider.define delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/main/resources/META-INF/defines/storage.define delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/test/java/org/skywalking/apm/collector/agentstream/HttpClientTools.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/test/java/org/skywalking/apm/collector/agentstream/grpc/handler/TraceSegmentServiceHandlerTestCase.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/test/java/org/skywalking/apm/collector/agentstream/jetty/handler/reader/TraceSegmentJsonReaderTestCase.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/test/java/org/skywalking/apm/collector/agentstream/mock/JsonFileReader.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/test/java/org/skywalking/apm/collector/agentstream/mock/SegmentPost.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/test/java/org/skywalking/apm/collector/agentstream/mock/grpc/ApplicationRegister.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/test/java/org/skywalking/apm/collector/agentstream/mock/grpc/GrpcSegmentPost.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/test/java/org/skywalking/apm/collector/agentstream/mock/grpc/InstanceRegister.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/test/java/org/skywalking/apm/collector/agentstream/mock/grpc/ServiceRegister.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/test/java/org/skywalking/apm/collector/agentstream/mock/grpc/SingleHasEntryHasExitNoRefSpan.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/test/java/org/skywalking/apm/collector/agentstream/mock/grpc/SingleHasEntryNoExitHasRefSpan.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/test/java/org/skywalking/apm/collector/agentstream/mock/grpc/SingleHasEntryNoExitNoRefSpan.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/test/java/org/skywalking/apm/collector/agentstream/mock/grpc/SingleNoEntryHasExitNoRefSpan.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/test/java/org/skywalking/apm/collector/agentstream/worker/segment/buffer/SegmentBufferWriteWorkerTestCase.java delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/test/resources/json/segment/normal/application-register.json delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/test/resources/json/segment/normal/dubbox-consumer.json delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/test/resources/json/segment/normal/dubbox-provider.json delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/test/resources/json/segment/normal/instance-register.json delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/test/resources/log4j2.xml delete mode 100644 apm-collector-3.2.3/apm-collector-agentstream/src/test/resources/logback.xml delete mode 100644 apm-collector-3.2.3/apm-collector-boot/bin/collector-service.bat delete mode 100644 apm-collector-3.2.3/apm-collector-boot/bin/collector-service.sh delete mode 100644 apm-collector-3.2.3/apm-collector-boot/bin/startup.bat delete mode 100644 apm-collector-3.2.3/apm-collector-boot/bin/startup.sh delete mode 100644 apm-collector-3.2.3/apm-collector-boot/docker/Dockerfile delete mode 100644 apm-collector-3.2.3/apm-collector-boot/docker/application.yml delete mode 100644 apm-collector-3.2.3/apm-collector-boot/docker/collector-service.sh delete mode 100644 apm-collector-3.2.3/apm-collector-boot/docker/docker-entrypoint.sh delete mode 100644 apm-collector-3.2.3/apm-collector-boot/docker/log4j2.xml delete mode 100644 apm-collector-3.2.3/apm-collector-boot/pom.xml delete mode 100644 apm-collector-3.2.3/apm-collector-boot/src/main/assembly/assembly.xml delete mode 100644 apm-collector-3.2.3/apm-collector-boot/src/main/assembly/log4j2.xml delete mode 100644 apm-collector-3.2.3/apm-collector-boot/src/main/java/org/skywalking/apm/collector/boot/CollectorBootStartUp.java delete mode 100644 apm-collector-3.2.3/apm-collector-boot/src/main/java/org/skywalking/apm/collector/boot/CollectorStarter.java delete mode 100644 apm-collector-3.2.3/apm-collector-boot/src/main/resources/application.yml delete mode 100644 apm-collector-3.2.3/apm-collector-boot/src/main/resources/log4j2.xml delete mode 100644 apm-collector-3.2.3/apm-collector-cache/pom.xml delete mode 100644 apm-collector-3.2.3/apm-collector-cache/src/main/java/org/skywalking/apm/collector/cache/ApplicationCache.java delete mode 100644 apm-collector-3.2.3/apm-collector-cache/src/main/java/org/skywalking/apm/collector/cache/InstanceCache.java delete mode 100644 apm-collector-3.2.3/apm-collector-cache/src/main/java/org/skywalking/apm/collector/cache/ServiceIdCache.java delete mode 100644 apm-collector-3.2.3/apm-collector-cache/src/main/java/org/skywalking/apm/collector/cache/ServiceNameCache.java delete mode 100644 apm-collector-3.2.3/apm-collector-cache/src/main/java/org/skywalking/apm/collector/cache/dao/ApplicationEsCacheDAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-cache/src/main/java/org/skywalking/apm/collector/cache/dao/ApplicationH2CacheDAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-cache/src/main/java/org/skywalking/apm/collector/cache/dao/IApplicationCacheDAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-cache/src/main/java/org/skywalking/apm/collector/cache/dao/IInstanceCacheDAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-cache/src/main/java/org/skywalking/apm/collector/cache/dao/IServiceNameCacheDAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-cache/src/main/java/org/skywalking/apm/collector/cache/dao/InstanceEsCacheDAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-cache/src/main/java/org/skywalking/apm/collector/cache/dao/InstanceH2CacheDAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-cache/src/main/java/org/skywalking/apm/collector/cache/dao/ServiceNameEsCacheDAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-cache/src/main/java/org/skywalking/apm/collector/cache/dao/ServiceNameH2CacheDAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-cache/src/main/resources/META-INF/defines/es_dao.define delete mode 100644 apm-collector-3.2.3/apm-collector-cache/src/main/resources/META-INF/defines/h2_dao.define delete mode 100644 apm-collector-3.2.3/apm-collector-client/pom.xml delete mode 100644 apm-collector-3.2.3/apm-collector-client/src/main/java/org/skywalking/apm/collector/client/elasticsearch/ElasticSearchClient.java delete mode 100644 apm-collector-3.2.3/apm-collector-client/src/main/java/org/skywalking/apm/collector/client/elasticsearch/ElasticSearchClientException.java delete mode 100644 apm-collector-3.2.3/apm-collector-client/src/main/java/org/skywalking/apm/collector/client/grpc/GRPCClient.java delete mode 100644 apm-collector-3.2.3/apm-collector-client/src/main/java/org/skywalking/apm/collector/client/grpc/GRPCClientException.java delete mode 100644 apm-collector-3.2.3/apm-collector-client/src/main/java/org/skywalking/apm/collector/client/h2/H2Client.java delete mode 100644 apm-collector-3.2.3/apm-collector-client/src/main/java/org/skywalking/apm/collector/client/h2/H2ClientException.java delete mode 100644 apm-collector-3.2.3/apm-collector-client/src/main/java/org/skywalking/apm/collector/client/redis/RedisClient.java delete mode 100644 apm-collector-3.2.3/apm-collector-client/src/main/java/org/skywalking/apm/collector/client/redis/RedisClientException.java delete mode 100644 apm-collector-3.2.3/apm-collector-client/src/main/java/org/skywalking/apm/collector/client/zookeeper/ZookeeperClient.java delete mode 100644 apm-collector-3.2.3/apm-collector-client/src/main/java/org/skywalking/apm/collector/client/zookeeper/ZookeeperClientException.java delete mode 100644 apm-collector-3.2.3/apm-collector-client/src/main/java/org/skywalking/apm/collector/client/zookeeper/util/PathUtils.java delete mode 100644 apm-collector-3.2.3/apm-collector-cluster/pom.xml delete mode 100644 apm-collector-3.2.3/apm-collector-cluster/src/main/java/org/skywalking/apm/collector/cluster/ClusterModuleDefine.java delete mode 100644 apm-collector-3.2.3/apm-collector-cluster/src/main/java/org/skywalking/apm/collector/cluster/ClusterModuleGroupDefine.java delete mode 100644 apm-collector-3.2.3/apm-collector-cluster/src/main/java/org/skywalking/apm/collector/cluster/ClusterModuleInstaller.java delete mode 100644 apm-collector-3.2.3/apm-collector-cluster/src/main/java/org/skywalking/apm/collector/cluster/ClusterNodeExistException.java delete mode 100644 apm-collector-3.2.3/apm-collector-cluster/src/main/java/org/skywalking/apm/collector/cluster/redis/ClusterRedisConfig.java delete mode 100644 apm-collector-3.2.3/apm-collector-cluster/src/main/java/org/skywalking/apm/collector/cluster/redis/ClusterRedisConfigParser.java delete mode 100644 apm-collector-3.2.3/apm-collector-cluster/src/main/java/org/skywalking/apm/collector/cluster/redis/ClusterRedisModuleDefine.java delete mode 100644 apm-collector-3.2.3/apm-collector-cluster/src/main/java/org/skywalking/apm/collector/cluster/redis/ClusterRedisModuleRegistrationReader.java delete mode 100644 apm-collector-3.2.3/apm-collector-cluster/src/main/java/org/skywalking/apm/collector/cluster/standalone/ClusterStandaloneConfigParser.java delete mode 100644 apm-collector-3.2.3/apm-collector-cluster/src/main/java/org/skywalking/apm/collector/cluster/standalone/ClusterStandaloneDataMonitor.java delete mode 100644 apm-collector-3.2.3/apm-collector-cluster/src/main/java/org/skywalking/apm/collector/cluster/standalone/ClusterStandaloneModuleDefine.java delete mode 100644 apm-collector-3.2.3/apm-collector-cluster/src/main/java/org/skywalking/apm/collector/cluster/standalone/ClusterStandaloneModuleRegistrationReader.java delete mode 100644 apm-collector-3.2.3/apm-collector-cluster/src/main/java/org/skywalking/apm/collector/cluster/zookeeper/ClusterZKConfig.java delete mode 100644 apm-collector-3.2.3/apm-collector-cluster/src/main/java/org/skywalking/apm/collector/cluster/zookeeper/ClusterZKConfigParser.java delete mode 100644 apm-collector-3.2.3/apm-collector-cluster/src/main/java/org/skywalking/apm/collector/cluster/zookeeper/ClusterZKDataMonitor.java delete mode 100644 apm-collector-3.2.3/apm-collector-cluster/src/main/java/org/skywalking/apm/collector/cluster/zookeeper/ClusterZKModuleDefine.java delete mode 100644 apm-collector-3.2.3/apm-collector-cluster/src/main/java/org/skywalking/apm/collector/cluster/zookeeper/ClusterZKModuleRegistrationReader.java delete mode 100644 apm-collector-3.2.3/apm-collector-cluster/src/main/resources/META-INF/defines/group.define delete mode 100644 apm-collector-3.2.3/apm-collector-cluster/src/main/resources/META-INF/defines/module.define delete mode 100644 apm-collector-3.2.3/apm-collector-core/pom.xml delete mode 100644 apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/CollectorException.java delete mode 100644 apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/client/Client.java delete mode 100644 apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/client/ClientException.java delete mode 100644 apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/client/DataMonitor.java delete mode 100644 apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/cluster/ClusterDataListener.java delete mode 100644 apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/cluster/ClusterDataListenerDefine.java delete mode 100644 apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/cluster/ClusterModuleContext.java delete mode 100644 apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/cluster/ClusterModuleDiscovery.java delete mode 100644 apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/cluster/ClusterModuleException.java delete mode 100644 apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/cluster/ClusterModuleRegistrationReader.java delete mode 100644 apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/config/ConfigException.java delete mode 100644 apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/config/ConfigLoader.java delete mode 100644 apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/config/ConfigLoaderException.java delete mode 100644 apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/config/ConfigParseException.java delete mode 100644 apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/config/GroupConfigParser.java delete mode 100644 apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/config/SystemConfig.java delete mode 100644 apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/config/SystemConfigParser.java delete mode 100644 apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/framework/CollectorContextHelper.java delete mode 100644 apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/framework/Context.java delete mode 100644 apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/framework/DataInitializer.java delete mode 100644 apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/framework/Decision.java delete mode 100644 apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/framework/Define.java delete mode 100644 apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/framework/DefineException.java delete mode 100644 apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/framework/DefinitionFile.java delete mode 100644 apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/framework/Executor.java delete mode 100644 apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/framework/Handler.java delete mode 100644 apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/framework/Listener.java delete mode 100644 apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/framework/Loader.java delete mode 100644 apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/framework/PriorityDecision.java delete mode 100644 apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/framework/Provider.java delete mode 100644 apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/framework/Starter.java delete mode 100644 apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/framework/UnexpectedException.java delete mode 100644 apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/module/CommonModuleInstaller.java delete mode 100644 apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/module/Module.java delete mode 100644 apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/module/ModuleConfigLoader.java delete mode 100644 apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/module/ModuleConfigParser.java delete mode 100644 apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/module/ModuleContext.java delete mode 100644 apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/module/ModuleDefine.java delete mode 100644 apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/module/ModuleDefineException.java delete mode 100644 apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/module/ModuleDefineLoader.java delete mode 100644 apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/module/ModuleDefinitionFile.java delete mode 100644 apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/module/ModuleException.java delete mode 100644 apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/module/ModuleGroupDefine.java delete mode 100644 apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/module/ModuleGroupDefineFile.java delete mode 100644 apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/module/ModuleGroupDefineLoader.java delete mode 100644 apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/module/ModuleInstaller.java delete mode 100644 apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/module/ModuleRegistration.java delete mode 100644 apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/module/MultipleModuleInstaller.java delete mode 100644 apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/module/SingleModuleInstaller.java delete mode 100644 apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/queue/DaemonThreadFactory.java delete mode 100644 apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/queue/EndOfBatchCommand.java delete mode 100644 apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/queue/MessageHolder.java delete mode 100644 apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/queue/QueueCreator.java delete mode 100644 apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/queue/QueueEventHandler.java delete mode 100644 apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/queue/QueueExecutor.java delete mode 100644 apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/remote/Remote.java delete mode 100644 apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/server/Server.java delete mode 100644 apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/server/ServerException.java delete mode 100644 apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/server/ServerHolder.java delete mode 100644 apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/server/ServerModuleDefine.java delete mode 100644 apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/storage/ColumnDefine.java delete mode 100644 apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/storage/StorageBatchBuilder.java delete mode 100644 apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/storage/StorageDefineLoader.java delete mode 100644 apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/storage/StorageDefinitionFile.java delete mode 100644 apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/storage/StorageException.java delete mode 100644 apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/storage/StorageInstallException.java delete mode 100644 apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/storage/StorageInstaller.java delete mode 100644 apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/storage/TableDefine.java delete mode 100644 apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/stream/AbstractHashMessage.java delete mode 100644 apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/stream/Data.java delete mode 100644 apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/stream/Operation.java delete mode 100644 apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/stream/Transform.java delete mode 100644 apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/stream/operate/AddOperation.java delete mode 100644 apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/stream/operate/CoverOperation.java delete mode 100644 apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/stream/operate/NonOperation.java delete mode 100644 apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/util/BytesUtils.java delete mode 100644 apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/util/CollectionUtils.java delete mode 100644 apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/util/ColumnNameUtils.java delete mode 100644 apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/util/Const.java delete mode 100644 apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/util/DefinitionLoader.java delete mode 100644 apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/util/ObjectUtils.java delete mode 100644 apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/util/ResourceUtils.java delete mode 100644 apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/util/StringUtils.java delete mode 100644 apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/util/TimeBucketUtils.java delete mode 100644 apm-collector-3.2.3/apm-collector-core/src/main/resources/application-default.yml delete mode 100644 apm-collector-3.2.3/apm-collector-core/src/main/resources/logback.xml delete mode 100644 apm-collector-3.2.3/apm-collector-core/src/test/java/org/skywalking/apm/collector/core/module/ModuleConfigLoaderTestCase.java delete mode 100644 apm-collector-3.2.3/apm-collector-core/src/test/java/org/skywalking/apm/collector/core/utils/ColumnNameUtilsTestCase.java delete mode 100644 apm-collector-3.2.3/apm-collector-core/src/test/java/org/skywalking/apm/collector/core/utils/ResourceUtilsTestCase.java delete mode 100644 apm-collector-3.2.3/apm-collector-core/src/test/java/org/skywalking/apm/collector/core/utils/TimeBucketUtilsTestCase.java delete mode 100644 apm-collector-3.2.3/apm-collector-core/src/test/resources/META-INF/defines/module.define delete mode 100644 apm-collector-3.2.3/apm-collector-core/src/test/resources/application.yml delete mode 100644 apm-collector-3.2.3/apm-collector-core/src/test/resources/logback-test.xml delete mode 100644 apm-collector-3.2.3/apm-collector-queue/pom.xml delete mode 100644 apm-collector-3.2.3/apm-collector-queue/src/main/java/org/skywalking/apm/collector/queue/QueueModuleContext.java delete mode 100644 apm-collector-3.2.3/apm-collector-queue/src/main/java/org/skywalking/apm/collector/queue/QueueModuleDefine.java delete mode 100644 apm-collector-3.2.3/apm-collector-queue/src/main/java/org/skywalking/apm/collector/queue/QueueModuleException.java delete mode 100644 apm-collector-3.2.3/apm-collector-queue/src/main/java/org/skywalking/apm/collector/queue/QueueModuleGroupDefine.java delete mode 100644 apm-collector-3.2.3/apm-collector-queue/src/main/java/org/skywalking/apm/collector/queue/QueueModuleInstaller.java delete mode 100644 apm-collector-3.2.3/apm-collector-queue/src/main/java/org/skywalking/apm/collector/queue/datacarrier/DataCarrierQueueConfigParser.java delete mode 100644 apm-collector-3.2.3/apm-collector-queue/src/main/java/org/skywalking/apm/collector/queue/datacarrier/DataCarrierQueueCreator.java delete mode 100644 apm-collector-3.2.3/apm-collector-queue/src/main/java/org/skywalking/apm/collector/queue/datacarrier/QueueDataCarrierModuleDefine.java delete mode 100644 apm-collector-3.2.3/apm-collector-queue/src/main/java/org/skywalking/apm/collector/queue/disruptor/DisruptorEventHandler.java delete mode 100644 apm-collector-3.2.3/apm-collector-queue/src/main/java/org/skywalking/apm/collector/queue/disruptor/DisruptorQueueConfigParser.java delete mode 100644 apm-collector-3.2.3/apm-collector-queue/src/main/java/org/skywalking/apm/collector/queue/disruptor/DisruptorQueueCreator.java delete mode 100644 apm-collector-3.2.3/apm-collector-queue/src/main/java/org/skywalking/apm/collector/queue/disruptor/MessageHolderFactory.java delete mode 100644 apm-collector-3.2.3/apm-collector-queue/src/main/java/org/skywalking/apm/collector/queue/disruptor/QueueDisruptorModuleDefine.java delete mode 100644 apm-collector-3.2.3/apm-collector-queue/src/main/resources/META-INF/defines/group.define delete mode 100644 apm-collector-3.2.3/apm-collector-queue/src/main/resources/META-INF/defines/module.define delete mode 100644 apm-collector-3.2.3/apm-collector-remote/pom.xml delete mode 100644 apm-collector-3.2.3/apm-collector-remote/src/main/proto/RemoteCommonService.proto delete mode 100644 apm-collector-3.2.3/apm-collector-server/pom.xml delete mode 100644 apm-collector-3.2.3/apm-collector-server/src/main/java/org/skywalking/apm/collector/server/grpc/GRPCHandler.java delete mode 100644 apm-collector-3.2.3/apm-collector-server/src/main/java/org/skywalking/apm/collector/server/grpc/GRPCServer.java delete mode 100644 apm-collector-3.2.3/apm-collector-server/src/main/java/org/skywalking/apm/collector/server/grpc/GRPCServerException.java delete mode 100644 apm-collector-3.2.3/apm-collector-server/src/main/java/org/skywalking/apm/collector/server/jetty/ArgumentsParseException.java delete mode 100644 apm-collector-3.2.3/apm-collector-server/src/main/java/org/skywalking/apm/collector/server/jetty/JettyHandler.java delete mode 100644 apm-collector-3.2.3/apm-collector-server/src/main/java/org/skywalking/apm/collector/server/jetty/JettyServer.java delete mode 100644 apm-collector-3.2.3/apm-collector-server/src/main/java/org/skywalking/apm/collector/server/jetty/JettyServerException.java delete mode 100644 apm-collector-3.2.3/apm-collector-storage/pom.xml delete mode 100644 apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/StorageModuleContext.java delete mode 100644 apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/StorageModuleDefine.java delete mode 100644 apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/StorageModuleException.java delete mode 100644 apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/StorageModuleGroupDefine.java delete mode 100644 apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/StorageModuleInstaller.java delete mode 100644 apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/dao/DAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/dao/DAOContainer.java delete mode 100644 apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/dao/IBatchDAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/Attribute.java delete mode 100644 apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/AttributeType.java delete mode 100644 apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/CommonTable.java delete mode 100644 apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/DataDefine.java delete mode 100644 apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/global/GlobalTraceDataDefine.java delete mode 100644 apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/global/GlobalTraceTable.java delete mode 100644 apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/instance/InstPerformanceDataDefine.java delete mode 100644 apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/instance/InstPerformanceTable.java delete mode 100644 apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/jvm/CpuMetricDataDefine.java delete mode 100644 apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/jvm/CpuMetricTable.java delete mode 100644 apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/jvm/GCMetricDataDefine.java delete mode 100644 apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/jvm/GCMetricTable.java delete mode 100644 apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/jvm/MemoryMetricDataDefine.java delete mode 100644 apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/jvm/MemoryMetricTable.java delete mode 100644 apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/jvm/MemoryPoolMetricDataDefine.java delete mode 100644 apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/jvm/MemoryPoolMetricTable.java delete mode 100644 apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/node/NodeComponentDataDefine.java delete mode 100644 apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/node/NodeComponentTable.java delete mode 100644 apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/node/NodeMappingDataDefine.java delete mode 100644 apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/node/NodeMappingTable.java delete mode 100644 apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/noderef/NodeReferenceDataDefine.java delete mode 100644 apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/noderef/NodeReferenceTable.java delete mode 100644 apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/register/ApplicationDataDefine.java delete mode 100644 apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/register/ApplicationTable.java delete mode 100644 apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/register/InstanceDataDefine.java delete mode 100644 apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/register/InstanceTable.java delete mode 100644 apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/register/ServiceNameDataDefine.java delete mode 100644 apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/register/ServiceNameTable.java delete mode 100644 apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/segment/SegmentCostDataDefine.java delete mode 100644 apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/segment/SegmentCostTable.java delete mode 100644 apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/segment/SegmentDataDefine.java delete mode 100644 apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/segment/SegmentTable.java delete mode 100644 apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/service/ServiceEntryDataDefine.java delete mode 100644 apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/service/ServiceEntryTable.java delete mode 100644 apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/serviceref/ServiceReferenceDataDefine.java delete mode 100644 apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/serviceref/ServiceReferenceTable.java delete mode 100644 apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/elasticsearch/ElasticSearchStorageException.java delete mode 100644 apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/elasticsearch/StorageElasticSearchConfig.java delete mode 100644 apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/elasticsearch/StorageElasticSearchConfigParser.java delete mode 100644 apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/elasticsearch/StorageElasticSearchModuleDefine.java delete mode 100644 apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/elasticsearch/dao/BatchEsDAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/elasticsearch/dao/EsDAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/elasticsearch/dao/EsDAODefineLoader.java delete mode 100644 apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/elasticsearch/dao/EsDAODefinitionFile.java delete mode 100644 apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/elasticsearch/define/ElasticSearchColumnDefine.java delete mode 100644 apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/elasticsearch/define/ElasticSearchStorageInstaller.java delete mode 100644 apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/elasticsearch/define/ElasticSearchTableDefine.java delete mode 100644 apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/h2/SqlBuilder.java delete mode 100644 apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/h2/StorageH2Config.java delete mode 100644 apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/h2/StorageH2ConfigParser.java delete mode 100644 apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/h2/StorageH2ModuleDefine.java delete mode 100644 apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/h2/dao/BatchH2DAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/h2/dao/H2DAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/h2/dao/H2DAODefineLoader.java delete mode 100644 apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/h2/dao/H2DAODefinitionFile.java delete mode 100644 apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/h2/define/H2ColumnDefine.java delete mode 100644 apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/h2/define/H2SqlEntity.java delete mode 100644 apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/h2/define/H2StorageInstaller.java delete mode 100644 apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/h2/define/H2TableDefine.java delete mode 100644 apm-collector-3.2.3/apm-collector-storage/src/main/resources/META-INF/defines/es_dao.define delete mode 100644 apm-collector-3.2.3/apm-collector-storage/src/main/resources/META-INF/defines/group.define delete mode 100644 apm-collector-3.2.3/apm-collector-storage/src/main/resources/META-INF/defines/h2_dao.define delete mode 100644 apm-collector-3.2.3/apm-collector-storage/src/main/resources/META-INF/defines/module.define delete mode 100644 apm-collector-3.2.3/apm-collector-stream/pom.xml delete mode 100644 apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/StreamModuleContext.java delete mode 100644 apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/StreamModuleDefine.java delete mode 100644 apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/StreamModuleException.java delete mode 100644 apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/StreamModuleGroupDefine.java delete mode 100644 apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/StreamModuleInstaller.java delete mode 100644 apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/grpc/StreamGRPCConfig.java delete mode 100644 apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/grpc/StreamGRPCConfigParser.java delete mode 100644 apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/grpc/StreamGRPCDataListener.java delete mode 100644 apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/grpc/StreamGRPCModuleDefine.java delete mode 100644 apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/grpc/StreamGRPCModuleRegistration.java delete mode 100644 apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/grpc/handler/RemoteCommonServiceHandler.java delete mode 100644 apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/AbstractLocalAsyncWorker.java delete mode 100644 apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/AbstractLocalAsyncWorkerProvider.java delete mode 100644 apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/AbstractRemoteWorker.java delete mode 100644 apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/AbstractRemoteWorkerProvider.java delete mode 100644 apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/AbstractWorker.java delete mode 100644 apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/AbstractWorkerProvider.java delete mode 100644 apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/ClusterWorkerContext.java delete mode 100644 apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/ClusterWorkerRefCounter.java delete mode 100644 apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/Context.java delete mode 100644 apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/LocalAsyncWorkerProviderDefineLoader.java delete mode 100644 apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/LocalAsyncWorkerRef.java delete mode 100644 apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/LocalWorkerProviderDefinitionFile.java delete mode 100644 apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/LookUp.java delete mode 100644 apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/Provider.java delete mode 100644 apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/ProviderNotFoundException.java delete mode 100644 apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/RemoteWorkerProviderDefineLoader.java delete mode 100644 apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/RemoteWorkerProviderDefinitionFile.java delete mode 100644 apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/RemoteWorkerRef.java delete mode 100644 apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/Role.java delete mode 100644 apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/UsedRoleNameException.java delete mode 100644 apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/WorkerContext.java delete mode 100644 apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/WorkerException.java delete mode 100644 apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/WorkerInvokeException.java delete mode 100644 apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/WorkerNotFoundException.java delete mode 100644 apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/WorkerRef.java delete mode 100644 apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/WorkerRefs.java delete mode 100644 apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/impl/AggregationWorker.java delete mode 100644 apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/impl/FlushAndSwitch.java delete mode 100644 apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/impl/GRPCRemoteWorker.java delete mode 100644 apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/impl/PersistenceWorker.java delete mode 100644 apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/impl/PersistenceWorkerContainer.java delete mode 100644 apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/impl/dao/IPersistenceDAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/impl/data/DataCache.java delete mode 100644 apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/impl/data/DataCollection.java delete mode 100644 apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/impl/data/Window.java delete mode 100644 apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/selector/ForeverFirstSelector.java delete mode 100644 apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/selector/HashCodeSelector.java delete mode 100644 apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/selector/RollingSelector.java delete mode 100644 apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/selector/WorkerSelector.java delete mode 100644 apm-collector-3.2.3/apm-collector-stream/src/main/resources/META-INF/defines/group.define delete mode 100644 apm-collector-3.2.3/apm-collector-stream/src/main/resources/META-INF/defines/module.define delete mode 100644 apm-collector-3.2.3/apm-collector-stream/src/test/java/org/skywalking/apm/collector/stream/worker/util/TimeBucketUtilsTestCase.java delete mode 100644 apm-collector-3.2.3/apm-collector-ui/pom.xml delete mode 100644 apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/UIModuleContext.java delete mode 100644 apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/UIModuleDefine.java delete mode 100644 apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/UIModuleException.java delete mode 100644 apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/UIModuleGroupDefine.java delete mode 100644 apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/UIModuleInstaller.java delete mode 100644 apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/CpuMetricEsDAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/CpuMetricH2DAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/GCMetricEsDAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/GCMetricH2DAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/GlobalTraceEsDAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/GlobalTraceH2DAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/ICpuMetricDAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/IGCMetricDAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/IGlobalTraceDAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/IInstPerformanceDAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/IInstanceDAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/IMemoryMetricDAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/IMemoryPoolMetricDAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/INodeComponentDAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/INodeMappingDAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/INodeReferenceDAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/ISegmentCostDAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/ISegmentDAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/IServiceEntryDAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/IServiceReferenceDAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/InstPerformanceEsDAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/InstPerformanceH2DAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/InstanceEsDAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/InstanceH2DAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/MemoryMetricEsDAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/MemoryMetricH2DAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/MemoryPoolMetricEsDAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/MemoryPoolMetricH2DAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/NodeComponentEsDAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/NodeComponentH2DAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/NodeMappingEsDAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/NodeMappingH2DAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/NodeReferenceEsDAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/NodeReferenceH2DAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/SegmentCostEsDAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/SegmentCostH2DAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/SegmentEsDAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/SegmentH2DAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/ServiceEntryEsDAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/ServiceEntryH2DAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/ServiceReferenceEsDAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/ServiceReferenceH2DAO.java delete mode 100644 apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/jetty/UIJettyConfig.java delete mode 100644 apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/jetty/UIJettyConfigParser.java delete mode 100644 apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/jetty/UIJettyDataListener.java delete mode 100644 apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/jetty/UIJettyModuleDefine.java delete mode 100644 apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/jetty/UIJettyModuleRegistration.java delete mode 100644 apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/jetty/handler/SegmentTopGetHandler.java delete mode 100644 apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/jetty/handler/SpanGetHandler.java delete mode 100644 apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/jetty/handler/TraceDagGetHandler.java delete mode 100644 apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/jetty/handler/TraceStackGetHandler.java delete mode 100644 apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/jetty/handler/application/ApplicationsGetHandler.java delete mode 100644 apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/jetty/handler/instancehealth/InstanceHealthGetHandler.java delete mode 100644 apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/jetty/handler/instancemetric/InstanceMetricGetOneTimeBucketHandler.java delete mode 100644 apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/jetty/handler/instancemetric/InstanceMetricGetRangeTimeBucketHandler.java delete mode 100644 apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/jetty/handler/instancemetric/InstanceOsInfoGetHandler.java delete mode 100644 apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/jetty/handler/servicetree/EntryServiceGetHandler.java delete mode 100644 apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/jetty/handler/servicetree/ServiceTreeGetByIdHandler.java delete mode 100644 apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/jetty/handler/time/AllInstanceLastTimeGetHandler.java delete mode 100644 apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/jetty/handler/time/OneInstanceLastTimeGetHandler.java delete mode 100644 apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/service/ApplicationService.java delete mode 100644 apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/service/InstanceHealthService.java delete mode 100644 apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/service/InstanceJVMService.java delete mode 100644 apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/service/SegmentTopService.java delete mode 100644 apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/service/ServiceTreeService.java delete mode 100644 apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/service/SpanService.java delete mode 100644 apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/service/TimeSynchronousService.java delete mode 100644 apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/service/TraceDagDataBuilder.java delete mode 100644 apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/service/TraceDagService.java delete mode 100644 apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/service/TraceStackService.java delete mode 100644 apm-collector-3.2.3/apm-collector-ui/src/main/resources/META-INF/defines/es_dao.define delete mode 100644 apm-collector-3.2.3/apm-collector-ui/src/main/resources/META-INF/defines/group.define delete mode 100644 apm-collector-3.2.3/apm-collector-ui/src/main/resources/META-INF/defines/h2_dao.define delete mode 100644 apm-collector-3.2.3/apm-collector-ui/src/main/resources/META-INF/defines/module.define delete mode 100644 apm-collector-3.2.3/pom.xml diff --git a/apm-collector-3.2.3/apm-collector-agentjvm/pom.xml b/apm-collector-3.2.3/apm-collector-agentjvm/pom.xml deleted file mode 100644 index 1eaee624a8..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentjvm/pom.xml +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - apm-collector-3.2.3 - org.skywalking - 3.2.4-2017 - - 4.0.0 - - apm-collector-3.2.3-agentjvm - jar - - - - org.skywalking - apm-collector-3.2.3-stream - ${project.version} - - - org.skywalking - apm-collector-3.2.3-cluster - ${project.version} - - - org.skywalking - apm-collector-3.2.3-server - ${project.version} - - - org.skywalking - apm-collector-3.2.3-storage - ${project.version} - - - diff --git a/apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/grpc/handler/JVMMetricsServiceHandler.java b/apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/grpc/handler/JVMMetricsServiceHandler.java deleted file mode 100644 index a4bb885baa..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/grpc/handler/JVMMetricsServiceHandler.java +++ /dev/null @@ -1,167 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentjvm.grpc.handler; - -import io.grpc.stub.StreamObserver; -import java.util.List; -import org.skywalking.apm.collector.agentjvm.worker.cpu.CpuMetricPersistenceWorker; -import org.skywalking.apm.collector.agentjvm.worker.gc.GCMetricPersistenceWorker; -import org.skywalking.apm.collector.agentjvm.worker.heartbeat.InstHeartBeatPersistenceWorker; -import org.skywalking.apm.collector.agentjvm.worker.heartbeat.define.InstanceHeartBeatDataDefine; -import org.skywalking.apm.collector.agentjvm.worker.memory.MemoryMetricPersistenceWorker; -import org.skywalking.apm.collector.agentjvm.worker.memorypool.MemoryPoolMetricPersistenceWorker; -import org.skywalking.apm.collector.core.framework.CollectorContextHelper; -import org.skywalking.apm.collector.core.util.Const; -import org.skywalking.apm.collector.core.util.TimeBucketUtils; -import org.skywalking.apm.collector.server.grpc.GRPCHandler; -import org.skywalking.apm.collector.storage.base.define.jvm.CpuMetricDataDefine; -import org.skywalking.apm.collector.storage.base.define.jvm.GCMetricDataDefine; -import org.skywalking.apm.collector.storage.base.define.jvm.MemoryMetricDataDefine; -import org.skywalking.apm.collector.storage.base.define.jvm.MemoryPoolMetricDataDefine; -import org.skywalking.apm.collector.stream.StreamModuleContext; -import org.skywalking.apm.collector.stream.StreamModuleGroupDefine; -import org.skywalking.apm.collector.stream.worker.WorkerInvokeException; -import org.skywalking.apm.collector.stream.worker.WorkerNotFoundException; -import org.skywalking.apm.network.proto.CPU; -import org.skywalking.apm.network.proto.Downstream; -import org.skywalking.apm.network.proto.GC; -import org.skywalking.apm.network.proto.JVMMetrics; -import org.skywalking.apm.network.proto.JVMMetricsServiceGrpc; -import org.skywalking.apm.network.proto.Memory; -import org.skywalking.apm.network.proto.MemoryPool; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class JVMMetricsServiceHandler extends JVMMetricsServiceGrpc.JVMMetricsServiceImplBase implements GRPCHandler { - - private final Logger logger = LoggerFactory.getLogger(JVMMetricsServiceHandler.class); - - @Override public void collect(JVMMetrics request, StreamObserver responseObserver) { - int instanceId = request.getApplicationInstanceId(); - logger.debug("receive the jvm metric from application instance, id: {}", instanceId); - - StreamModuleContext context = (StreamModuleContext)CollectorContextHelper.INSTANCE.getContext(StreamModuleGroupDefine.GROUP_NAME); - request.getMetricsList().forEach(metric -> { - long time = TimeBucketUtils.INSTANCE.getSecondTimeBucket(metric.getTime()); - senToInstanceHeartBeatPersistenceWorker(context, instanceId, metric.getTime()); - sendToCpuMetricPersistenceWorker(context, instanceId, time, metric.getCpu()); - sendToMemoryMetricPersistenceWorker(context, instanceId, time, metric.getMemoryList()); - sendToMemoryPoolMetricPersistenceWorker(context, instanceId, time, metric.getMemoryPoolList()); - sendToGCMetricPersistenceWorker(context, instanceId, time, metric.getGcList()); - }); - - responseObserver.onNext(Downstream.newBuilder().build()); - responseObserver.onCompleted(); - } - - private void senToInstanceHeartBeatPersistenceWorker(StreamModuleContext context, int instanceId, - long heartBeatTime) { - InstanceHeartBeatDataDefine.InstanceHeartBeat heartBeat = new InstanceHeartBeatDataDefine.InstanceHeartBeat(); - heartBeat.setId(String.valueOf(instanceId)); - heartBeat.setHeartBeatTime(TimeBucketUtils.INSTANCE.getSecondTimeBucket(heartBeatTime)); - heartBeat.setInstanceId(instanceId); - try { - logger.debug("send to instance heart beat persistence worker, id: {}", heartBeat.getId()); - context.getClusterWorkerContext().lookup(InstHeartBeatPersistenceWorker.WorkerRole.INSTANCE).tell(heartBeat.toData()); - } catch (WorkerInvokeException | WorkerNotFoundException e) { - logger.error(e.getMessage(), e); - } - } - - private void sendToCpuMetricPersistenceWorker(StreamModuleContext context, int instanceId, - long timeBucket, CPU cpu) { - CpuMetricDataDefine.CpuMetric cpuMetric = new CpuMetricDataDefine.CpuMetric(); - cpuMetric.setId(timeBucket + Const.ID_SPLIT + instanceId); - cpuMetric.setInstanceId(instanceId); - cpuMetric.setUsagePercent(cpu.getUsagePercent()); - cpuMetric.setTimeBucket(timeBucket); - try { - logger.debug("send to cpu metric persistence worker, id: {}", cpuMetric.getId()); - context.getClusterWorkerContext().lookup(CpuMetricPersistenceWorker.WorkerRole.INSTANCE).tell(cpuMetric.toData()); - } catch (WorkerInvokeException | WorkerNotFoundException e) { - logger.error(e.getMessage(), e); - } - } - - private void sendToMemoryMetricPersistenceWorker(StreamModuleContext context, int instanceId, - long timeBucket, List memories) { - - memories.forEach(memory -> { - MemoryMetricDataDefine.MemoryMetric memoryMetric = new MemoryMetricDataDefine.MemoryMetric(); - memoryMetric.setId(timeBucket + Const.ID_SPLIT + instanceId + Const.ID_SPLIT + String.valueOf(memory.getIsHeap())); - memoryMetric.setApplicationInstanceId(instanceId); - memoryMetric.setHeap(memory.getIsHeap()); - memoryMetric.setInit(memory.getInit()); - memoryMetric.setMax(memory.getMax()); - memoryMetric.setUsed(memory.getUsed()); - memoryMetric.setCommitted(memory.getCommitted()); - memoryMetric.setTimeBucket(timeBucket); - try { - logger.debug("send to memory metric persistence worker, id: {}", memoryMetric.getId()); - context.getClusterWorkerContext().lookup(MemoryMetricPersistenceWorker.WorkerRole.INSTANCE).tell(memoryMetric.toData()); - } catch (WorkerInvokeException | WorkerNotFoundException e) { - logger.error(e.getMessage(), e); - } - }); - } - - private void sendToMemoryPoolMetricPersistenceWorker(StreamModuleContext context, int instanceId, - long timeBucket, List memoryPools) { - - memoryPools.forEach(memoryPool -> { - MemoryPoolMetricDataDefine.MemoryPoolMetric memoryPoolMetric = new MemoryPoolMetricDataDefine.MemoryPoolMetric(); - memoryPoolMetric.setId(timeBucket + Const.ID_SPLIT + instanceId + Const.ID_SPLIT + String.valueOf(memoryPool.getType().getNumber())); - memoryPoolMetric.setInstanceId(instanceId); - memoryPoolMetric.setPoolType(memoryPool.getType().getNumber()); - memoryPoolMetric.setInit(memoryPool.getInit()); - memoryPoolMetric.setMax(memoryPool.getMax()); - memoryPoolMetric.setUsed(memoryPool.getUsed()); - memoryPoolMetric.setCommitted(memoryPool.getCommited()); - memoryPoolMetric.setTimeBucket(timeBucket); - try { - logger.debug("send to memory pool metric persistence worker, id: {}", memoryPoolMetric.getId()); - context.getClusterWorkerContext().lookup(MemoryPoolMetricPersistenceWorker.WorkerRole.INSTANCE).tell(memoryPoolMetric.toData()); - } catch (WorkerInvokeException | WorkerNotFoundException e) { - logger.error(e.getMessage(), e); - } - }); - } - - private void sendToGCMetricPersistenceWorker(StreamModuleContext context, int instanceId, - long timeBucket, List gcs) { - gcs.forEach(gc -> { - GCMetricDataDefine.GCMetric gcMetric = new GCMetricDataDefine.GCMetric(); - gcMetric.setId(timeBucket + Const.ID_SPLIT + instanceId + Const.ID_SPLIT + String.valueOf(gc.getPhraseValue())); - gcMetric.setInstanceId(instanceId); - gcMetric.setPhrase(gc.getPhraseValue()); - gcMetric.setCount(gc.getCount()); - gcMetric.setTime(gc.getTime()); - gcMetric.setTimeBucket(timeBucket); - try { - logger.debug("send to gc metric persistence worker, id: {}", gcMetric.getId()); - context.getClusterWorkerContext().lookup(GCMetricPersistenceWorker.WorkerRole.INSTANCE).tell(gcMetric.toData()); - } catch (WorkerInvokeException | WorkerNotFoundException e) { - logger.error(e.getMessage(), e); - } - }); - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/cpu/CpuMetricPersistenceWorker.java b/apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/cpu/CpuMetricPersistenceWorker.java deleted file mode 100644 index 305c5fa436..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/cpu/CpuMetricPersistenceWorker.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentjvm.worker.cpu; - -import org.skywalking.apm.collector.agentjvm.worker.cpu.dao.ICpuMetricDAO; -import org.skywalking.apm.collector.storage.base.dao.DAOContainer; -import org.skywalking.apm.collector.storage.base.define.DataDefine; -import org.skywalking.apm.collector.storage.base.define.jvm.CpuMetricDataDefine; -import org.skywalking.apm.collector.stream.worker.AbstractLocalAsyncWorkerProvider; -import org.skywalking.apm.collector.stream.worker.ClusterWorkerContext; -import org.skywalking.apm.collector.stream.worker.ProviderNotFoundException; -import org.skywalking.apm.collector.stream.worker.Role; -import org.skywalking.apm.collector.stream.worker.impl.PersistenceWorker; -import org.skywalking.apm.collector.stream.worker.impl.dao.IPersistenceDAO; -import org.skywalking.apm.collector.stream.worker.selector.RollingSelector; -import org.skywalking.apm.collector.stream.worker.selector.WorkerSelector; - -/** - * @author peng-yongsheng - */ -public class CpuMetricPersistenceWorker extends PersistenceWorker { - - public CpuMetricPersistenceWorker(Role role, ClusterWorkerContext clusterContext) { - super(role, clusterContext); - } - - @Override public void preStart() throws ProviderNotFoundException { - super.preStart(); - } - - @Override protected boolean needMergeDBData() { - return false; - } - - @Override protected IPersistenceDAO persistenceDAO() { - return (IPersistenceDAO)DAOContainer.INSTANCE.get(ICpuMetricDAO.class.getName()); - } - - public static class Factory extends AbstractLocalAsyncWorkerProvider { - @Override - public Role role() { - return WorkerRole.INSTANCE; - } - - @Override - public CpuMetricPersistenceWorker workerInstance(ClusterWorkerContext clusterContext) { - return new CpuMetricPersistenceWorker(role(), clusterContext); - } - - @Override - public int queueSize() { - return 1024; - } - } - - public enum WorkerRole implements Role { - INSTANCE; - - @Override - public String roleName() { - return CpuMetricPersistenceWorker.class.getSimpleName(); - } - - @Override - public WorkerSelector workerSelector() { - return new RollingSelector(); - } - - @Override public DataDefine dataDefine() { - return new CpuMetricDataDefine(); - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/cpu/dao/CpuMetricEsDAO.java b/apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/cpu/dao/CpuMetricEsDAO.java deleted file mode 100644 index bf88592151..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/cpu/dao/CpuMetricEsDAO.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentjvm.worker.cpu.dao; - -import java.util.HashMap; -import java.util.Map; -import org.elasticsearch.action.index.IndexRequestBuilder; -import org.elasticsearch.action.update.UpdateRequestBuilder; -import org.skywalking.apm.collector.core.stream.Data; -import org.skywalking.apm.collector.storage.base.define.DataDefine; -import org.skywalking.apm.collector.storage.base.define.jvm.CpuMetricTable; -import org.skywalking.apm.collector.storage.elasticsearch.dao.EsDAO; -import org.skywalking.apm.collector.stream.worker.impl.dao.IPersistenceDAO; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class CpuMetricEsDAO extends EsDAO implements ICpuMetricDAO, IPersistenceDAO { - - private final Logger logger = LoggerFactory.getLogger(CpuMetricEsDAO.class); - - @Override public Data get(String id, DataDefine dataDefine) { - return null; - } - - @Override public IndexRequestBuilder prepareBatchInsert(Data data) { - Map source = new HashMap<>(); - source.put(CpuMetricTable.COLUMN_INSTANCE_ID, data.getDataInteger(0)); - source.put(CpuMetricTable.COLUMN_USAGE_PERCENT, data.getDataDouble(0)); - source.put(CpuMetricTable.COLUMN_TIME_BUCKET, data.getDataLong(0)); - - logger.debug("prepare cpu metric batch insert, id: {}", data.getDataString(0)); - return getClient().prepareIndex(CpuMetricTable.TABLE, data.getDataString(0)).setSource(source); - } - - @Override public UpdateRequestBuilder prepareBatchUpdate(Data data) { - return null; - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/cpu/dao/CpuMetricH2DAO.java b/apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/cpu/dao/CpuMetricH2DAO.java deleted file mode 100644 index afc8eec289..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/cpu/dao/CpuMetricH2DAO.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentjvm.worker.cpu.dao; - -import java.util.HashMap; -import java.util.Map; -import org.skywalking.apm.collector.core.stream.Data; -import org.skywalking.apm.collector.storage.base.define.DataDefine; -import org.skywalking.apm.collector.storage.base.define.jvm.CpuMetricTable; -import org.skywalking.apm.collector.storage.h2.SqlBuilder; -import org.skywalking.apm.collector.storage.h2.base.dao.H2DAO; -import org.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; -import org.skywalking.apm.collector.stream.worker.impl.dao.IPersistenceDAO; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng, clevertension - */ -public class CpuMetricH2DAO extends H2DAO implements ICpuMetricDAO, IPersistenceDAO { - private final Logger logger = LoggerFactory.getLogger(CpuMetricH2DAO.class); - - @Override public Data get(String id, DataDefine dataDefine) { - return null; - } - - @Override public H2SqlEntity prepareBatchInsert(Data data) { - H2SqlEntity entity = new H2SqlEntity(); - Map source = new HashMap<>(); - source.put(CpuMetricTable.COLUMN_ID, data.getDataString(0)); - source.put(CpuMetricTable.COLUMN_INSTANCE_ID, data.getDataInteger(0)); - source.put(CpuMetricTable.COLUMN_USAGE_PERCENT, data.getDataDouble(0)); - source.put(CpuMetricTable.COLUMN_TIME_BUCKET, data.getDataLong(0)); - - logger.debug("prepare cpu metric batch insert, id: {}", data.getDataString(0)); - String sql = SqlBuilder.buildBatchInsertSql(CpuMetricTable.TABLE, source.keySet()); - entity.setSql(sql); - entity.setParams(source.values().toArray(new Object[0])); - return entity; - } - - @Override public H2SqlEntity prepareBatchUpdate(Data data) { - return null; - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/cpu/dao/ICpuMetricDAO.java b/apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/cpu/dao/ICpuMetricDAO.java deleted file mode 100644 index 03672b4504..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/cpu/dao/ICpuMetricDAO.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentjvm.worker.cpu.dao; - -/** - * @author peng-yongsheng - */ -public interface ICpuMetricDAO { -} diff --git a/apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/cpu/define/CpuMetricEsTableDefine.java b/apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/cpu/define/CpuMetricEsTableDefine.java deleted file mode 100644 index e401b8dd9e..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/cpu/define/CpuMetricEsTableDefine.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentjvm.worker.cpu.define; - -import org.skywalking.apm.collector.storage.base.define.jvm.CpuMetricTable; -import org.skywalking.apm.collector.storage.elasticsearch.define.ElasticSearchColumnDefine; -import org.skywalking.apm.collector.storage.elasticsearch.define.ElasticSearchTableDefine; - -/** - * @author peng-yongsheng - */ -public class CpuMetricEsTableDefine extends ElasticSearchTableDefine { - - public CpuMetricEsTableDefine() { - super(CpuMetricTable.TABLE); - } - - @Override public int refreshInterval() { - return 1; - } - - @Override public void initialize() { - addColumn(new ElasticSearchColumnDefine(CpuMetricTable.COLUMN_INSTANCE_ID, ElasticSearchColumnDefine.Type.Integer.name())); - addColumn(new ElasticSearchColumnDefine(CpuMetricTable.COLUMN_USAGE_PERCENT, ElasticSearchColumnDefine.Type.Double.name())); - addColumn(new ElasticSearchColumnDefine(CpuMetricTable.COLUMN_TIME_BUCKET, ElasticSearchColumnDefine.Type.Long.name())); - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/cpu/define/CpuMetricH2TableDefine.java b/apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/cpu/define/CpuMetricH2TableDefine.java deleted file mode 100644 index 5f41ea05bd..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/cpu/define/CpuMetricH2TableDefine.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentjvm.worker.cpu.define; - -import org.skywalking.apm.collector.storage.base.define.jvm.CpuMetricTable; -import org.skywalking.apm.collector.storage.h2.base.define.H2ColumnDefine; -import org.skywalking.apm.collector.storage.h2.base.define.H2TableDefine; - -/** - * @author peng-yongsheng - */ -public class CpuMetricH2TableDefine extends H2TableDefine { - - public CpuMetricH2TableDefine() { - super(CpuMetricTable.TABLE); - } - - @Override public void initialize() { - addColumn(new H2ColumnDefine(CpuMetricTable.COLUMN_ID, H2ColumnDefine.Type.Varchar.name())); - addColumn(new H2ColumnDefine(CpuMetricTable.COLUMN_INSTANCE_ID, H2ColumnDefine.Type.Int.name())); - addColumn(new H2ColumnDefine(CpuMetricTable.COLUMN_USAGE_PERCENT, H2ColumnDefine.Type.Double.name())); - addColumn(new H2ColumnDefine(CpuMetricTable.COLUMN_TIME_BUCKET, H2ColumnDefine.Type.Bigint.name())); - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/gc/GCMetricPersistenceWorker.java b/apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/gc/GCMetricPersistenceWorker.java deleted file mode 100644 index e8171c0d72..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/gc/GCMetricPersistenceWorker.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentjvm.worker.gc; - -import org.skywalking.apm.collector.agentjvm.worker.gc.dao.IGCMetricDAO; -import org.skywalking.apm.collector.storage.base.dao.DAOContainer; -import org.skywalking.apm.collector.storage.base.define.DataDefine; -import org.skywalking.apm.collector.storage.base.define.jvm.GCMetricDataDefine; -import org.skywalking.apm.collector.stream.worker.AbstractLocalAsyncWorkerProvider; -import org.skywalking.apm.collector.stream.worker.ClusterWorkerContext; -import org.skywalking.apm.collector.stream.worker.ProviderNotFoundException; -import org.skywalking.apm.collector.stream.worker.Role; -import org.skywalking.apm.collector.stream.worker.impl.PersistenceWorker; -import org.skywalking.apm.collector.stream.worker.impl.dao.IPersistenceDAO; -import org.skywalking.apm.collector.stream.worker.selector.RollingSelector; -import org.skywalking.apm.collector.stream.worker.selector.WorkerSelector; - -/** - * @author peng-yongsheng - */ -public class GCMetricPersistenceWorker extends PersistenceWorker { - - public GCMetricPersistenceWorker(Role role, ClusterWorkerContext clusterContext) { - super(role, clusterContext); - } - - @Override public void preStart() throws ProviderNotFoundException { - super.preStart(); - } - - @Override protected boolean needMergeDBData() { - return false; - } - - @Override protected IPersistenceDAO persistenceDAO() { - return (IPersistenceDAO)DAOContainer.INSTANCE.get(IGCMetricDAO.class.getName()); - } - - public static class Factory extends AbstractLocalAsyncWorkerProvider { - @Override - public Role role() { - return WorkerRole.INSTANCE; - } - - @Override - public GCMetricPersistenceWorker workerInstance(ClusterWorkerContext clusterContext) { - return new GCMetricPersistenceWorker(role(), clusterContext); - } - - @Override - public int queueSize() { - return 1024; - } - } - - public enum WorkerRole implements Role { - INSTANCE; - - @Override - public String roleName() { - return GCMetricPersistenceWorker.class.getSimpleName(); - } - - @Override - public WorkerSelector workerSelector() { - return new RollingSelector(); - } - - @Override public DataDefine dataDefine() { - return new GCMetricDataDefine(); - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/gc/dao/GCMetricEsDAO.java b/apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/gc/dao/GCMetricEsDAO.java deleted file mode 100644 index 063cd22162..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/gc/dao/GCMetricEsDAO.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentjvm.worker.gc.dao; - -import java.util.HashMap; -import java.util.Map; -import org.elasticsearch.action.index.IndexRequestBuilder; -import org.elasticsearch.action.update.UpdateRequestBuilder; -import org.skywalking.apm.collector.core.stream.Data; -import org.skywalking.apm.collector.storage.base.define.DataDefine; -import org.skywalking.apm.collector.storage.base.define.jvm.GCMetricTable; -import org.skywalking.apm.collector.storage.elasticsearch.dao.EsDAO; -import org.skywalking.apm.collector.stream.worker.impl.dao.IPersistenceDAO; - -/** - * @author peng-yongsheng - */ -public class GCMetricEsDAO extends EsDAO implements IGCMetricDAO, IPersistenceDAO { - - @Override public Data get(String id, DataDefine dataDefine) { - return null; - } - - @Override public IndexRequestBuilder prepareBatchInsert(Data data) { - Map source = new HashMap<>(); - source.put(GCMetricTable.COLUMN_INSTANCE_ID, data.getDataInteger(0)); - source.put(GCMetricTable.COLUMN_PHRASE, data.getDataInteger(1)); - source.put(GCMetricTable.COLUMN_COUNT, data.getDataLong(0)); - source.put(GCMetricTable.COLUMN_TIME, data.getDataLong(1)); - source.put(GCMetricTable.COLUMN_TIME_BUCKET, data.getDataLong(2)); - - return getClient().prepareIndex(GCMetricTable.TABLE, data.getDataString(0)).setSource(source); - } - - @Override public UpdateRequestBuilder prepareBatchUpdate(Data data) { - return null; - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/gc/dao/GCMetricH2DAO.java b/apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/gc/dao/GCMetricH2DAO.java deleted file mode 100644 index e96576b5ae..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/gc/dao/GCMetricH2DAO.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentjvm.worker.gc.dao; - -import java.util.HashMap; -import java.util.Map; -import org.skywalking.apm.collector.core.stream.Data; -import org.skywalking.apm.collector.storage.base.define.DataDefine; -import org.skywalking.apm.collector.storage.base.define.jvm.GCMetricTable; -import org.skywalking.apm.collector.storage.h2.SqlBuilder; -import org.skywalking.apm.collector.storage.h2.base.dao.H2DAO; -import org.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; -import org.skywalking.apm.collector.stream.worker.impl.dao.IPersistenceDAO; - -/** - * @author peng-yongsheng, clevertension - */ -public class GCMetricH2DAO extends H2DAO implements IGCMetricDAO, IPersistenceDAO { - @Override public Data get(String id, DataDefine dataDefine) { - return null; - } - - @Override public H2SqlEntity prepareBatchInsert(Data data) { - H2SqlEntity entity = new H2SqlEntity(); - Map source = new HashMap<>(); - source.put(GCMetricTable.COLUMN_ID, data.getDataString(0)); - source.put(GCMetricTable.COLUMN_INSTANCE_ID, data.getDataInteger(0)); - source.put(GCMetricTable.COLUMN_PHRASE, data.getDataInteger(1)); - source.put(GCMetricTable.COLUMN_COUNT, data.getDataLong(0)); - source.put(GCMetricTable.COLUMN_TIME, data.getDataLong(1)); - source.put(GCMetricTable.COLUMN_TIME_BUCKET, data.getDataLong(2)); - - String sql = SqlBuilder.buildBatchInsertSql(GCMetricTable.TABLE, source.keySet()); - entity.setSql(sql); - entity.setParams(source.values().toArray(new Object[0])); - return entity; - } - - @Override public H2SqlEntity prepareBatchUpdate(Data data) { - return null; - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/gc/dao/IGCMetricDAO.java b/apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/gc/dao/IGCMetricDAO.java deleted file mode 100644 index 3a3f216e63..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/gc/dao/IGCMetricDAO.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentjvm.worker.gc.dao; - -/** - * @author peng-yongsheng - */ -public interface IGCMetricDAO { -} diff --git a/apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/gc/define/GCMetricEsTableDefine.java b/apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/gc/define/GCMetricEsTableDefine.java deleted file mode 100644 index 002aceed2b..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/gc/define/GCMetricEsTableDefine.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentjvm.worker.gc.define; - -import org.skywalking.apm.collector.storage.base.define.jvm.GCMetricTable; -import org.skywalking.apm.collector.storage.elasticsearch.define.ElasticSearchColumnDefine; -import org.skywalking.apm.collector.storage.elasticsearch.define.ElasticSearchTableDefine; - -/** - * @author peng-yongsheng - */ -public class GCMetricEsTableDefine extends ElasticSearchTableDefine { - - public GCMetricEsTableDefine() { - super(GCMetricTable.TABLE); - } - - @Override public int refreshInterval() { - return 1; - } - - @Override public void initialize() { - addColumn(new ElasticSearchColumnDefine(GCMetricTable.COLUMN_INSTANCE_ID, ElasticSearchColumnDefine.Type.Integer.name())); - addColumn(new ElasticSearchColumnDefine(GCMetricTable.COLUMN_PHRASE, ElasticSearchColumnDefine.Type.Integer.name())); - addColumn(new ElasticSearchColumnDefine(GCMetricTable.COLUMN_COUNT, ElasticSearchColumnDefine.Type.Long.name())); - addColumn(new ElasticSearchColumnDefine(GCMetricTable.COLUMN_TIME, ElasticSearchColumnDefine.Type.Long.name())); - addColumn(new ElasticSearchColumnDefine(GCMetricTable.COLUMN_TIME_BUCKET, ElasticSearchColumnDefine.Type.Long.name())); - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/gc/define/GCMetricH2TableDefine.java b/apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/gc/define/GCMetricH2TableDefine.java deleted file mode 100644 index de1d236d62..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/gc/define/GCMetricH2TableDefine.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentjvm.worker.gc.define; - -import org.skywalking.apm.collector.storage.base.define.jvm.GCMetricTable; -import org.skywalking.apm.collector.storage.h2.base.define.H2ColumnDefine; -import org.skywalking.apm.collector.storage.h2.base.define.H2TableDefine; - -/** - * @author peng-yongsheng - */ -public class GCMetricH2TableDefine extends H2TableDefine { - - public GCMetricH2TableDefine() { - super(GCMetricTable.TABLE); - } - - @Override public void initialize() { - addColumn(new H2ColumnDefine(GCMetricTable.COLUMN_ID, H2ColumnDefine.Type.Varchar.name())); - addColumn(new H2ColumnDefine(GCMetricTable.COLUMN_INSTANCE_ID, H2ColumnDefine.Type.Int.name())); - addColumn(new H2ColumnDefine(GCMetricTable.COLUMN_PHRASE, H2ColumnDefine.Type.Int.name())); - addColumn(new H2ColumnDefine(GCMetricTable.COLUMN_COUNT, H2ColumnDefine.Type.Bigint.name())); - addColumn(new H2ColumnDefine(GCMetricTable.COLUMN_TIME, H2ColumnDefine.Type.Bigint.name())); - addColumn(new H2ColumnDefine(GCMetricTable.COLUMN_TIME_BUCKET, H2ColumnDefine.Type.Bigint.name())); - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/heartbeat/InstHeartBeatPersistenceWorker.java b/apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/heartbeat/InstHeartBeatPersistenceWorker.java deleted file mode 100644 index 095c1e6bbe..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/heartbeat/InstHeartBeatPersistenceWorker.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentjvm.worker.heartbeat; - -import org.skywalking.apm.collector.agentjvm.worker.heartbeat.dao.IInstanceHeartBeatDAO; -import org.skywalking.apm.collector.agentjvm.worker.heartbeat.define.InstanceHeartBeatDataDefine; -import org.skywalking.apm.collector.storage.base.dao.DAOContainer; -import org.skywalking.apm.collector.storage.base.define.DataDefine; -import org.skywalking.apm.collector.stream.worker.AbstractLocalAsyncWorkerProvider; -import org.skywalking.apm.collector.stream.worker.ClusterWorkerContext; -import org.skywalking.apm.collector.stream.worker.ProviderNotFoundException; -import org.skywalking.apm.collector.stream.worker.Role; -import org.skywalking.apm.collector.stream.worker.impl.PersistenceWorker; -import org.skywalking.apm.collector.stream.worker.impl.dao.IPersistenceDAO; -import org.skywalking.apm.collector.stream.worker.selector.RollingSelector; -import org.skywalking.apm.collector.stream.worker.selector.WorkerSelector; - -/** - * @author peng-yongsheng - */ -public class InstHeartBeatPersistenceWorker extends PersistenceWorker { - - public InstHeartBeatPersistenceWorker(Role role, ClusterWorkerContext clusterContext) { - super(role, clusterContext); - } - - @Override public void preStart() throws ProviderNotFoundException { - super.preStart(); - } - - @Override protected boolean needMergeDBData() { - return true; - } - - @Override protected IPersistenceDAO persistenceDAO() { - return (IPersistenceDAO)DAOContainer.INSTANCE.get(IInstanceHeartBeatDAO.class.getName()); - } - - public static class Factory extends AbstractLocalAsyncWorkerProvider { - @Override - public Role role() { - return WorkerRole.INSTANCE; - } - - @Override - public InstHeartBeatPersistenceWorker workerInstance(ClusterWorkerContext clusterContext) { - return new InstHeartBeatPersistenceWorker(role(), clusterContext); - } - - @Override - public int queueSize() { - return 1024; - } - } - - public enum WorkerRole implements Role { - INSTANCE; - - @Override - public String roleName() { - return InstHeartBeatPersistenceWorker.class.getSimpleName(); - } - - @Override - public WorkerSelector workerSelector() { - return new RollingSelector(); - } - - @Override public DataDefine dataDefine() { - return new InstanceHeartBeatDataDefine(); - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/heartbeat/dao/IInstanceHeartBeatDAO.java b/apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/heartbeat/dao/IInstanceHeartBeatDAO.java deleted file mode 100644 index 31603c96fc..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/heartbeat/dao/IInstanceHeartBeatDAO.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentjvm.worker.heartbeat.dao; - -/** - * @author peng-yongsheng - */ -public interface IInstanceHeartBeatDAO { -} \ No newline at end of file diff --git a/apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/heartbeat/dao/InstanceHeartBeatEsDAO.java b/apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/heartbeat/dao/InstanceHeartBeatEsDAO.java deleted file mode 100644 index 421e8d59e3..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/heartbeat/dao/InstanceHeartBeatEsDAO.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentjvm.worker.heartbeat.dao; - -import java.util.HashMap; -import java.util.Map; -import org.elasticsearch.action.get.GetResponse; -import org.elasticsearch.action.index.IndexRequestBuilder; -import org.elasticsearch.action.update.UpdateRequestBuilder; -import org.skywalking.apm.collector.core.framework.UnexpectedException; -import org.skywalking.apm.collector.core.stream.Data; -import org.skywalking.apm.collector.storage.base.define.DataDefine; -import org.skywalking.apm.collector.storage.base.define.register.InstanceTable; -import org.skywalking.apm.collector.storage.elasticsearch.dao.EsDAO; -import org.skywalking.apm.collector.stream.worker.impl.dao.IPersistenceDAO; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class InstanceHeartBeatEsDAO extends EsDAO implements IInstanceHeartBeatDAO, IPersistenceDAO { - - private final Logger logger = LoggerFactory.getLogger(InstanceHeartBeatEsDAO.class); - - @Override public Data get(String id, DataDefine dataDefine) { - GetResponse getResponse = getClient().prepareGet(InstanceTable.TABLE, id).get(); - if (getResponse.isExists()) { - Data data = dataDefine.build(id); - Map source = getResponse.getSource(); - data.setDataInteger(0, (Integer)source.get(InstanceTable.COLUMN_INSTANCE_ID)); - data.setDataLong(0, (Long)source.get(InstanceTable.COLUMN_HEARTBEAT_TIME)); - logger.debug("id: {} is exists", id); - return data; - } else { - logger.debug("id: {} is not exists", id); - return null; - } - } - - @Override public IndexRequestBuilder prepareBatchInsert(Data data) { - throw new UnexpectedException("There is no need to merge stream data with database data."); - } - - @Override public UpdateRequestBuilder prepareBatchUpdate(Data data) { - Map source = new HashMap<>(); - source.put(InstanceTable.COLUMN_HEARTBEAT_TIME, data.getDataLong(0)); - return getClient().prepareUpdate(InstanceTable.TABLE, data.getDataString(0)).setDoc(source); - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/heartbeat/dao/InstanceHeartBeatH2DAO.java b/apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/heartbeat/dao/InstanceHeartBeatH2DAO.java deleted file mode 100644 index 127ff72bc3..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/heartbeat/dao/InstanceHeartBeatH2DAO.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentjvm.worker.heartbeat.dao; - -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import org.skywalking.apm.collector.client.h2.H2Client; -import org.skywalking.apm.collector.client.h2.H2ClientException; -import org.skywalking.apm.collector.core.framework.UnexpectedException; -import org.skywalking.apm.collector.core.stream.Data; -import org.skywalking.apm.collector.storage.base.define.DataDefine; -import org.skywalking.apm.collector.storage.base.define.register.InstanceTable; -import org.skywalking.apm.collector.storage.h2.SqlBuilder; -import org.skywalking.apm.collector.storage.h2.base.dao.H2DAO; -import org.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; -import org.skywalking.apm.collector.stream.worker.impl.dao.IPersistenceDAO; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng, clevertension - */ -public class InstanceHeartBeatH2DAO extends H2DAO implements IInstanceHeartBeatDAO, IPersistenceDAO { - private final Logger logger = LoggerFactory.getLogger(InstanceHeartBeatEsDAO.class); - private static final String GET_INSTANCE_HEARTBEAT_SQL = "select * from {0} where {1} = ?"; - - @Override public Data get(String id, DataDefine dataDefine) { - H2Client client = getClient(); - String sql = SqlBuilder.buildSql(GET_INSTANCE_HEARTBEAT_SQL, InstanceTable.TABLE, InstanceTable.COLUMN_INSTANCE_ID); - Object[] params = new Object[] {id}; - try (ResultSet rs = client.executeQuery(sql, params)) { - if (rs.next()) { - Data data = dataDefine.build(id); - data.setDataInteger(0, rs.getInt(InstanceTable.COLUMN_INSTANCE_ID)); - data.setDataLong(0, rs.getLong(InstanceTable.COLUMN_HEARTBEAT_TIME)); - return data; - } - } catch (SQLException | H2ClientException e) { - logger.error(e.getMessage(), e); - } - return null; - } - - @Override public H2SqlEntity prepareBatchInsert(Data data) { - throw new UnexpectedException("There is no need to merge stream data with database data."); - } - - @Override public H2SqlEntity prepareBatchUpdate(Data data) { - H2SqlEntity entity = new H2SqlEntity(); - Map source = new HashMap<>(); - source.put(InstanceTable.COLUMN_HEARTBEAT_TIME, data.getDataLong(0)); - String sql = SqlBuilder.buildBatchUpdateSql(InstanceTable.TABLE, source.keySet(), InstanceTable.COLUMN_INSTANCE_ID); - entity.setSql(sql); - List params = new ArrayList<>(source.values()); - params.add(data.getDataString(0)); - entity.setParams(params.toArray(new Object[0])); - return entity; - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/heartbeat/define/InstanceHeartBeatDataDefine.java b/apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/heartbeat/define/InstanceHeartBeatDataDefine.java deleted file mode 100644 index decab66b23..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/heartbeat/define/InstanceHeartBeatDataDefine.java +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentjvm.worker.heartbeat.define; - -import org.skywalking.apm.collector.core.stream.Data; -import org.skywalking.apm.collector.core.stream.Transform; -import org.skywalking.apm.collector.core.stream.operate.CoverOperation; -import org.skywalking.apm.collector.core.stream.operate.NonOperation; -import org.skywalking.apm.collector.remote.grpc.proto.RemoteData; -import org.skywalking.apm.collector.storage.base.define.Attribute; -import org.skywalking.apm.collector.storage.base.define.AttributeType; -import org.skywalking.apm.collector.storage.base.define.DataDefine; -import org.skywalking.apm.collector.storage.base.define.register.InstanceTable; - -/** - * @author peng-yongsheng - */ -public class InstanceHeartBeatDataDefine extends DataDefine { - - @Override protected int initialCapacity() { - return 3; - } - - @Override protected void attributeDefine() { - addAttribute(0, new Attribute(InstanceTable.COLUMN_ID, AttributeType.STRING, new NonOperation())); - addAttribute(1, new Attribute(InstanceTable.COLUMN_INSTANCE_ID, AttributeType.INTEGER, new CoverOperation())); - addAttribute(2, new Attribute(InstanceTable.COLUMN_HEARTBEAT_TIME, AttributeType.LONG, new CoverOperation())); - } - - @Override public Object deserialize(RemoteData remoteData) { - String id = remoteData.getDataStrings(0); - int instanceId = remoteData.getDataIntegers(0); - long heartBeatTime = remoteData.getDataLongs(0); - return new InstanceHeartBeat(id, heartBeatTime, instanceId); - } - - @Override public RemoteData serialize(Object object) { - InstanceHeartBeat instanceHeartBeat = (InstanceHeartBeat)object; - RemoteData.Builder builder = RemoteData.newBuilder(); - builder.addDataStrings(instanceHeartBeat.getId()); - builder.addDataIntegers(instanceHeartBeat.getInstanceId()); - builder.addDataLongs(instanceHeartBeat.getHeartBeatTime()); - return builder.build(); - } - - public static class InstanceHeartBeat implements Transform { - private String id; - private long heartBeatTime; - private int instanceId; - - public InstanceHeartBeat(String id, long heartBeatTime, int instanceId) { - this.id = id; - this.heartBeatTime = heartBeatTime; - this.instanceId = instanceId; - } - - public InstanceHeartBeat() { - } - - @Override public Data toData() { - InstanceHeartBeatDataDefine define = new InstanceHeartBeatDataDefine(); - Data data = define.build(id); - data.setDataString(0, this.id); - data.setDataInteger(0, this.instanceId); - data.setDataLong(0, this.heartBeatTime); - return data; - } - - @Override public InstanceHeartBeat toSelf(Data data) { - this.id = data.getDataString(0); - this.instanceId = data.getDataInteger(0); - this.heartBeatTime = data.getDataLong(0); - return this; - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public long getHeartBeatTime() { - return heartBeatTime; - } - - public void setHeartBeatTime(long heartBeatTime) { - this.heartBeatTime = heartBeatTime; - } - - public int getInstanceId() { - return instanceId; - } - - public void setInstanceId(int instanceId) { - this.instanceId = instanceId; - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/memory/MemoryMetricPersistenceWorker.java b/apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/memory/MemoryMetricPersistenceWorker.java deleted file mode 100644 index 59a0b91c75..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/memory/MemoryMetricPersistenceWorker.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentjvm.worker.memory; - -import org.skywalking.apm.collector.agentjvm.worker.memory.dao.IMemoryMetricDAO; -import org.skywalking.apm.collector.storage.base.dao.DAOContainer; -import org.skywalking.apm.collector.storage.base.define.DataDefine; -import org.skywalking.apm.collector.storage.base.define.jvm.MemoryMetricDataDefine; -import org.skywalking.apm.collector.stream.worker.AbstractLocalAsyncWorkerProvider; -import org.skywalking.apm.collector.stream.worker.ClusterWorkerContext; -import org.skywalking.apm.collector.stream.worker.ProviderNotFoundException; -import org.skywalking.apm.collector.stream.worker.Role; -import org.skywalking.apm.collector.stream.worker.impl.PersistenceWorker; -import org.skywalking.apm.collector.stream.worker.impl.dao.IPersistenceDAO; -import org.skywalking.apm.collector.stream.worker.selector.RollingSelector; -import org.skywalking.apm.collector.stream.worker.selector.WorkerSelector; - -/** - * @author peng-yongsheng - */ -public class MemoryMetricPersistenceWorker extends PersistenceWorker { - - public MemoryMetricPersistenceWorker(Role role, ClusterWorkerContext clusterContext) { - super(role, clusterContext); - } - - @Override public void preStart() throws ProviderNotFoundException { - super.preStart(); - } - - @Override protected boolean needMergeDBData() { - return false; - } - - @Override protected IPersistenceDAO persistenceDAO() { - return (IPersistenceDAO)DAOContainer.INSTANCE.get(IMemoryMetricDAO.class.getName()); - } - - public static class Factory extends AbstractLocalAsyncWorkerProvider { - @Override - public Role role() { - return WorkerRole.INSTANCE; - } - - @Override - public MemoryMetricPersistenceWorker workerInstance(ClusterWorkerContext clusterContext) { - return new MemoryMetricPersistenceWorker(role(), clusterContext); - } - - @Override - public int queueSize() { - return 1024; - } - } - - public enum WorkerRole implements Role { - INSTANCE; - - @Override - public String roleName() { - return MemoryMetricPersistenceWorker.class.getSimpleName(); - } - - @Override - public WorkerSelector workerSelector() { - return new RollingSelector(); - } - - @Override public DataDefine dataDefine() { - return new MemoryMetricDataDefine(); - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/memory/dao/IMemoryMetricDAO.java b/apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/memory/dao/IMemoryMetricDAO.java deleted file mode 100644 index 5f422ceb07..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/memory/dao/IMemoryMetricDAO.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentjvm.worker.memory.dao; - -/** - * @author peng-yongsheng - */ -public interface IMemoryMetricDAO { -} diff --git a/apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/memory/dao/MemoryMetricEsDAO.java b/apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/memory/dao/MemoryMetricEsDAO.java deleted file mode 100644 index ca335e4a64..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/memory/dao/MemoryMetricEsDAO.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentjvm.worker.memory.dao; - -import java.util.HashMap; -import java.util.Map; -import org.elasticsearch.action.index.IndexRequestBuilder; -import org.elasticsearch.action.update.UpdateRequestBuilder; -import org.skywalking.apm.collector.core.stream.Data; -import org.skywalking.apm.collector.storage.base.define.DataDefine; -import org.skywalking.apm.collector.storage.base.define.jvm.MemoryMetricTable; -import org.skywalking.apm.collector.storage.elasticsearch.dao.EsDAO; -import org.skywalking.apm.collector.stream.worker.impl.dao.IPersistenceDAO; - -/** - * @author peng-yongsheng - */ -public class MemoryMetricEsDAO extends EsDAO implements IMemoryMetricDAO, IPersistenceDAO { - - @Override public Data get(String id, DataDefine dataDefine) { - return null; - } - - @Override public IndexRequestBuilder prepareBatchInsert(Data data) { - Map source = new HashMap<>(); - source.put(MemoryMetricTable.COLUMN_APPLICATION_INSTANCE_ID, data.getDataInteger(0)); - source.put(MemoryMetricTable.COLUMN_IS_HEAP, data.getDataBoolean(0)); - source.put(MemoryMetricTable.COLUMN_INIT, data.getDataLong(0)); - source.put(MemoryMetricTable.COLUMN_MAX, data.getDataLong(1)); - source.put(MemoryMetricTable.COLUMN_USED, data.getDataLong(2)); - source.put(MemoryMetricTable.COLUMN_COMMITTED, data.getDataLong(3)); - source.put(MemoryMetricTable.COLUMN_TIME_BUCKET, data.getDataLong(4)); - - return getClient().prepareIndex(MemoryMetricTable.TABLE, data.getDataString(0)).setSource(source); - } - - @Override public UpdateRequestBuilder prepareBatchUpdate(Data data) { - return null; - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/memory/dao/MemoryMetricH2DAO.java b/apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/memory/dao/MemoryMetricH2DAO.java deleted file mode 100644 index 282a902794..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/memory/dao/MemoryMetricH2DAO.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentjvm.worker.memory.dao; - -import java.util.HashMap; -import java.util.Map; -import org.skywalking.apm.collector.core.stream.Data; -import org.skywalking.apm.collector.storage.base.define.DataDefine; -import org.skywalking.apm.collector.storage.base.define.jvm.MemoryMetricTable; -import org.skywalking.apm.collector.storage.h2.SqlBuilder; -import org.skywalking.apm.collector.storage.h2.base.dao.H2DAO; -import org.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; -import org.skywalking.apm.collector.stream.worker.impl.dao.IPersistenceDAO; - -/** - * @author peng-yongsheng, clevertension - */ -public class MemoryMetricH2DAO extends H2DAO implements IMemoryMetricDAO, IPersistenceDAO { - @Override public Data get(String id, DataDefine dataDefine) { - return null; - } - - @Override public H2SqlEntity prepareBatchInsert(Data data) { - H2SqlEntity entity = new H2SqlEntity(); - Map source = new HashMap<>(); - source.put(MemoryMetricTable.COLUMN_ID, data.getDataString(0)); - source.put(MemoryMetricTable.COLUMN_APPLICATION_INSTANCE_ID, data.getDataInteger(0)); - source.put(MemoryMetricTable.COLUMN_IS_HEAP, data.getDataBoolean(0)); - source.put(MemoryMetricTable.COLUMN_INIT, data.getDataLong(0)); - source.put(MemoryMetricTable.COLUMN_MAX, data.getDataLong(1)); - source.put(MemoryMetricTable.COLUMN_USED, data.getDataLong(2)); - source.put(MemoryMetricTable.COLUMN_COMMITTED, data.getDataLong(3)); - source.put(MemoryMetricTable.COLUMN_TIME_BUCKET, data.getDataLong(4)); - - String sql = SqlBuilder.buildBatchInsertSql(MemoryMetricTable.TABLE, source.keySet()); - entity.setSql(sql); - entity.setParams(source.values().toArray(new Object[0])); - return entity; - } - - @Override public H2SqlEntity prepareBatchUpdate(Data data) { - return null; - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/memory/define/MemoryMetricEsTableDefine.java b/apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/memory/define/MemoryMetricEsTableDefine.java deleted file mode 100644 index c5f095a5b7..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/memory/define/MemoryMetricEsTableDefine.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentjvm.worker.memory.define; - -import org.skywalking.apm.collector.storage.base.define.jvm.MemoryMetricTable; -import org.skywalking.apm.collector.storage.elasticsearch.define.ElasticSearchColumnDefine; -import org.skywalking.apm.collector.storage.elasticsearch.define.ElasticSearchTableDefine; - -/** - * @author peng-yongsheng - */ -public class MemoryMetricEsTableDefine extends ElasticSearchTableDefine { - - public MemoryMetricEsTableDefine() { - super(MemoryMetricTable.TABLE); - } - - @Override public int refreshInterval() { - return 1; - } - - @Override public void initialize() { - addColumn(new ElasticSearchColumnDefine(MemoryMetricTable.COLUMN_APPLICATION_INSTANCE_ID, ElasticSearchColumnDefine.Type.Integer.name())); - addColumn(new ElasticSearchColumnDefine(MemoryMetricTable.COLUMN_IS_HEAP, ElasticSearchColumnDefine.Type.Boolean.name())); - addColumn(new ElasticSearchColumnDefine(MemoryMetricTable.COLUMN_INIT, ElasticSearchColumnDefine.Type.Long.name())); - addColumn(new ElasticSearchColumnDefine(MemoryMetricTable.COLUMN_MAX, ElasticSearchColumnDefine.Type.Long.name())); - addColumn(new ElasticSearchColumnDefine(MemoryMetricTable.COLUMN_USED, ElasticSearchColumnDefine.Type.Long.name())); - addColumn(new ElasticSearchColumnDefine(MemoryMetricTable.COLUMN_COMMITTED, ElasticSearchColumnDefine.Type.Long.name())); - addColumn(new ElasticSearchColumnDefine(MemoryMetricTable.COLUMN_TIME_BUCKET, ElasticSearchColumnDefine.Type.Long.name())); - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/memory/define/MemoryMetricH2TableDefine.java b/apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/memory/define/MemoryMetricH2TableDefine.java deleted file mode 100644 index ff631cc667..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/memory/define/MemoryMetricH2TableDefine.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentjvm.worker.memory.define; - -import org.skywalking.apm.collector.storage.base.define.jvm.MemoryMetricTable; -import org.skywalking.apm.collector.storage.h2.base.define.H2ColumnDefine; -import org.skywalking.apm.collector.storage.h2.base.define.H2TableDefine; - -/** - * @author peng-yongsheng - */ -public class MemoryMetricH2TableDefine extends H2TableDefine { - - public MemoryMetricH2TableDefine() { - super(MemoryMetricTable.TABLE); - } - - @Override public void initialize() { - addColumn(new H2ColumnDefine(MemoryMetricTable.COLUMN_ID, H2ColumnDefine.Type.Varchar.name())); - addColumn(new H2ColumnDefine(MemoryMetricTable.COLUMN_APPLICATION_INSTANCE_ID, H2ColumnDefine.Type.Int.name())); - addColumn(new H2ColumnDefine(MemoryMetricTable.COLUMN_IS_HEAP, H2ColumnDefine.Type.Boolean.name())); - addColumn(new H2ColumnDefine(MemoryMetricTable.COLUMN_INIT, H2ColumnDefine.Type.Bigint.name())); - addColumn(new H2ColumnDefine(MemoryMetricTable.COLUMN_MAX, H2ColumnDefine.Type.Bigint.name())); - addColumn(new H2ColumnDefine(MemoryMetricTable.COLUMN_USED, H2ColumnDefine.Type.Bigint.name())); - addColumn(new H2ColumnDefine(MemoryMetricTable.COLUMN_COMMITTED, H2ColumnDefine.Type.Bigint.name())); - addColumn(new H2ColumnDefine(MemoryMetricTable.COLUMN_TIME_BUCKET, H2ColumnDefine.Type.Bigint.name())); - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/memorypool/MemoryPoolMetricPersistenceWorker.java b/apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/memorypool/MemoryPoolMetricPersistenceWorker.java deleted file mode 100644 index ca42adab82..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/memorypool/MemoryPoolMetricPersistenceWorker.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentjvm.worker.memorypool; - -import org.skywalking.apm.collector.agentjvm.worker.memorypool.dao.IMemoryPoolMetricDAO; -import org.skywalking.apm.collector.storage.base.dao.DAOContainer; -import org.skywalking.apm.collector.storage.base.define.DataDefine; -import org.skywalking.apm.collector.storage.base.define.jvm.MemoryPoolMetricDataDefine; -import org.skywalking.apm.collector.stream.worker.AbstractLocalAsyncWorkerProvider; -import org.skywalking.apm.collector.stream.worker.ClusterWorkerContext; -import org.skywalking.apm.collector.stream.worker.ProviderNotFoundException; -import org.skywalking.apm.collector.stream.worker.Role; -import org.skywalking.apm.collector.stream.worker.impl.PersistenceWorker; -import org.skywalking.apm.collector.stream.worker.impl.dao.IPersistenceDAO; -import org.skywalking.apm.collector.stream.worker.selector.RollingSelector; -import org.skywalking.apm.collector.stream.worker.selector.WorkerSelector; - -/** - * @author peng-yongsheng - */ -public class MemoryPoolMetricPersistenceWorker extends PersistenceWorker { - - public MemoryPoolMetricPersistenceWorker(Role role, ClusterWorkerContext clusterContext) { - super(role, clusterContext); - } - - @Override public void preStart() throws ProviderNotFoundException { - super.preStart(); - } - - @Override protected boolean needMergeDBData() { - return false; - } - - @Override protected IPersistenceDAO persistenceDAO() { - return (IPersistenceDAO)DAOContainer.INSTANCE.get(IMemoryPoolMetricDAO.class.getName()); - } - - public static class Factory extends AbstractLocalAsyncWorkerProvider { - @Override - public Role role() { - return WorkerRole.INSTANCE; - } - - @Override - public MemoryPoolMetricPersistenceWorker workerInstance(ClusterWorkerContext clusterContext) { - return new MemoryPoolMetricPersistenceWorker(role(), clusterContext); - } - - @Override - public int queueSize() { - return 1024; - } - } - - public enum WorkerRole implements Role { - INSTANCE; - - @Override - public String roleName() { - return MemoryPoolMetricPersistenceWorker.class.getSimpleName(); - } - - @Override - public WorkerSelector workerSelector() { - return new RollingSelector(); - } - - @Override public DataDefine dataDefine() { - return new MemoryPoolMetricDataDefine(); - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/memorypool/dao/IMemoryPoolMetricDAO.java b/apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/memorypool/dao/IMemoryPoolMetricDAO.java deleted file mode 100644 index 87c2d07f64..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/memorypool/dao/IMemoryPoolMetricDAO.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentjvm.worker.memorypool.dao; - -/** - * @author peng-yongsheng - */ -public interface IMemoryPoolMetricDAO { -} diff --git a/apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/memorypool/dao/MemoryPoolMetricEsDAO.java b/apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/memorypool/dao/MemoryPoolMetricEsDAO.java deleted file mode 100644 index 243f7aa22f..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/memorypool/dao/MemoryPoolMetricEsDAO.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentjvm.worker.memorypool.dao; - -import java.util.HashMap; -import java.util.Map; -import org.elasticsearch.action.index.IndexRequestBuilder; -import org.elasticsearch.action.update.UpdateRequestBuilder; -import org.skywalking.apm.collector.core.stream.Data; -import org.skywalking.apm.collector.storage.base.define.DataDefine; -import org.skywalking.apm.collector.storage.base.define.jvm.MemoryPoolMetricTable; -import org.skywalking.apm.collector.storage.elasticsearch.dao.EsDAO; -import org.skywalking.apm.collector.stream.worker.impl.dao.IPersistenceDAO; - -/** - * @author peng-yongsheng - */ -public class MemoryPoolMetricEsDAO extends EsDAO implements IMemoryPoolMetricDAO, IPersistenceDAO { - - @Override public Data get(String id, DataDefine dataDefine) { - return null; - } - - @Override public IndexRequestBuilder prepareBatchInsert(Data data) { - Map source = new HashMap<>(); - source.put(MemoryPoolMetricTable.COLUMN_INSTANCE_ID, data.getDataInteger(0)); - source.put(MemoryPoolMetricTable.COLUMN_POOL_TYPE, data.getDataInteger(1)); - source.put(MemoryPoolMetricTable.COLUMN_INIT, data.getDataLong(0)); - source.put(MemoryPoolMetricTable.COLUMN_MAX, data.getDataLong(1)); - source.put(MemoryPoolMetricTable.COLUMN_USED, data.getDataLong(2)); - source.put(MemoryPoolMetricTable.COLUMN_COMMITTED, data.getDataLong(3)); - source.put(MemoryPoolMetricTable.COLUMN_TIME_BUCKET, data.getDataLong(4)); - - return getClient().prepareIndex(MemoryPoolMetricTable.TABLE, data.getDataString(0)).setSource(source); - } - - @Override public UpdateRequestBuilder prepareBatchUpdate(Data data) { - return null; - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/memorypool/dao/MemoryPoolMetricH2DAO.java b/apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/memorypool/dao/MemoryPoolMetricH2DAO.java deleted file mode 100644 index 7eeea4bec8..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/memorypool/dao/MemoryPoolMetricH2DAO.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentjvm.worker.memorypool.dao; - -import java.util.HashMap; -import java.util.Map; -import org.skywalking.apm.collector.core.stream.Data; -import org.skywalking.apm.collector.storage.base.define.DataDefine; -import org.skywalking.apm.collector.storage.base.define.jvm.MemoryPoolMetricTable; -import org.skywalking.apm.collector.storage.h2.SqlBuilder; -import org.skywalking.apm.collector.storage.h2.base.dao.H2DAO; -import org.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; -import org.skywalking.apm.collector.stream.worker.impl.dao.IPersistenceDAO; - -/** - * @author peng-yongsheng, clevertension - */ -public class MemoryPoolMetricH2DAO extends H2DAO implements IMemoryPoolMetricDAO, IPersistenceDAO { - @Override public Data get(String id, DataDefine dataDefine) { - return null; - } - - @Override public H2SqlEntity prepareBatchInsert(Data data) { - H2SqlEntity entity = new H2SqlEntity(); - Map source = new HashMap<>(); - source.put(MemoryPoolMetricTable.COLUMN_ID, data.getDataString(0)); - source.put(MemoryPoolMetricTable.COLUMN_INSTANCE_ID, data.getDataInteger(0)); - source.put(MemoryPoolMetricTable.COLUMN_POOL_TYPE, data.getDataInteger(1)); - source.put(MemoryPoolMetricTable.COLUMN_INIT, data.getDataLong(0)); - source.put(MemoryPoolMetricTable.COLUMN_MAX, data.getDataLong(1)); - source.put(MemoryPoolMetricTable.COLUMN_USED, data.getDataLong(2)); - source.put(MemoryPoolMetricTable.COLUMN_COMMITTED, data.getDataLong(3)); - source.put(MemoryPoolMetricTable.COLUMN_TIME_BUCKET, data.getDataLong(4)); - - String sql = SqlBuilder.buildBatchInsertSql(MemoryPoolMetricTable.TABLE, source.keySet()); - entity.setSql(sql); - entity.setParams(source.values().toArray(new Object[0])); - return entity; - } - - @Override public H2SqlEntity prepareBatchUpdate(Data data) { - return null; - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/memorypool/define/MemoryPoolMetricEsTableDefine.java b/apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/memorypool/define/MemoryPoolMetricEsTableDefine.java deleted file mode 100644 index f98f82cd8a..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/memorypool/define/MemoryPoolMetricEsTableDefine.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentjvm.worker.memorypool.define; - -import org.skywalking.apm.collector.storage.base.define.jvm.MemoryPoolMetricTable; -import org.skywalking.apm.collector.storage.elasticsearch.define.ElasticSearchColumnDefine; -import org.skywalking.apm.collector.storage.elasticsearch.define.ElasticSearchTableDefine; - -/** - * @author peng-yongsheng - */ -public class MemoryPoolMetricEsTableDefine extends ElasticSearchTableDefine { - - public MemoryPoolMetricEsTableDefine() { - super(MemoryPoolMetricTable.TABLE); - } - - @Override public int refreshInterval() { - return 1; - } - - @Override public void initialize() { - addColumn(new ElasticSearchColumnDefine(MemoryPoolMetricTable.COLUMN_INSTANCE_ID, ElasticSearchColumnDefine.Type.Integer.name())); - addColumn(new ElasticSearchColumnDefine(MemoryPoolMetricTable.COLUMN_POOL_TYPE, ElasticSearchColumnDefine.Type.Integer.name())); - addColumn(new ElasticSearchColumnDefine(MemoryPoolMetricTable.COLUMN_INIT, ElasticSearchColumnDefine.Type.Long.name())); - addColumn(new ElasticSearchColumnDefine(MemoryPoolMetricTable.COLUMN_MAX, ElasticSearchColumnDefine.Type.Long.name())); - addColumn(new ElasticSearchColumnDefine(MemoryPoolMetricTable.COLUMN_USED, ElasticSearchColumnDefine.Type.Long.name())); - addColumn(new ElasticSearchColumnDefine(MemoryPoolMetricTable.COLUMN_COMMITTED, ElasticSearchColumnDefine.Type.Long.name())); - addColumn(new ElasticSearchColumnDefine(MemoryPoolMetricTable.COLUMN_TIME_BUCKET, ElasticSearchColumnDefine.Type.Long.name())); - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/memorypool/define/MemoryPoolMetricH2TableDefine.java b/apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/memorypool/define/MemoryPoolMetricH2TableDefine.java deleted file mode 100644 index f7b9dc44d4..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentjvm/src/main/java/org/skywalking/apm/collector/agentjvm/worker/memorypool/define/MemoryPoolMetricH2TableDefine.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentjvm.worker.memorypool.define; - -import org.skywalking.apm.collector.storage.base.define.jvm.MemoryPoolMetricTable; -import org.skywalking.apm.collector.storage.h2.base.define.H2ColumnDefine; -import org.skywalking.apm.collector.storage.h2.base.define.H2TableDefine; - -/** - * @author peng-yongsheng - */ -public class MemoryPoolMetricH2TableDefine extends H2TableDefine { - - public MemoryPoolMetricH2TableDefine() { - super(MemoryPoolMetricTable.TABLE); - } - - @Override public void initialize() { - addColumn(new H2ColumnDefine(MemoryPoolMetricTable.COLUMN_ID, H2ColumnDefine.Type.Varchar.name())); - addColumn(new H2ColumnDefine(MemoryPoolMetricTable.COLUMN_INSTANCE_ID, H2ColumnDefine.Type.Int.name())); - addColumn(new H2ColumnDefine(MemoryPoolMetricTable.COLUMN_POOL_TYPE, H2ColumnDefine.Type.Int.name())); - addColumn(new H2ColumnDefine(MemoryPoolMetricTable.COLUMN_INIT, H2ColumnDefine.Type.Bigint.name())); - addColumn(new H2ColumnDefine(MemoryPoolMetricTable.COLUMN_MAX, H2ColumnDefine.Type.Bigint.name())); - addColumn(new H2ColumnDefine(MemoryPoolMetricTable.COLUMN_USED, H2ColumnDefine.Type.Bigint.name())); - addColumn(new H2ColumnDefine(MemoryPoolMetricTable.COLUMN_COMMITTED, H2ColumnDefine.Type.Bigint.name())); - addColumn(new H2ColumnDefine(MemoryPoolMetricTable.COLUMN_TIME_BUCKET, H2ColumnDefine.Type.Bigint.name())); - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentjvm/src/main/resources/META-INF/defines/es_dao.define b/apm-collector-3.2.3/apm-collector-agentjvm/src/main/resources/META-INF/defines/es_dao.define deleted file mode 100644 index 13e6077c04..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentjvm/src/main/resources/META-INF/defines/es_dao.define +++ /dev/null @@ -1,5 +0,0 @@ -org.skywalking.apm.collector.agentjvm.worker.cpu.dao.CpuMetricEsDAO -org.skywalking.apm.collector.agentjvm.worker.memory.dao.MemoryMetricEsDAO -org.skywalking.apm.collector.agentjvm.worker.memorypool.dao.MemoryPoolMetricEsDAO -org.skywalking.apm.collector.agentjvm.worker.gc.dao.GCMetricEsDAO -org.skywalking.apm.collector.agentjvm.worker.heartbeat.dao.InstanceHeartBeatEsDAO \ No newline at end of file diff --git a/apm-collector-3.2.3/apm-collector-agentjvm/src/main/resources/META-INF/defines/h2_dao.define b/apm-collector-3.2.3/apm-collector-agentjvm/src/main/resources/META-INF/defines/h2_dao.define deleted file mode 100644 index c6eb797fbd..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentjvm/src/main/resources/META-INF/defines/h2_dao.define +++ /dev/null @@ -1,5 +0,0 @@ -org.skywalking.apm.collector.agentjvm.worker.cpu.dao.CpuMetricH2DAO -org.skywalking.apm.collector.agentjvm.worker.memory.dao.MemoryMetricH2DAO -org.skywalking.apm.collector.agentjvm.worker.memorypool.dao.MemoryPoolMetricH2DAO -org.skywalking.apm.collector.agentjvm.worker.gc.dao.GCMetricH2DAO -org.skywalking.apm.collector.agentjvm.worker.heartbeat.dao.InstanceHeartBeatH2DAO \ No newline at end of file diff --git a/apm-collector-3.2.3/apm-collector-agentjvm/src/main/resources/META-INF/defines/local_worker_provider.define b/apm-collector-3.2.3/apm-collector-agentjvm/src/main/resources/META-INF/defines/local_worker_provider.define deleted file mode 100644 index 6c21da7dbd..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentjvm/src/main/resources/META-INF/defines/local_worker_provider.define +++ /dev/null @@ -1,5 +0,0 @@ -org.skywalking.apm.collector.agentjvm.worker.cpu.CpuMetricPersistenceWorker$Factory -org.skywalking.apm.collector.agentjvm.worker.memory.MemoryMetricPersistenceWorker$Factory -org.skywalking.apm.collector.agentjvm.worker.memorypool.MemoryPoolMetricPersistenceWorker$Factory -org.skywalking.apm.collector.agentjvm.worker.gc.GCMetricPersistenceWorker$Factory -org.skywalking.apm.collector.agentjvm.worker.heartbeat.InstHeartBeatPersistenceWorker$Factory \ No newline at end of file diff --git a/apm-collector-3.2.3/apm-collector-agentjvm/src/main/resources/META-INF/defines/storage.define b/apm-collector-3.2.3/apm-collector-agentjvm/src/main/resources/META-INF/defines/storage.define deleted file mode 100644 index a4ac32ed27..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentjvm/src/main/resources/META-INF/defines/storage.define +++ /dev/null @@ -1,11 +0,0 @@ -org.skywalking.apm.collector.agentjvm.worker.cpu.define.CpuMetricEsTableDefine -org.skywalking.apm.collector.agentjvm.worker.cpu.define.CpuMetricH2TableDefine - -org.skywalking.apm.collector.agentjvm.worker.memory.define.MemoryMetricEsTableDefine -org.skywalking.apm.collector.agentjvm.worker.memory.define.MemoryMetricH2TableDefine - -org.skywalking.apm.collector.agentjvm.worker.memorypool.define.MemoryPoolMetricEsTableDefine -org.skywalking.apm.collector.agentjvm.worker.memorypool.define.MemoryPoolMetricH2TableDefine - -org.skywalking.apm.collector.agentjvm.worker.gc.define.GCMetricEsTableDefine -org.skywalking.apm.collector.agentjvm.worker.gc.define.GCMetricH2TableDefine \ No newline at end of file diff --git a/apm-collector-3.2.3/apm-collector-agentjvm/src/test/java/org/skywalking/apm/collector/agentjvm/grpc/handler/JVMMetricsServiceHandlerTestCase.java b/apm-collector-3.2.3/apm-collector-agentjvm/src/test/java/org/skywalking/apm/collector/agentjvm/grpc/handler/JVMMetricsServiceHandlerTestCase.java deleted file mode 100644 index fbb7462562..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentjvm/src/test/java/org/skywalking/apm/collector/agentjvm/grpc/handler/JVMMetricsServiceHandlerTestCase.java +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentjvm.grpc.handler; - -import io.grpc.ManagedChannel; -import io.grpc.ManagedChannelBuilder; -import java.util.concurrent.Executors; -import java.util.concurrent.TimeUnit; -import org.skywalking.apm.network.proto.CPU; -import org.skywalking.apm.network.proto.GC; -import org.skywalking.apm.network.proto.GCPhrase; -import org.skywalking.apm.network.proto.JVMMetric; -import org.skywalking.apm.network.proto.JVMMetrics; -import org.skywalking.apm.network.proto.JVMMetricsServiceGrpc; -import org.skywalking.apm.network.proto.Memory; -import org.skywalking.apm.network.proto.MemoryPool; -import org.skywalking.apm.network.proto.PoolType; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class JVMMetricsServiceHandlerTestCase { - - private final Logger logger = LoggerFactory.getLogger(JVMMetricsServiceHandlerTestCase.class); - - private static JVMMetricsServiceGrpc.JVMMetricsServiceBlockingStub STUB; - - public static void main(String[] args) { - ManagedChannel channel = ManagedChannelBuilder.forAddress("localhost", 11800).usePlaintext(true).build(); - STUB = JVMMetricsServiceGrpc.newBlockingStub(channel); - - final long timeInterval = 1; - Executors.newSingleThreadScheduledExecutor().scheduleAtFixedRate(() -> multiInstanceJvmSend(), 1, timeInterval, TimeUnit.SECONDS); - } - - public static void multiInstanceJvmSend() { - buildJvmMetric(2); - buildJvmMetric(3); - } - - private static void buildJvmMetric(int instanceId) { - JVMMetrics.Builder jvmMetricsBuilder = JVMMetrics.newBuilder(); - jvmMetricsBuilder.setApplicationInstanceId(instanceId); - - JVMMetric.Builder jvmMetric = JVMMetric.newBuilder(); - jvmMetric.setTime(System.currentTimeMillis()); - buildCpuMetric(jvmMetric); - buildMemoryMetric(jvmMetric); - buildMemoryPoolMetric(jvmMetric); - buildGcMetric(jvmMetric); - - jvmMetricsBuilder.addMetrics(jvmMetric.build()); - STUB.collect(jvmMetricsBuilder.build()); - } - - private static void buildCpuMetric(JVMMetric.Builder jvmMetric) { - CPU.Builder cpuBuilder = CPU.newBuilder(); - cpuBuilder.setUsagePercent(70); - jvmMetric.setCpu(cpuBuilder); - } - - private static void buildMemoryMetric(JVMMetric.Builder jvmMetric) { - Memory.Builder builderHeap = Memory.newBuilder(); - builderHeap.setIsHeap(true); - builderHeap.setInit(20); - builderHeap.setMax(100); - builderHeap.setUsed(50); - builderHeap.setCommitted(30); - jvmMetric.addMemory(builderHeap.build()); - - Memory.Builder builderNonHeap = Memory.newBuilder(); - builderNonHeap.setIsHeap(false); - builderNonHeap.setInit(200); - builderNonHeap.setMax(1000); - builderNonHeap.setUsed(500); - builderNonHeap.setCommitted(300); - jvmMetric.addMemory(builderNonHeap.build()); - } - - private static void buildMemoryPoolMetric(JVMMetric.Builder jvmMetric) { - jvmMetric.addMemoryPool(buildMemoryPoolMetric(PoolType.NEWGEN_USAGE, true).build()); - jvmMetric.addMemoryPool(buildMemoryPoolMetric(PoolType.NEWGEN_USAGE, false).build()); - - jvmMetric.addMemoryPool(buildMemoryPoolMetric(PoolType.OLDGEN_USAGE, true).build()); - jvmMetric.addMemoryPool(buildMemoryPoolMetric(PoolType.OLDGEN_USAGE, false).build()); - - jvmMetric.addMemoryPool(buildMemoryPoolMetric(PoolType.METASPACE_USAGE, true).build()); - jvmMetric.addMemoryPool(buildMemoryPoolMetric(PoolType.METASPACE_USAGE, false).build()); - - jvmMetric.addMemoryPool(buildMemoryPoolMetric(PoolType.PERMGEN_USAGE, true).build()); - jvmMetric.addMemoryPool(buildMemoryPoolMetric(PoolType.PERMGEN_USAGE, false).build()); - - jvmMetric.addMemoryPool(buildMemoryPoolMetric(PoolType.SURVIVOR_USAGE, true).build()); - jvmMetric.addMemoryPool(buildMemoryPoolMetric(PoolType.SURVIVOR_USAGE, false).build()); - - jvmMetric.addMemoryPool(buildMemoryPoolMetric(PoolType.CODE_CACHE_USAGE, true).build()); - jvmMetric.addMemoryPool(buildMemoryPoolMetric(PoolType.CODE_CACHE_USAGE, false).build()); - } - - private static MemoryPool.Builder buildMemoryPoolMetric(PoolType poolType, boolean isHeap) { - MemoryPool.Builder builder = MemoryPool.newBuilder(); - builder.setType(poolType); - builder.setInit(20); - builder.setMax(100); - builder.setUsed(50); - builder.setCommited(30); - return builder; - } - - private static void buildGcMetric(JVMMetric.Builder jvmMetric) { - GC.Builder newGcBuilder = GC.newBuilder(); - newGcBuilder.setPhrase(GCPhrase.NEW); - newGcBuilder.setCount(2); - newGcBuilder.setTime(100); - jvmMetric.addGc(newGcBuilder.build()); - - GC.Builder oldGcBuilder = GC.newBuilder(); - oldGcBuilder.setPhrase(GCPhrase.OLD); - oldGcBuilder.setCount(2); - oldGcBuilder.setTime(100); - jvmMetric.addGc(oldGcBuilder.build()); - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentregister/pom.xml b/apm-collector-3.2.3/apm-collector-agentregister/pom.xml deleted file mode 100644 index 1e988fada4..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentregister/pom.xml +++ /dev/null @@ -1,60 +0,0 @@ - - - - - - apm-collector-3.2.3 - org.skywalking - 3.2.4-2017 - - 4.0.0 - - apm-collector-3.2.3-agentregister - jar - - - - org.skywalking - apm-collector-3.2.3-stream - ${project.version} - - - org.skywalking - apm-collector-3.2.3-cluster - ${project.version} - - - org.skywalking - apm-collector-3.2.3-server - ${project.version} - - - org.skywalking - apm-network - ${project.version} - - - org.skywalking - apm-collector-3.2.3-cache - ${project.version} - - - diff --git a/apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/application/ApplicationIDService.java b/apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/application/ApplicationIDService.java deleted file mode 100644 index 209646469e..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/application/ApplicationIDService.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentregister.application; - -import org.skywalking.apm.collector.agentregister.worker.application.ApplicationRegisterRemoteWorker; -import org.skywalking.apm.collector.cache.ApplicationCache; -import org.skywalking.apm.collector.core.framework.CollectorContextHelper; -import org.skywalking.apm.collector.storage.base.define.register.ApplicationDataDefine; -import org.skywalking.apm.collector.stream.StreamModuleContext; -import org.skywalking.apm.collector.stream.StreamModuleGroupDefine; -import org.skywalking.apm.collector.stream.worker.WorkerInvokeException; -import org.skywalking.apm.collector.stream.worker.WorkerNotFoundException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class ApplicationIDService { - - private final Logger logger = LoggerFactory.getLogger(ApplicationIDService.class); - - public int getOrCreate(String applicationCode) { - int applicationId = ApplicationCache.get(applicationCode); - - if (applicationId == 0) { - StreamModuleContext context = (StreamModuleContext)CollectorContextHelper.INSTANCE.getContext(StreamModuleGroupDefine.GROUP_NAME); - ApplicationDataDefine.Application application = new ApplicationDataDefine.Application(applicationCode, applicationCode, 0); - try { - context.getClusterWorkerContext().lookup(ApplicationRegisterRemoteWorker.WorkerRole.INSTANCE).tell(application); - } catch (WorkerNotFoundException | WorkerInvokeException e) { - logger.error(e.getMessage(), e); - } - } - return applicationId; - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/grpc/handler/ApplicationRegisterServiceHandler.java b/apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/grpc/handler/ApplicationRegisterServiceHandler.java deleted file mode 100644 index c0fc2fb4d7..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/grpc/handler/ApplicationRegisterServiceHandler.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentregister.grpc.handler; - -import com.google.protobuf.ProtocolStringList; -import io.grpc.stub.StreamObserver; -import org.skywalking.apm.collector.agentregister.application.ApplicationIDService; -import org.skywalking.apm.collector.server.grpc.GRPCHandler; -import org.skywalking.apm.network.proto.Application; -import org.skywalking.apm.network.proto.ApplicationMapping; -import org.skywalking.apm.network.proto.ApplicationRegisterServiceGrpc; -import org.skywalking.apm.network.proto.KeyWithIntegerValue; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class ApplicationRegisterServiceHandler extends ApplicationRegisterServiceGrpc.ApplicationRegisterServiceImplBase implements GRPCHandler { - - private final Logger logger = LoggerFactory.getLogger(ApplicationRegisterServiceHandler.class); - - private ApplicationIDService applicationIDService = new ApplicationIDService(); - - @Override public void register(Application request, StreamObserver responseObserver) { - logger.debug("register application"); - ProtocolStringList applicationCodes = request.getApplicationCodeList(); - - ApplicationMapping.Builder builder = ApplicationMapping.newBuilder(); - for (int i = 0; i < applicationCodes.size(); i++) { - String applicationCode = applicationCodes.get(i); - int applicationId = applicationIDService.getOrCreate(applicationCode); - - if (applicationId != 0) { - KeyWithIntegerValue value = KeyWithIntegerValue.newBuilder().setKey(applicationCode).setValue(applicationId).build(); - builder.addApplication(value); - } - } - responseObserver.onNext(builder.build()); - responseObserver.onCompleted(); - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/grpc/handler/InstanceDiscoveryServiceHandler.java b/apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/grpc/handler/InstanceDiscoveryServiceHandler.java deleted file mode 100644 index ed59226577..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/grpc/handler/InstanceDiscoveryServiceHandler.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentregister.grpc.handler; - -import com.google.gson.JsonArray; -import com.google.gson.JsonObject; -import io.grpc.stub.StreamObserver; -import org.skywalking.apm.collector.agentregister.instance.InstanceIDService; -import org.skywalking.apm.collector.core.util.TimeBucketUtils; -import org.skywalking.apm.collector.server.grpc.GRPCHandler; -import org.skywalking.apm.network.proto.ApplicationInstance; -import org.skywalking.apm.network.proto.ApplicationInstanceMapping; -import org.skywalking.apm.network.proto.ApplicationInstanceRecover; -import org.skywalking.apm.network.proto.Downstream; -import org.skywalking.apm.network.proto.InstanceDiscoveryServiceGrpc; -import org.skywalking.apm.network.proto.OSInfo; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class InstanceDiscoveryServiceHandler extends InstanceDiscoveryServiceGrpc.InstanceDiscoveryServiceImplBase implements GRPCHandler { - - private final Logger logger = LoggerFactory.getLogger(InstanceDiscoveryServiceHandler.class); - - private InstanceIDService instanceIDService = new InstanceIDService(); - - @Override - public void register(ApplicationInstance request, StreamObserver responseObserver) { - long timeBucket = TimeBucketUtils.INSTANCE.getSecondTimeBucket(request.getRegisterTime()); - int instanceId = instanceIDService.getOrCreate(request.getApplicationId(), request.getAgentUUID(), timeBucket, buildOsInfo(request.getOsinfo())); - ApplicationInstanceMapping.Builder builder = ApplicationInstanceMapping.newBuilder(); - builder.setApplicationId(request.getApplicationId()); - builder.setApplicationInstanceId(instanceId); - responseObserver.onNext(builder.build()); - responseObserver.onCompleted(); - } - - @Override - public void registerRecover(ApplicationInstanceRecover request, StreamObserver responseObserver) { - long timeBucket = TimeBucketUtils.INSTANCE.getSecondTimeBucket(request.getRegisterTime()); - instanceIDService.recover(request.getApplicationInstanceId(), request.getApplicationId(), timeBucket, buildOsInfo(request.getOsinfo())); - responseObserver.onNext(Downstream.newBuilder().build()); - responseObserver.onCompleted(); - } - - private String buildOsInfo(OSInfo osinfo) { - JsonObject osInfoJson = new JsonObject(); - osInfoJson.addProperty("osName", osinfo.getOsName()); - osInfoJson.addProperty("hostName", osinfo.getHostname()); - osInfoJson.addProperty("processId", osinfo.getProcessNo()); - - JsonArray ipv4Array = new JsonArray(); - osinfo.getIpv4SList().forEach(ipv4 -> { - ipv4Array.add(ipv4); - }); - osInfoJson.add("ipv4s", ipv4Array); - return osInfoJson.toString(); - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/grpc/handler/ServiceNameDiscoveryServiceHandler.java b/apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/grpc/handler/ServiceNameDiscoveryServiceHandler.java deleted file mode 100644 index 5b77ee4b1d..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/grpc/handler/ServiceNameDiscoveryServiceHandler.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentregister.grpc.handler; - -import io.grpc.stub.StreamObserver; -import java.util.List; -import org.skywalking.apm.collector.agentregister.servicename.ServiceNameService; -import org.skywalking.apm.collector.server.grpc.GRPCHandler; -import org.skywalking.apm.network.proto.ServiceNameCollection; -import org.skywalking.apm.network.proto.ServiceNameDiscoveryServiceGrpc; -import org.skywalking.apm.network.proto.ServiceNameElement; -import org.skywalking.apm.network.proto.ServiceNameMappingCollection; -import org.skywalking.apm.network.proto.ServiceNameMappingElement; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class ServiceNameDiscoveryServiceHandler extends ServiceNameDiscoveryServiceGrpc.ServiceNameDiscoveryServiceImplBase implements GRPCHandler { - - private final Logger logger = LoggerFactory.getLogger(ServiceNameDiscoveryServiceHandler.class); - - private ServiceNameService serviceNameService = new ServiceNameService(); - - @Override public void discovery(ServiceNameCollection request, - StreamObserver responseObserver) { - List serviceNameElementList = request.getElementsList(); - - ServiceNameMappingCollection.Builder builder = ServiceNameMappingCollection.newBuilder(); - for (ServiceNameElement serviceNameElement : serviceNameElementList) { - int applicationId = serviceNameElement.getApplicationId(); - String serviceName = serviceNameElement.getServiceName(); - int serviceId = serviceNameService.getOrCreate(applicationId, serviceName); - - if (serviceId != 0) { - ServiceNameMappingElement.Builder mappingElement = ServiceNameMappingElement.newBuilder(); - mappingElement.setServiceId(serviceId); - mappingElement.setElement(serviceNameElement); - builder.addElements(mappingElement); - } - } - - responseObserver.onNext(builder.build()); - responseObserver.onCompleted(); - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/instance/InstanceIDService.java b/apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/instance/InstanceIDService.java deleted file mode 100644 index 6a4ae597a9..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/instance/InstanceIDService.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentregister.instance; - -import org.skywalking.apm.collector.agentregister.worker.instance.InstanceRegisterRemoteWorker; -import org.skywalking.apm.collector.agentregister.worker.instance.dao.IInstanceDAO; -import org.skywalking.apm.collector.core.framework.CollectorContextHelper; -import org.skywalking.apm.collector.storage.base.dao.DAOContainer; -import org.skywalking.apm.collector.storage.base.define.register.InstanceDataDefine; -import org.skywalking.apm.collector.stream.StreamModuleContext; -import org.skywalking.apm.collector.stream.StreamModuleGroupDefine; -import org.skywalking.apm.collector.stream.worker.WorkerInvokeException; -import org.skywalking.apm.collector.stream.worker.WorkerNotFoundException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class InstanceIDService { - - private final Logger logger = LoggerFactory.getLogger(InstanceIDService.class); - - public int getOrCreate(int applicationId, String agentUUID, long registerTime, String osInfo) { - logger.debug("get or create instance id, application id: {}, agentUUID: {}, registerTime: {}, osInfo: {}", applicationId, agentUUID, registerTime, osInfo); - IInstanceDAO dao = (IInstanceDAO)DAOContainer.INSTANCE.get(IInstanceDAO.class.getName()); - int instanceId = dao.getInstanceId(applicationId, agentUUID); - - if (instanceId == 0) { - StreamModuleContext context = (StreamModuleContext)CollectorContextHelper.INSTANCE.getContext(StreamModuleGroupDefine.GROUP_NAME); - InstanceDataDefine.Instance instance = new InstanceDataDefine.Instance("0", applicationId, agentUUID, registerTime, 0, registerTime, osInfo); - try { - context.getClusterWorkerContext().lookup(InstanceRegisterRemoteWorker.WorkerRole.INSTANCE).tell(instance); - } catch (WorkerNotFoundException | WorkerInvokeException e) { - logger.error(e.getMessage(), e); - } - } - return instanceId; - } - - public void recover(int instanceId, int applicationId, long registerTime, String osInfo) { - logger.debug("instance recover, instance id: {}, application id: {}, register time: {}", instanceId, applicationId, registerTime); - IInstanceDAO dao = (IInstanceDAO)DAOContainer.INSTANCE.get(IInstanceDAO.class.getName()); - - InstanceDataDefine.Instance instance = new InstanceDataDefine.Instance(String.valueOf(instanceId), applicationId, "", registerTime, instanceId, registerTime, osInfo); - dao.save(instance); - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/jetty/handler/ApplicationRegisterServletHandler.java b/apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/jetty/handler/ApplicationRegisterServletHandler.java deleted file mode 100644 index 2c932efdeb..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/jetty/handler/ApplicationRegisterServletHandler.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentregister.jetty.handler; - -import com.google.gson.Gson; -import com.google.gson.JsonArray; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import java.io.IOException; -import javax.servlet.http.HttpServletRequest; -import org.skywalking.apm.collector.agentregister.application.ApplicationIDService; -import org.skywalking.apm.collector.server.jetty.ArgumentsParseException; -import org.skywalking.apm.collector.server.jetty.JettyHandler; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class ApplicationRegisterServletHandler extends JettyHandler { - - private final Logger logger = LoggerFactory.getLogger(ApplicationRegisterServletHandler.class); - - private ApplicationIDService applicationIDService = new ApplicationIDService(); - private Gson gson = new Gson(); - private static final String APPLICATION_CODE = "c"; - private static final String APPLICATION_ID = "i"; - - @Override public String pathSpec() { - return "/application/register"; - } - - @Override protected JsonElement doGet(HttpServletRequest req) throws ArgumentsParseException { - throw new UnsupportedOperationException(); - } - - @Override protected JsonElement doPost(HttpServletRequest req) throws ArgumentsParseException { - JsonArray responseArray = new JsonArray(); - try { - JsonArray applicationCodes = gson.fromJson(req.getReader(), JsonArray.class); - for (int i = 0; i < applicationCodes.size(); i++) { - String applicationCode = applicationCodes.get(i).getAsString(); - int applicationId = applicationIDService.getOrCreate(applicationCode); - JsonObject mapping = new JsonObject(); - mapping.addProperty(APPLICATION_CODE, applicationCode); - mapping.addProperty(APPLICATION_ID, applicationId); - responseArray.add(mapping); - } - } catch (IOException e) { - logger.error(e.getMessage(), e); - } - return responseArray; - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/jetty/handler/InstanceDiscoveryServletHandler.java b/apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/jetty/handler/InstanceDiscoveryServletHandler.java deleted file mode 100644 index 1e847b1f34..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/jetty/handler/InstanceDiscoveryServletHandler.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentregister.jetty.handler; - -import com.google.gson.Gson; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import java.io.IOException; -import javax.servlet.http.HttpServletRequest; -import org.skywalking.apm.collector.agentregister.instance.InstanceIDService; -import org.skywalking.apm.collector.server.jetty.ArgumentsParseException; -import org.skywalking.apm.collector.server.jetty.JettyHandler; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class InstanceDiscoveryServletHandler extends JettyHandler { - - private final Logger logger = LoggerFactory.getLogger(InstanceDiscoveryServletHandler.class); - - private InstanceIDService instanceIDService = new InstanceIDService(); - private Gson gson = new Gson(); - - private static final String APPLICATION_ID = "ai"; - private static final String AGENT_UUID = "au"; - private static final String REGISTER_TIME = "rt"; - private static final String INSTANCE_ID = "ii"; - private static final String OS_INFO = "oi"; - - @Override public String pathSpec() { - return "/instance/register"; - } - - @Override protected JsonElement doGet(HttpServletRequest req) throws ArgumentsParseException { - throw new UnsupportedOperationException(); - } - - @Override protected JsonElement doPost(HttpServletRequest req) throws ArgumentsParseException { - JsonObject responseJson = new JsonObject(); - try { - JsonObject instance = gson.fromJson(req.getReader(), JsonObject.class); - int applicationId = instance.get(APPLICATION_ID).getAsInt(); - String agentUUID = instance.get(AGENT_UUID).getAsString(); - long registerTime = instance.get(REGISTER_TIME).getAsLong(); - JsonObject osInfo = instance.get(OS_INFO).getAsJsonObject(); - - int instanceId = instanceIDService.getOrCreate(applicationId, agentUUID, registerTime, osInfo.toString()); - responseJson.addProperty(APPLICATION_ID, applicationId); - responseJson.addProperty(INSTANCE_ID, instanceId); - } catch (IOException e) { - logger.error(e.getMessage(), e); - } - return responseJson; - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/jetty/handler/ServiceNameDiscoveryServiceHandler.java b/apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/jetty/handler/ServiceNameDiscoveryServiceHandler.java deleted file mode 100644 index 87f8083d53..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/jetty/handler/ServiceNameDiscoveryServiceHandler.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentregister.jetty.handler; - -import com.google.gson.Gson; -import com.google.gson.JsonArray; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import java.io.IOException; -import javax.servlet.http.HttpServletRequest; -import org.skywalking.apm.collector.agentregister.servicename.ServiceNameService; -import org.skywalking.apm.collector.server.jetty.ArgumentsParseException; -import org.skywalking.apm.collector.server.jetty.JettyHandler; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class ServiceNameDiscoveryServiceHandler extends JettyHandler { - - private final Logger logger = LoggerFactory.getLogger(ServiceNameDiscoveryServiceHandler.class); - - private ServiceNameService serviceNameService = new ServiceNameService(); - private Gson gson = new Gson(); - - @Override public String pathSpec() { - return "/servicename/discovery"; - } - - private static final String APPLICATION_ID = "ai"; - private static final String SERVICE_NAME = "sn"; - private static final String SERVICE_ID = "si"; - private static final String ELEMENT = "el"; - - @Override protected JsonElement doGet(HttpServletRequest req) throws ArgumentsParseException { - throw new UnsupportedOperationException(); - } - - @Override protected JsonElement doPost(HttpServletRequest req) throws ArgumentsParseException { - JsonArray responseArray = new JsonArray(); - try { - JsonArray services = gson.fromJson(req.getReader(), JsonArray.class); - for (JsonElement service : services) { - int applicationId = service.getAsJsonObject().get(APPLICATION_ID).getAsInt(); - String serviceName = service.getAsJsonObject().get(SERVICE_NAME).getAsString(); - - int serviceId = serviceNameService.getOrCreate(applicationId, serviceName); - if (serviceId != 0) { - JsonObject responseJson = new JsonObject(); - responseJson.addProperty(SERVICE_ID, serviceId); - responseJson.add(ELEMENT, service); - responseArray.add(responseJson); - } - } - } catch (IOException e) { - logger.error(e.getMessage(), e); - } - return responseArray; - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/servicename/ServiceNameService.java b/apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/servicename/ServiceNameService.java deleted file mode 100644 index f1d5c32b03..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/servicename/ServiceNameService.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentregister.servicename; - -import org.skywalking.apm.collector.agentregister.worker.servicename.ServiceNameRegisterRemoteWorker; -import org.skywalking.apm.collector.cache.dao.IServiceNameCacheDAO; -import org.skywalking.apm.collector.core.framework.CollectorContextHelper; -import org.skywalking.apm.collector.storage.base.dao.DAOContainer; -import org.skywalking.apm.collector.storage.base.define.register.ServiceNameDataDefine; -import org.skywalking.apm.collector.stream.StreamModuleContext; -import org.skywalking.apm.collector.stream.StreamModuleGroupDefine; -import org.skywalking.apm.collector.stream.worker.WorkerInvokeException; -import org.skywalking.apm.collector.stream.worker.WorkerNotFoundException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class ServiceNameService { - - private final Logger logger = LoggerFactory.getLogger(ServiceNameService.class); - - public int getOrCreate(int applicationId, String serviceName) { - IServiceNameCacheDAO dao = (IServiceNameCacheDAO)DAOContainer.INSTANCE.get(IServiceNameCacheDAO.class.getName()); - int serviceId = dao.getServiceId(applicationId, serviceName); - - if (serviceId == 0) { - StreamModuleContext context = (StreamModuleContext)CollectorContextHelper.INSTANCE.getContext(StreamModuleGroupDefine.GROUP_NAME); - ServiceNameDataDefine.ServiceName service = new ServiceNameDataDefine.ServiceName("0", serviceName, applicationId, 0); - try { - context.getClusterWorkerContext().lookup(ServiceNameRegisterRemoteWorker.WorkerRole.INSTANCE).tell(service); - } catch (WorkerNotFoundException | WorkerInvokeException e) { - logger.error(e.getMessage(), e); - } - } - return serviceId; - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/IdAutoIncrement.java b/apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/IdAutoIncrement.java deleted file mode 100644 index a9e06117b2..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/IdAutoIncrement.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentregister.worker; - -/** - * @author peng-yongsheng - */ -public enum IdAutoIncrement { - INSTANCE; - - public int increment(int min, int max) { - int instanceId; - if (min == max) { - instanceId = -1; - } else if (min + max == 0) { - instanceId = max + 1; - } else if (min + max > 0) { - instanceId = min - 1; - } else if (max < 0) { - instanceId = 1; - } else { - instanceId = max + 1; - } - return instanceId; - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/application/ApplicationEsTableDefine.java b/apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/application/ApplicationEsTableDefine.java deleted file mode 100644 index 2189cd2b10..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/application/ApplicationEsTableDefine.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentregister.worker.application; - -import org.skywalking.apm.collector.storage.base.define.register.ApplicationTable; -import org.skywalking.apm.collector.storage.elasticsearch.define.ElasticSearchColumnDefine; -import org.skywalking.apm.collector.storage.elasticsearch.define.ElasticSearchTableDefine; - -/** - * @author peng-yongsheng - */ -public class ApplicationEsTableDefine extends ElasticSearchTableDefine { - - public ApplicationEsTableDefine() { - super(ApplicationTable.TABLE); - } - - @Override public int refreshInterval() { - return 2; - } - - @Override public void initialize() { - addColumn(new ElasticSearchColumnDefine(ApplicationTable.COLUMN_APPLICATION_CODE, ElasticSearchColumnDefine.Type.Keyword.name())); - addColumn(new ElasticSearchColumnDefine(ApplicationTable.COLUMN_APPLICATION_ID, ElasticSearchColumnDefine.Type.Integer.name())); - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/application/ApplicationH2TableDefine.java b/apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/application/ApplicationH2TableDefine.java deleted file mode 100644 index e8da1a567d..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/application/ApplicationH2TableDefine.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentregister.worker.application; - -import org.skywalking.apm.collector.storage.base.define.global.GlobalTraceTable; -import org.skywalking.apm.collector.storage.base.define.register.ApplicationTable; -import org.skywalking.apm.collector.storage.h2.base.define.H2ColumnDefine; -import org.skywalking.apm.collector.storage.h2.base.define.H2TableDefine; - -/** - * @author peng-yongsheng - */ -public class ApplicationH2TableDefine extends H2TableDefine { - - public ApplicationH2TableDefine() { - super(ApplicationTable.TABLE); - } - - @Override public void initialize() { - addColumn(new H2ColumnDefine(GlobalTraceTable.COLUMN_ID, H2ColumnDefine.Type.Varchar.name())); - addColumn(new H2ColumnDefine(ApplicationTable.COLUMN_APPLICATION_CODE, H2ColumnDefine.Type.Varchar.name())); - addColumn(new H2ColumnDefine(ApplicationTable.COLUMN_APPLICATION_ID, H2ColumnDefine.Type.Int.name())); - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/application/ApplicationRegisterRemoteWorker.java b/apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/application/ApplicationRegisterRemoteWorker.java deleted file mode 100644 index f3cf8bd5be..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/application/ApplicationRegisterRemoteWorker.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentregister.worker.application; - -import org.skywalking.apm.collector.storage.base.define.DataDefine; -import org.skywalking.apm.collector.storage.base.define.register.ApplicationDataDefine; -import org.skywalking.apm.collector.stream.worker.AbstractRemoteWorker; -import org.skywalking.apm.collector.stream.worker.AbstractRemoteWorkerProvider; -import org.skywalking.apm.collector.stream.worker.ClusterWorkerContext; -import org.skywalking.apm.collector.stream.worker.ProviderNotFoundException; -import org.skywalking.apm.collector.stream.worker.Role; -import org.skywalking.apm.collector.stream.worker.WorkerException; -import org.skywalking.apm.collector.stream.worker.selector.ForeverFirstSelector; -import org.skywalking.apm.collector.stream.worker.selector.WorkerSelector; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class ApplicationRegisterRemoteWorker extends AbstractRemoteWorker { - - private final Logger logger = LoggerFactory.getLogger(ApplicationRegisterRemoteWorker.class); - - protected ApplicationRegisterRemoteWorker(Role role, ClusterWorkerContext clusterContext) { - super(role, clusterContext); - } - - @Override public void preStart() throws ProviderNotFoundException { - } - - @Override protected void onWork(Object message) throws WorkerException { - ApplicationDataDefine.Application application = (ApplicationDataDefine.Application)message; - logger.debug("application code: {}", application.getApplicationCode()); - getClusterContext().lookup(ApplicationRegisterSerialWorker.WorkerRole.INSTANCE).tell(application); - } - - public static class Factory extends AbstractRemoteWorkerProvider { - @Override - public Role role() { - return WorkerRole.INSTANCE; - } - - @Override - public ApplicationRegisterRemoteWorker workerInstance(ClusterWorkerContext clusterContext) { - return new ApplicationRegisterRemoteWorker(role(), clusterContext); - } - } - - public enum WorkerRole implements Role { - INSTANCE; - - @Override - public String roleName() { - return ApplicationRegisterRemoteWorker.class.getSimpleName(); - } - - @Override - public WorkerSelector workerSelector() { - return new ForeverFirstSelector(); - } - - @Override public DataDefine dataDefine() { - return new ApplicationDataDefine(); - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/application/ApplicationRegisterSerialWorker.java b/apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/application/ApplicationRegisterSerialWorker.java deleted file mode 100644 index 4c23127028..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/application/ApplicationRegisterSerialWorker.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentregister.worker.application; - -import org.skywalking.apm.collector.agentregister.worker.IdAutoIncrement; -import org.skywalking.apm.collector.agentregister.worker.application.dao.IApplicationDAO; -import org.skywalking.apm.collector.cache.dao.IApplicationCacheDAO; -import org.skywalking.apm.collector.core.util.Const; -import org.skywalking.apm.collector.storage.base.dao.DAOContainer; -import org.skywalking.apm.collector.storage.base.define.DataDefine; -import org.skywalking.apm.collector.storage.base.define.register.ApplicationDataDefine; -import org.skywalking.apm.collector.stream.worker.AbstractLocalAsyncWorker; -import org.skywalking.apm.collector.stream.worker.AbstractLocalAsyncWorkerProvider; -import org.skywalking.apm.collector.stream.worker.ClusterWorkerContext; -import org.skywalking.apm.collector.stream.worker.ProviderNotFoundException; -import org.skywalking.apm.collector.stream.worker.Role; -import org.skywalking.apm.collector.stream.worker.WorkerException; -import org.skywalking.apm.collector.stream.worker.selector.ForeverFirstSelector; -import org.skywalking.apm.collector.stream.worker.selector.WorkerSelector; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class ApplicationRegisterSerialWorker extends AbstractLocalAsyncWorker { - - private final Logger logger = LoggerFactory.getLogger(ApplicationRegisterSerialWorker.class); - - public ApplicationRegisterSerialWorker(Role role, ClusterWorkerContext clusterContext) { - super(role, clusterContext); - } - - @Override public void preStart() throws ProviderNotFoundException { - super.preStart(); - } - - @Override protected void onWork(Object message) throws WorkerException { - if (message instanceof ApplicationDataDefine.Application) { - ApplicationDataDefine.Application application = (ApplicationDataDefine.Application)message; - logger.debug("register application, application code: {}", application.getApplicationCode()); - - IApplicationCacheDAO cacheDao = (IApplicationCacheDAO)DAOContainer.INSTANCE.get(IApplicationCacheDAO.class.getName()); - int applicationId = cacheDao.getApplicationId(application.getApplicationCode()); - - IApplicationDAO dao = (IApplicationDAO)DAOContainer.INSTANCE.get(IApplicationDAO.class.getName()); - if (applicationId == 0) { - int min = dao.getMinApplicationId(); - if (min == 0) { - ApplicationDataDefine.Application userApplication = new ApplicationDataDefine.Application(String.valueOf(Const.USER_ID), Const.USER_CODE, Const.USER_ID); - dao.save(userApplication); - - application.setApplicationId(-1); - application.setId("-1"); - } else { - int max = dao.getMaxApplicationId(); - applicationId = IdAutoIncrement.INSTANCE.increment(min, max); - application.setApplicationId(applicationId); - application.setId(String.valueOf(applicationId)); - } - dao.save(application); - } - } - } - - public static class Factory extends AbstractLocalAsyncWorkerProvider { - @Override - public Role role() { - return WorkerRole.INSTANCE; - } - - @Override - public ApplicationRegisterSerialWorker workerInstance(ClusterWorkerContext clusterContext) { - return new ApplicationRegisterSerialWorker(role(), clusterContext); - } - - @Override public int queueSize() { - return 256; - } - } - - public enum WorkerRole implements Role { - INSTANCE; - - @Override - public String roleName() { - return ApplicationRegisterSerialWorker.class.getSimpleName(); - } - - @Override - public WorkerSelector workerSelector() { - return new ForeverFirstSelector(); - } - - @Override public DataDefine dataDefine() { - return new ApplicationDataDefine(); - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/application/dao/ApplicationEsDAO.java b/apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/application/dao/ApplicationEsDAO.java deleted file mode 100644 index 93c8933c7d..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/application/dao/ApplicationEsDAO.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentregister.worker.application.dao; - -import java.util.HashMap; -import java.util.Map; -import org.elasticsearch.action.index.IndexResponse; -import org.elasticsearch.action.support.WriteRequest; -import org.skywalking.apm.collector.client.elasticsearch.ElasticSearchClient; -import org.skywalking.apm.collector.storage.base.define.register.ApplicationDataDefine; -import org.skywalking.apm.collector.storage.base.define.register.ApplicationTable; -import org.skywalking.apm.collector.storage.elasticsearch.dao.EsDAO; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class ApplicationEsDAO extends EsDAO implements IApplicationDAO { - - private final Logger logger = LoggerFactory.getLogger(ApplicationEsDAO.class); - - @Override public int getMaxApplicationId() { - return getMaxId(ApplicationTable.TABLE, ApplicationTable.COLUMN_APPLICATION_ID); - } - - @Override public int getMinApplicationId() { - return getMinId(ApplicationTable.TABLE, ApplicationTable.COLUMN_APPLICATION_ID); - } - - @Override public void save(ApplicationDataDefine.Application application) { - logger.debug("save application register info, application id: {}, application code: {}", application.getApplicationId(), application.getApplicationCode()); - ElasticSearchClient client = getClient(); - Map source = new HashMap<>(); - source.put(ApplicationTable.COLUMN_APPLICATION_CODE, application.getApplicationCode()); - source.put(ApplicationTable.COLUMN_APPLICATION_ID, application.getApplicationId()); - - IndexResponse response = client.prepareIndex(ApplicationTable.TABLE, application.getId()).setSource(source).setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE).get(); - logger.debug("save application register info, application id: {}, application code: {}, status: {}", application.getApplicationId(), application.getApplicationCode(), response.status().name()); - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/application/dao/ApplicationH2DAO.java b/apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/application/dao/ApplicationH2DAO.java deleted file mode 100644 index 99c372bb9d..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/application/dao/ApplicationH2DAO.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentregister.worker.application.dao; - -import java.util.HashMap; -import java.util.Map; -import org.skywalking.apm.collector.client.h2.H2Client; -import org.skywalking.apm.collector.client.h2.H2ClientException; -import org.skywalking.apm.collector.storage.base.define.register.ApplicationDataDefine; -import org.skywalking.apm.collector.storage.base.define.register.ApplicationTable; -import org.skywalking.apm.collector.storage.h2.SqlBuilder; -import org.skywalking.apm.collector.storage.h2.base.dao.H2DAO; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng, clevertension - */ -public class ApplicationH2DAO extends H2DAO implements IApplicationDAO { - private final Logger logger = LoggerFactory.getLogger(ApplicationH2DAO.class); - - @Override - public int getMaxApplicationId() { - return getMaxId(ApplicationTable.TABLE, ApplicationTable.COLUMN_APPLICATION_ID); - } - - @Override - public int getMinApplicationId() { - return getMinId(ApplicationTable.TABLE, ApplicationTable.COLUMN_APPLICATION_ID); - } - - @Override - public void save(ApplicationDataDefine.Application application) { - H2Client client = getClient(); - - Map source = new HashMap<>(); - source.put(ApplicationTable.COLUMN_ID, application.getApplicationId()); - source.put(ApplicationTable.COLUMN_APPLICATION_CODE, application.getApplicationCode()); - source.put(ApplicationTable.COLUMN_APPLICATION_ID, application.getApplicationId()); - - String sql = SqlBuilder.buildBatchInsertSql(ApplicationTable.TABLE, source.keySet()); - Object[] params = source.values().toArray(new Object[0]); - try { - client.execute(sql, params); - } catch (H2ClientException e) { - logger.error(e.getMessage(), e); - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/application/dao/IApplicationDAO.java b/apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/application/dao/IApplicationDAO.java deleted file mode 100644 index 2e6d56eedf..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/application/dao/IApplicationDAO.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentregister.worker.application.dao; - -import org.skywalking.apm.collector.storage.base.define.register.ApplicationDataDefine; - -/** - * @author peng-yongsheng - */ -public interface IApplicationDAO { - int getMaxApplicationId(); - - int getMinApplicationId(); - - void save(ApplicationDataDefine.Application application); -} diff --git a/apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/instance/InstanceEsTableDefine.java b/apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/instance/InstanceEsTableDefine.java deleted file mode 100644 index 34fc05e95e..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/instance/InstanceEsTableDefine.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentregister.worker.instance; - -import org.skywalking.apm.collector.storage.base.define.register.InstanceTable; -import org.skywalking.apm.collector.storage.elasticsearch.define.ElasticSearchColumnDefine; -import org.skywalking.apm.collector.storage.elasticsearch.define.ElasticSearchTableDefine; - -/** - * @author peng-yongsheng - */ -public class InstanceEsTableDefine extends ElasticSearchTableDefine { - - public InstanceEsTableDefine() { - super(InstanceTable.TABLE); - } - - @Override public int refreshInterval() { - return 2; - } - - @Override public void initialize() { - addColumn(new ElasticSearchColumnDefine(InstanceTable.COLUMN_APPLICATION_ID, ElasticSearchColumnDefine.Type.Integer.name())); - addColumn(new ElasticSearchColumnDefine(InstanceTable.COLUMN_AGENT_UUID, ElasticSearchColumnDefine.Type.Keyword.name())); - addColumn(new ElasticSearchColumnDefine(InstanceTable.COLUMN_REGISTER_TIME, ElasticSearchColumnDefine.Type.Long.name())); - addColumn(new ElasticSearchColumnDefine(InstanceTable.COLUMN_INSTANCE_ID, ElasticSearchColumnDefine.Type.Integer.name())); - addColumn(new ElasticSearchColumnDefine(InstanceTable.COLUMN_HEARTBEAT_TIME, ElasticSearchColumnDefine.Type.Long.name())); - addColumn(new ElasticSearchColumnDefine(InstanceTable.COLUMN_OS_INFO, ElasticSearchColumnDefine.Type.Keyword.name())); - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/instance/InstanceH2TableDefine.java b/apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/instance/InstanceH2TableDefine.java deleted file mode 100644 index 3a9fe3482d..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/instance/InstanceH2TableDefine.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentregister.worker.instance; - -import org.skywalking.apm.collector.storage.base.define.register.InstanceTable; -import org.skywalking.apm.collector.storage.h2.base.define.H2ColumnDefine; -import org.skywalking.apm.collector.storage.h2.base.define.H2TableDefine; - -/** - * @author peng-yongsheng - */ -public class InstanceH2TableDefine extends H2TableDefine { - - public InstanceH2TableDefine() { - super(InstanceTable.TABLE); - } - - @Override public void initialize() { - addColumn(new H2ColumnDefine(InstanceTable.COLUMN_ID, H2ColumnDefine.Type.Varchar.name())); - addColumn(new H2ColumnDefine(InstanceTable.COLUMN_APPLICATION_ID, H2ColumnDefine.Type.Int.name())); - addColumn(new H2ColumnDefine(InstanceTable.COLUMN_AGENT_UUID, H2ColumnDefine.Type.Varchar.name())); - addColumn(new H2ColumnDefine(InstanceTable.COLUMN_REGISTER_TIME, H2ColumnDefine.Type.Bigint.name())); - addColumn(new H2ColumnDefine(InstanceTable.COLUMN_INSTANCE_ID, H2ColumnDefine.Type.Int.name())); - addColumn(new H2ColumnDefine(InstanceTable.COLUMN_HEARTBEAT_TIME, H2ColumnDefine.Type.Bigint.name())); - addColumn(new H2ColumnDefine(InstanceTable.COLUMN_OS_INFO, H2ColumnDefine.Type.Varchar.name())); - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/instance/InstanceRegisterRemoteWorker.java b/apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/instance/InstanceRegisterRemoteWorker.java deleted file mode 100644 index e0613c3fda..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/instance/InstanceRegisterRemoteWorker.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentregister.worker.instance; - -import org.skywalking.apm.collector.storage.base.define.DataDefine; -import org.skywalking.apm.collector.storage.base.define.register.InstanceDataDefine; -import org.skywalking.apm.collector.stream.worker.AbstractRemoteWorker; -import org.skywalking.apm.collector.stream.worker.AbstractRemoteWorkerProvider; -import org.skywalking.apm.collector.stream.worker.ClusterWorkerContext; -import org.skywalking.apm.collector.stream.worker.ProviderNotFoundException; -import org.skywalking.apm.collector.stream.worker.Role; -import org.skywalking.apm.collector.stream.worker.WorkerException; -import org.skywalking.apm.collector.stream.worker.selector.ForeverFirstSelector; -import org.skywalking.apm.collector.stream.worker.selector.WorkerSelector; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class InstanceRegisterRemoteWorker extends AbstractRemoteWorker { - - private final Logger logger = LoggerFactory.getLogger(InstanceRegisterRemoteWorker.class); - - protected InstanceRegisterRemoteWorker(Role role, ClusterWorkerContext clusterContext) { - super(role, clusterContext); - } - - @Override public void preStart() throws ProviderNotFoundException { - } - - @Override protected void onWork(Object message) throws WorkerException { - InstanceDataDefine.Instance instance = (InstanceDataDefine.Instance)message; - logger.debug("application id: {}, agentUUID: {}, register time: {}", instance.getApplicationId(), instance.getAgentUUID(), instance.getRegisterTime()); - getClusterContext().lookup(InstanceRegisterSerialWorker.WorkerRole.INSTANCE).tell(instance); - } - - public static class Factory extends AbstractRemoteWorkerProvider { - @Override - public Role role() { - return WorkerRole.INSTANCE; - } - - @Override - public InstanceRegisterRemoteWorker workerInstance(ClusterWorkerContext clusterContext) { - return new InstanceRegisterRemoteWorker(role(), clusterContext); - } - } - - public enum WorkerRole implements Role { - INSTANCE; - - @Override - public String roleName() { - return InstanceRegisterRemoteWorker.class.getSimpleName(); - } - - @Override - public WorkerSelector workerSelector() { - return new ForeverFirstSelector(); - } - - @Override public DataDefine dataDefine() { - return new InstanceDataDefine(); - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/instance/InstanceRegisterSerialWorker.java b/apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/instance/InstanceRegisterSerialWorker.java deleted file mode 100644 index 4a6b0bf85f..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/instance/InstanceRegisterSerialWorker.java +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentregister.worker.instance; - -import org.skywalking.apm.collector.agentregister.worker.instance.dao.IInstanceDAO; -import org.skywalking.apm.collector.storage.base.dao.DAOContainer; -import org.skywalking.apm.collector.storage.base.define.DataDefine; -import org.skywalking.apm.collector.storage.base.define.register.ApplicationDataDefine; -import org.skywalking.apm.collector.storage.base.define.register.InstanceDataDefine; -import org.skywalking.apm.collector.stream.worker.AbstractLocalAsyncWorker; -import org.skywalking.apm.collector.stream.worker.AbstractLocalAsyncWorkerProvider; -import org.skywalking.apm.collector.stream.worker.ClusterWorkerContext; -import org.skywalking.apm.collector.stream.worker.ProviderNotFoundException; -import org.skywalking.apm.collector.stream.worker.Role; -import org.skywalking.apm.collector.stream.worker.WorkerException; -import org.skywalking.apm.collector.stream.worker.selector.ForeverFirstSelector; -import org.skywalking.apm.collector.stream.worker.selector.WorkerSelector; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class InstanceRegisterSerialWorker extends AbstractLocalAsyncWorker { - - private final Logger logger = LoggerFactory.getLogger(InstanceRegisterSerialWorker.class); - - public InstanceRegisterSerialWorker(Role role, ClusterWorkerContext clusterContext) { - super(role, clusterContext); - } - - @Override public void preStart() throws ProviderNotFoundException { - super.preStart(); - } - - @Override protected void onWork(Object message) throws WorkerException { - if (message instanceof InstanceDataDefine.Instance) { - InstanceDataDefine.Instance instance = (InstanceDataDefine.Instance)message; - logger.debug("register instance, application id: {}, agentUUID: {}", instance.getApplicationId(), instance.getAgentUUID()); - - IInstanceDAO dao = (IInstanceDAO)DAOContainer.INSTANCE.get(IInstanceDAO.class.getName()); - int instanceId = dao.getInstanceId(instance.getApplicationId(), instance.getAgentUUID()); - if (instanceId == 0) { -// int min = dao.getMinInstanceId(); -// if (min == 0) { -// instance.setId("1"); -// instance.setInstanceId(1); -// } else { -// int max = dao.getMaxInstanceId(); -// instanceId = IdAutoIncrement.INSTANCE.increment(min, max); -// instance.setId(String.valueOf(instanceId)); -// instance.setInstanceId(instanceId); -// } - int max = dao.getMaxInstanceId(); - if (max == 0) { - instance.setId("1"); - instance.setInstanceId(1); - } else { - instance.setId(String.valueOf(max + 1)); - instance.setInstanceId(max + 1); - } - - dao.save(instance); - } - } - } - - public static class Factory extends AbstractLocalAsyncWorkerProvider { - @Override - public Role role() { - return WorkerRole.INSTANCE; - } - - @Override - public InstanceRegisterSerialWorker workerInstance(ClusterWorkerContext clusterContext) { - return new InstanceRegisterSerialWorker(role(), clusterContext); - } - - @Override public int queueSize() { - return 256; - } - } - - public enum WorkerRole implements Role { - INSTANCE; - - @Override - public String roleName() { - return InstanceRegisterSerialWorker.class.getSimpleName(); - } - - @Override - public WorkerSelector workerSelector() { - return new ForeverFirstSelector(); - } - - @Override public DataDefine dataDefine() { - return new ApplicationDataDefine(); - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/instance/dao/IInstanceDAO.java b/apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/instance/dao/IInstanceDAO.java deleted file mode 100644 index 5d7972dfcf..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/instance/dao/IInstanceDAO.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentregister.worker.instance.dao; - -import org.skywalking.apm.collector.storage.base.define.register.InstanceDataDefine; - -/** - * @author peng-yongsheng - */ -public interface IInstanceDAO { - int getInstanceId(int applicationId, String agentUUID); - - int getMaxInstanceId(); - - int getMinInstanceId(); - - void save(InstanceDataDefine.Instance instance); - - void updateHeartbeatTime(int instanceId, long heartbeatTime); -} diff --git a/apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/instance/dao/InstanceEsDAO.java b/apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/instance/dao/InstanceEsDAO.java deleted file mode 100644 index 708c596f2d..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/instance/dao/InstanceEsDAO.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentregister.worker.instance.dao; - -import java.util.HashMap; -import java.util.Map; -import org.elasticsearch.action.index.IndexResponse; -import org.elasticsearch.action.search.SearchRequestBuilder; -import org.elasticsearch.action.search.SearchResponse; -import org.elasticsearch.action.search.SearchType; -import org.elasticsearch.action.support.WriteRequest; -import org.elasticsearch.action.update.UpdateRequest; -import org.elasticsearch.index.query.BoolQueryBuilder; -import org.elasticsearch.index.query.QueryBuilders; -import org.elasticsearch.search.SearchHit; -import org.skywalking.apm.collector.client.elasticsearch.ElasticSearchClient; -import org.skywalking.apm.collector.storage.base.define.register.InstanceDataDefine; -import org.skywalking.apm.collector.storage.base.define.register.InstanceTable; -import org.skywalking.apm.collector.storage.elasticsearch.dao.EsDAO; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class InstanceEsDAO extends EsDAO implements IInstanceDAO { - - private final Logger logger = LoggerFactory.getLogger(InstanceEsDAO.class); - - @Override public int getInstanceId(int applicationId, String agentUUID) { - ElasticSearchClient client = getClient(); - - SearchRequestBuilder searchRequestBuilder = client.prepareSearch(InstanceTable.TABLE); - searchRequestBuilder.setTypes("type"); - searchRequestBuilder.setSearchType(SearchType.QUERY_THEN_FETCH); - BoolQueryBuilder builder = QueryBuilders.boolQuery(); - builder.must().add(QueryBuilders.termQuery(InstanceTable.COLUMN_APPLICATION_ID, applicationId)); - builder.must().add(QueryBuilders.termQuery(InstanceTable.COLUMN_AGENT_UUID, agentUUID)); - searchRequestBuilder.setQuery(builder); - searchRequestBuilder.setSize(1); - - SearchResponse searchResponse = searchRequestBuilder.execute().actionGet(); - if (searchResponse.getHits().totalHits > 0) { - SearchHit searchHit = searchResponse.getHits().iterator().next(); - return (int)searchHit.getSource().get(InstanceTable.COLUMN_INSTANCE_ID); - } - return 0; - } - - @Override public int getMaxInstanceId() { - return getMaxId(InstanceTable.TABLE, InstanceTable.COLUMN_INSTANCE_ID); - } - - @Override public int getMinInstanceId() { - return getMinId(InstanceTable.TABLE, InstanceTable.COLUMN_INSTANCE_ID); - } - - @Override public void save(InstanceDataDefine.Instance instance) { - logger.debug("save instance register info, application id: {}, agentUUID: {}", instance.getApplicationId(), instance.getAgentUUID()); - ElasticSearchClient client = getClient(); - Map source = new HashMap<>(); - source.put(InstanceTable.COLUMN_INSTANCE_ID, instance.getInstanceId()); - source.put(InstanceTable.COLUMN_APPLICATION_ID, instance.getApplicationId()); - source.put(InstanceTable.COLUMN_AGENT_UUID, instance.getAgentUUID()); - source.put(InstanceTable.COLUMN_REGISTER_TIME, instance.getRegisterTime()); - source.put(InstanceTable.COLUMN_HEARTBEAT_TIME, instance.getHeartBeatTime()); - source.put(InstanceTable.COLUMN_OS_INFO, instance.getOsInfo()); - - IndexResponse response = client.prepareIndex(InstanceTable.TABLE, instance.getId()).setSource(source).setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE).get(); - logger.debug("save instance register info, application id: {}, agentUUID: {}, status: {}", instance.getApplicationId(), instance.getAgentUUID(), response.status().name()); - } - - @Override public void updateHeartbeatTime(int instanceId, long heartbeatTime) { - ElasticSearchClient client = getClient(); - UpdateRequest updateRequest = new UpdateRequest(); - updateRequest.index(InstanceTable.TABLE); - updateRequest.type("type"); - updateRequest.id(String.valueOf(instanceId)); - updateRequest.setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE); - - Map source = new HashMap<>(); - source.put(InstanceTable.COLUMN_HEARTBEAT_TIME, heartbeatTime); - - updateRequest.doc(source); - client.update(updateRequest); - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/instance/dao/InstanceH2DAO.java b/apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/instance/dao/InstanceH2DAO.java deleted file mode 100644 index 5c45b56a2b..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/instance/dao/InstanceH2DAO.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentregister.worker.instance.dao; - -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.HashMap; -import java.util.Map; -import org.skywalking.apm.collector.client.h2.H2Client; -import org.skywalking.apm.collector.client.h2.H2ClientException; -import org.skywalking.apm.collector.storage.base.define.register.InstanceDataDefine; -import org.skywalking.apm.collector.storage.base.define.register.InstanceTable; -import org.skywalking.apm.collector.storage.h2.SqlBuilder; -import org.skywalking.apm.collector.storage.h2.base.dao.H2DAO; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng, clevertension - */ -public class InstanceH2DAO extends H2DAO implements IInstanceDAO { - private final Logger logger = LoggerFactory.getLogger(InstanceH2DAO.class); - - private static final String GET_INSTANCE_ID_SQL = "select {0} from {1} where {2} = ? and {3} = ?"; - private static final String UPDATE_HEARTBEAT_TIME_SQL = "update {0} set {1} = ? where {2} = ?"; - - @Override public int getInstanceId(int applicationId, String agentUUID) { - logger.info("get the application id with application id = {}, agentUUID = {}", applicationId, agentUUID); - H2Client client = getClient(); - String sql = SqlBuilder.buildSql(GET_INSTANCE_ID_SQL, InstanceTable.COLUMN_INSTANCE_ID, InstanceTable.TABLE, InstanceTable.COLUMN_APPLICATION_ID, - InstanceTable.COLUMN_AGENT_UUID); - Object[] params = new Object[] {applicationId, agentUUID}; - try (ResultSet rs = client.executeQuery(sql, params)) { - if (rs.next()) { - return rs.getInt(InstanceTable.COLUMN_INSTANCE_ID); - } - } catch (SQLException | H2ClientException e) { - logger.error(e.getMessage(), e); - } - return 0; - } - - @Override public int getMaxInstanceId() { - return getMaxId(InstanceTable.TABLE, InstanceTable.COLUMN_INSTANCE_ID); - } - - @Override public int getMinInstanceId() { - return getMinId(InstanceTable.TABLE, InstanceTable.COLUMN_INSTANCE_ID); - } - - @Override public void save(InstanceDataDefine.Instance instance) { - H2Client client = getClient(); - Map source = new HashMap<>(); - source.put(InstanceTable.COLUMN_ID, instance.getId()); - source.put(InstanceTable.COLUMN_INSTANCE_ID, instance.getInstanceId()); - source.put(InstanceTable.COLUMN_APPLICATION_ID, instance.getApplicationId()); - source.put(InstanceTable.COLUMN_AGENT_UUID, instance.getAgentUUID()); - source.put(InstanceTable.COLUMN_REGISTER_TIME, instance.getRegisterTime()); - source.put(InstanceTable.COLUMN_HEARTBEAT_TIME, instance.getHeartBeatTime()); - source.put(InstanceTable.COLUMN_OS_INFO, instance.getOsInfo()); - String sql = SqlBuilder.buildBatchInsertSql(InstanceTable.TABLE, source.keySet()); - Object[] params = source.values().toArray(new Object[0]); - try { - client.execute(sql, params); - } catch (H2ClientException e) { - logger.error(e.getMessage(), e); - } - } - - @Override public void updateHeartbeatTime(int instanceId, long heartbeatTime) { - H2Client client = getClient(); - String sql = SqlBuilder.buildSql(UPDATE_HEARTBEAT_TIME_SQL, InstanceTable.TABLE, InstanceTable.COLUMN_HEARTBEAT_TIME, - InstanceTable.COLUMN_ID); - Object[] params = new Object[] {heartbeatTime, instanceId}; - try { - client.execute(sql, params); - } catch (H2ClientException e) { - logger.error(e.getMessage(), e); - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/servicename/ServiceNameEsTableDefine.java b/apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/servicename/ServiceNameEsTableDefine.java deleted file mode 100644 index 73ad1be033..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/servicename/ServiceNameEsTableDefine.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentregister.worker.servicename; - -import org.skywalking.apm.collector.storage.base.define.register.ServiceNameTable; -import org.skywalking.apm.collector.storage.elasticsearch.define.ElasticSearchColumnDefine; -import org.skywalking.apm.collector.storage.elasticsearch.define.ElasticSearchTableDefine; - -/** - * @author peng-yongsheng - */ -public class ServiceNameEsTableDefine extends ElasticSearchTableDefine { - - public ServiceNameEsTableDefine() { - super(ServiceNameTable.TABLE); - } - - @Override public int refreshInterval() { - return 2; - } - - @Override public void initialize() { - addColumn(new ElasticSearchColumnDefine(ServiceNameTable.COLUMN_APPLICATION_ID, ElasticSearchColumnDefine.Type.Integer.name())); - addColumn(new ElasticSearchColumnDefine(ServiceNameTable.COLUMN_SERVICE_NAME, ElasticSearchColumnDefine.Type.Keyword.name())); - addColumn(new ElasticSearchColumnDefine(ServiceNameTable.COLUMN_SERVICE_ID, ElasticSearchColumnDefine.Type.Integer.name())); - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/servicename/ServiceNameH2TableDefine.java b/apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/servicename/ServiceNameH2TableDefine.java deleted file mode 100644 index c47813a9e2..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/servicename/ServiceNameH2TableDefine.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentregister.worker.servicename; - -import org.skywalking.apm.collector.storage.base.define.register.ServiceNameTable; -import org.skywalking.apm.collector.storage.h2.base.define.H2ColumnDefine; -import org.skywalking.apm.collector.storage.h2.base.define.H2TableDefine; - -/** - * @author peng-yongsheng - */ -public class ServiceNameH2TableDefine extends H2TableDefine { - - public ServiceNameH2TableDefine() { - super(ServiceNameTable.TABLE); - } - - @Override public void initialize() { - addColumn(new H2ColumnDefine(ServiceNameTable.COLUMN_ID, H2ColumnDefine.Type.Varchar.name())); - addColumn(new H2ColumnDefine(ServiceNameTable.COLUMN_APPLICATION_ID, H2ColumnDefine.Type.Int.name())); - addColumn(new H2ColumnDefine(ServiceNameTable.COLUMN_SERVICE_NAME, H2ColumnDefine.Type.Varchar.name())); - addColumn(new H2ColumnDefine(ServiceNameTable.COLUMN_SERVICE_ID, H2ColumnDefine.Type.Int.name())); - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/servicename/ServiceNameRegisterRemoteWorker.java b/apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/servicename/ServiceNameRegisterRemoteWorker.java deleted file mode 100644 index bb498be0da..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/servicename/ServiceNameRegisterRemoteWorker.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentregister.worker.servicename; - -import org.skywalking.apm.collector.storage.base.define.DataDefine; -import org.skywalking.apm.collector.storage.base.define.register.ServiceNameDataDefine; -import org.skywalking.apm.collector.stream.worker.AbstractRemoteWorker; -import org.skywalking.apm.collector.stream.worker.AbstractRemoteWorkerProvider; -import org.skywalking.apm.collector.stream.worker.ClusterWorkerContext; -import org.skywalking.apm.collector.stream.worker.ProviderNotFoundException; -import org.skywalking.apm.collector.stream.worker.Role; -import org.skywalking.apm.collector.stream.worker.WorkerException; -import org.skywalking.apm.collector.stream.worker.selector.ForeverFirstSelector; -import org.skywalking.apm.collector.stream.worker.selector.WorkerSelector; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class ServiceNameRegisterRemoteWorker extends AbstractRemoteWorker { - - private final Logger logger = LoggerFactory.getLogger(ServiceNameRegisterRemoteWorker.class); - - protected ServiceNameRegisterRemoteWorker(Role role, ClusterWorkerContext clusterContext) { - super(role, clusterContext); - } - - @Override public void preStart() throws ProviderNotFoundException { - } - - @Override protected void onWork(Object message) throws WorkerException { - ServiceNameDataDefine.ServiceName serviceName = (ServiceNameDataDefine.ServiceName)message; - logger.debug("service name: {}", serviceName.getServiceName()); - getClusterContext().lookup(ServiceNameRegisterSerialWorker.WorkerRole.INSTANCE).tell(serviceName); - } - - public static class Factory extends AbstractRemoteWorkerProvider { - @Override - public Role role() { - return WorkerRole.INSTANCE; - } - - @Override - public ServiceNameRegisterRemoteWorker workerInstance(ClusterWorkerContext clusterContext) { - return new ServiceNameRegisterRemoteWorker(role(), clusterContext); - } - } - - public enum WorkerRole implements Role { - INSTANCE; - - @Override - public String roleName() { - return ServiceNameRegisterRemoteWorker.class.getSimpleName(); - } - - @Override - public WorkerSelector workerSelector() { - return new ForeverFirstSelector(); - } - - @Override public DataDefine dataDefine() { - return new ServiceNameDataDefine(); - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/servicename/ServiceNameRegisterSerialWorker.java b/apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/servicename/ServiceNameRegisterSerialWorker.java deleted file mode 100644 index 34abe51a2e..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/servicename/ServiceNameRegisterSerialWorker.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentregister.worker.servicename; - -import org.skywalking.apm.collector.agentregister.worker.IdAutoIncrement; -import org.skywalking.apm.collector.agentregister.worker.servicename.dao.IServiceNameDAO; -import org.skywalking.apm.collector.cache.dao.IServiceNameCacheDAO; -import org.skywalking.apm.collector.core.util.Const; -import org.skywalking.apm.collector.storage.base.dao.DAOContainer; -import org.skywalking.apm.collector.storage.base.define.DataDefine; -import org.skywalking.apm.collector.storage.base.define.register.ServiceNameDataDefine; -import org.skywalking.apm.collector.stream.worker.AbstractLocalAsyncWorker; -import org.skywalking.apm.collector.stream.worker.AbstractLocalAsyncWorkerProvider; -import org.skywalking.apm.collector.stream.worker.ClusterWorkerContext; -import org.skywalking.apm.collector.stream.worker.ProviderNotFoundException; -import org.skywalking.apm.collector.stream.worker.Role; -import org.skywalking.apm.collector.stream.worker.WorkerException; -import org.skywalking.apm.collector.stream.worker.selector.ForeverFirstSelector; -import org.skywalking.apm.collector.stream.worker.selector.WorkerSelector; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class ServiceNameRegisterSerialWorker extends AbstractLocalAsyncWorker { - - private final Logger logger = LoggerFactory.getLogger(ServiceNameRegisterSerialWorker.class); - - public ServiceNameRegisterSerialWorker(Role role, ClusterWorkerContext clusterContext) { - super(role, clusterContext); - } - - @Override public void preStart() throws ProviderNotFoundException { - super.preStart(); - } - - @Override protected void onWork(Object message) throws WorkerException { - if (message instanceof ServiceNameDataDefine.ServiceName) { - ServiceNameDataDefine.ServiceName serviceName = (ServiceNameDataDefine.ServiceName)message; - logger.debug("register service name: {}, application id: {}", serviceName.getServiceName(), serviceName.getApplicationId()); - - IServiceNameCacheDAO cacheDao = (IServiceNameCacheDAO)DAOContainer.INSTANCE.get(IServiceNameCacheDAO.class.getName()); - int serviceId = cacheDao.getServiceId(serviceName.getApplicationId(), serviceName.getServiceName()); - - IServiceNameDAO dao = (IServiceNameDAO)DAOContainer.INSTANCE.get(IServiceNameDAO.class.getName()); - if (serviceId == 0) { - int min = dao.getMinServiceId(); - if (min == 0) { - ServiceNameDataDefine.ServiceName noneServiceName = new ServiceNameDataDefine.ServiceName("1", Const.NONE_SERVICE_NAME, 0, Const.NONE_SERVICE_ID); - dao.save(noneServiceName); - - serviceName.setServiceId(-1); - serviceName.setId("-1"); - } else { - int max = dao.getMaxServiceId(); - serviceId = IdAutoIncrement.INSTANCE.increment(min, max); - serviceName.setId(String.valueOf(serviceId)); - serviceName.setServiceId(serviceId); - } - dao.save(serviceName); - } - } - } - - public static class Factory extends AbstractLocalAsyncWorkerProvider { - @Override - public Role role() { - return WorkerRole.INSTANCE; - } - - @Override - public ServiceNameRegisterSerialWorker workerInstance(ClusterWorkerContext clusterContext) { - return new ServiceNameRegisterSerialWorker(role(), clusterContext); - } - - @Override public int queueSize() { - return 256; - } - } - - public enum WorkerRole implements Role { - INSTANCE; - - @Override - public String roleName() { - return ServiceNameRegisterSerialWorker.class.getSimpleName(); - } - - @Override - public WorkerSelector workerSelector() { - return new ForeverFirstSelector(); - } - - @Override public DataDefine dataDefine() { - return new ServiceNameDataDefine(); - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/servicename/dao/IServiceNameDAO.java b/apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/servicename/dao/IServiceNameDAO.java deleted file mode 100644 index 3326998e73..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/servicename/dao/IServiceNameDAO.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentregister.worker.servicename.dao; - -import org.skywalking.apm.collector.storage.base.define.register.ServiceNameDataDefine; - -/** - * @author peng-yongsheng - */ -public interface IServiceNameDAO { - int getMaxServiceId(); - - int getMinServiceId(); - - void save(ServiceNameDataDefine.ServiceName serviceName); -} diff --git a/apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/servicename/dao/ServiceNameEsDAO.java b/apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/servicename/dao/ServiceNameEsDAO.java deleted file mode 100644 index 9c4a79bed2..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/servicename/dao/ServiceNameEsDAO.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentregister.worker.servicename.dao; - -import java.util.HashMap; -import java.util.Map; -import org.elasticsearch.action.index.IndexResponse; -import org.elasticsearch.action.support.WriteRequest; -import org.skywalking.apm.collector.client.elasticsearch.ElasticSearchClient; -import org.skywalking.apm.collector.storage.base.define.register.ServiceNameDataDefine; -import org.skywalking.apm.collector.storage.base.define.register.ServiceNameTable; -import org.skywalking.apm.collector.storage.elasticsearch.dao.EsDAO; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class ServiceNameEsDAO extends EsDAO implements IServiceNameDAO { - - private final Logger logger = LoggerFactory.getLogger(ServiceNameEsDAO.class); - - @Override public int getMaxServiceId() { - return getMaxId(ServiceNameTable.TABLE, ServiceNameTable.COLUMN_SERVICE_ID); - } - - @Override public int getMinServiceId() { - return getMinId(ServiceNameTable.TABLE, ServiceNameTable.COLUMN_SERVICE_ID); - } - - @Override public void save(ServiceNameDataDefine.ServiceName serviceName) { - logger.debug("save service name register info, application id: {}, service name: {}", serviceName.getApplicationId(), serviceName.getServiceName()); - ElasticSearchClient client = getClient(); - Map source = new HashMap<>(); - source.put(ServiceNameTable.COLUMN_SERVICE_ID, serviceName.getServiceId()); - source.put(ServiceNameTable.COLUMN_APPLICATION_ID, serviceName.getApplicationId()); - source.put(ServiceNameTable.COLUMN_SERVICE_NAME, serviceName.getServiceName()); - - IndexResponse response = client.prepareIndex(ServiceNameTable.TABLE, serviceName.getId()).setSource(source).setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE).get(); - logger.debug("save service name register info, application id: {}, service name: {}, status: {}", serviceName.getApplicationId(), serviceName.getServiceName(), response.status().name()); - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/servicename/dao/ServiceNameH2DAO.java b/apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/servicename/dao/ServiceNameH2DAO.java deleted file mode 100644 index 9840930511..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentregister/src/main/java/org/skywalking/apm/collector/agentregister/worker/servicename/dao/ServiceNameH2DAO.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentregister.worker.servicename.dao; - -import java.util.HashMap; -import java.util.Map; -import org.skywalking.apm.collector.client.h2.H2Client; -import org.skywalking.apm.collector.client.h2.H2ClientException; -import org.skywalking.apm.collector.storage.base.define.register.ServiceNameDataDefine; -import org.skywalking.apm.collector.storage.base.define.register.ServiceNameTable; -import org.skywalking.apm.collector.storage.h2.SqlBuilder; -import org.skywalking.apm.collector.storage.h2.base.dao.H2DAO; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng, clevertension - */ -public class ServiceNameH2DAO extends H2DAO implements IServiceNameDAO { - private final Logger logger = LoggerFactory.getLogger(ServiceNameH2DAO.class); - - @Override - public int getMaxServiceId() { - return getMaxId(ServiceNameTable.TABLE, ServiceNameTable.COLUMN_SERVICE_ID); - } - - @Override - public int getMinServiceId() { - return getMinId(ServiceNameTable.TABLE, ServiceNameTable.COLUMN_SERVICE_ID); - } - - @Override - public void save(ServiceNameDataDefine.ServiceName serviceName) { - logger.debug("save service name register info, application id: {}, service name: {}", serviceName.getApplicationId(), serviceName.getServiceName()); - H2Client client = getClient(); - Map source = new HashMap<>(); - source.put(ServiceNameTable.COLUMN_ID, serviceName.getId()); - source.put(ServiceNameTable.COLUMN_SERVICE_ID, serviceName.getServiceId()); - source.put(ServiceNameTable.COLUMN_APPLICATION_ID, serviceName.getApplicationId()); - source.put(ServiceNameTable.COLUMN_SERVICE_NAME, serviceName.getServiceName()); - - String sql = SqlBuilder.buildBatchInsertSql(ServiceNameTable.TABLE, source.keySet()); - Object[] params = source.values().toArray(new Object[0]); - try { - client.execute(sql, params); - } catch (H2ClientException e) { - logger.error(e.getMessage(), e); - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentregister/src/main/resources/META-INF/defines/es_dao.define b/apm-collector-3.2.3/apm-collector-agentregister/src/main/resources/META-INF/defines/es_dao.define deleted file mode 100644 index 90d0e020d9..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentregister/src/main/resources/META-INF/defines/es_dao.define +++ /dev/null @@ -1,3 +0,0 @@ -org.skywalking.apm.collector.agentregister.worker.application.dao.ApplicationEsDAO -org.skywalking.apm.collector.agentregister.worker.instance.dao.InstanceEsDAO -org.skywalking.apm.collector.agentregister.worker.servicename.dao.ServiceNameEsDAO \ No newline at end of file diff --git a/apm-collector-3.2.3/apm-collector-agentregister/src/main/resources/META-INF/defines/h2_dao.define b/apm-collector-3.2.3/apm-collector-agentregister/src/main/resources/META-INF/defines/h2_dao.define deleted file mode 100644 index f381c69585..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentregister/src/main/resources/META-INF/defines/h2_dao.define +++ /dev/null @@ -1,3 +0,0 @@ -org.skywalking.apm.collector.agentregister.worker.application.dao.ApplicationH2DAO -org.skywalking.apm.collector.agentregister.worker.instance.dao.InstanceH2DAO -org.skywalking.apm.collector.agentregister.worker.servicename.dao.ServiceNameH2DAO \ No newline at end of file diff --git a/apm-collector-3.2.3/apm-collector-agentregister/src/main/resources/META-INF/defines/local_worker_provider.define b/apm-collector-3.2.3/apm-collector-agentregister/src/main/resources/META-INF/defines/local_worker_provider.define deleted file mode 100644 index 758eed4ba6..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentregister/src/main/resources/META-INF/defines/local_worker_provider.define +++ /dev/null @@ -1,3 +0,0 @@ -org.skywalking.apm.collector.agentregister.worker.application.ApplicationRegisterSerialWorker$Factory -org.skywalking.apm.collector.agentregister.worker.instance.InstanceRegisterSerialWorker$Factory -org.skywalking.apm.collector.agentregister.worker.servicename.ServiceNameRegisterSerialWorker$Factory \ No newline at end of file diff --git a/apm-collector-3.2.3/apm-collector-agentregister/src/main/resources/META-INF/defines/storage.define b/apm-collector-3.2.3/apm-collector-agentregister/src/main/resources/META-INF/defines/storage.define deleted file mode 100644 index 52807b0479..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentregister/src/main/resources/META-INF/defines/storage.define +++ /dev/null @@ -1,8 +0,0 @@ -org.skywalking.apm.collector.agentregister.worker.application.ApplicationEsTableDefine -org.skywalking.apm.collector.agentregister.worker.application.ApplicationH2TableDefine - -org.skywalking.apm.collector.agentregister.worker.instance.InstanceEsTableDefine -org.skywalking.apm.collector.agentregister.worker.instance.InstanceH2TableDefine - -org.skywalking.apm.collector.agentregister.worker.servicename.ServiceNameEsTableDefine -org.skywalking.apm.collector.agentregister.worker.servicename.ServiceNameH2TableDefine \ No newline at end of file diff --git a/apm-collector-3.2.3/apm-collector-agentregister/src/test/java/org/skywalking/apm/collector/agentregister/grpc/handler/ApplicationRegisterServiceHandlerTestCase.java b/apm-collector-3.2.3/apm-collector-agentregister/src/test/java/org/skywalking/apm/collector/agentregister/grpc/handler/ApplicationRegisterServiceHandlerTestCase.java deleted file mode 100644 index 60998263d0..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentregister/src/test/java/org/skywalking/apm/collector/agentregister/grpc/handler/ApplicationRegisterServiceHandlerTestCase.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentregister.grpc.handler; - -import io.grpc.ManagedChannel; -import io.grpc.ManagedChannelBuilder; -import org.skywalking.apm.network.proto.Application; -import org.skywalking.apm.network.proto.ApplicationMapping; -import org.skywalking.apm.network.proto.ApplicationRegisterServiceGrpc; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class ApplicationRegisterServiceHandlerTestCase { - - private final Logger logger = LoggerFactory.getLogger(ApplicationRegisterServiceHandlerTestCase.class); - - private ApplicationRegisterServiceGrpc.ApplicationRegisterServiceBlockingStub stub; - - public void testRegister() { - ManagedChannel channel = ManagedChannelBuilder.forAddress("localhost", 11800).usePlaintext(true).build(); - stub = ApplicationRegisterServiceGrpc.newBlockingStub(channel); - - Application application = Application.newBuilder().addApplicationCode("test141").build(); - ApplicationMapping mapping = stub.register(application); - logger.debug(mapping.getApplication(0).getKey() + ", " + mapping.getApplication(0).getValue()); - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentserver/pom.xml b/apm-collector-3.2.3/apm-collector-agentserver/pom.xml deleted file mode 100644 index 8d936b29d8..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentserver/pom.xml +++ /dev/null @@ -1,60 +0,0 @@ - - - - - - apm-collector-3.2.3 - org.skywalking - 3.2.4-2017 - - 4.0.0 - - apm-collector-3.2.3-agentserver - jar - - - - org.skywalking - apm-collector-3.2.3-cluster - ${project.version} - - - org.skywalking - apm-collector-3.2.3-server - ${project.version} - - - org.skywalking - apm-collector-3.2.3-agentstream - ${project.version} - - - org.skywalking - apm-collector-3.2.3-agentregister - ${project.version} - - - org.skywalking - apm-collector-3.2.3-ui - ${project.version} - - - diff --git a/apm-collector-3.2.3/apm-collector-agentserver/src/main/java/org/skywalking/apm/collector/agentserver/AgentServerModuleContext.java b/apm-collector-3.2.3/apm-collector-agentserver/src/main/java/org/skywalking/apm/collector/agentserver/AgentServerModuleContext.java deleted file mode 100644 index 96e7c4bbfc..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentserver/src/main/java/org/skywalking/apm/collector/agentserver/AgentServerModuleContext.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentserver; - -import org.skywalking.apm.collector.core.framework.Context; - -/** - * @author peng-yongsheng - */ -public class AgentServerModuleContext extends Context { - - public AgentServerModuleContext(String groupName) { - super(groupName); - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentserver/src/main/java/org/skywalking/apm/collector/agentserver/AgentServerModuleDefine.java b/apm-collector-3.2.3/apm-collector-agentserver/src/main/java/org/skywalking/apm/collector/agentserver/AgentServerModuleDefine.java deleted file mode 100644 index 8350d678f3..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentserver/src/main/java/org/skywalking/apm/collector/agentserver/AgentServerModuleDefine.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentserver; - -import org.skywalking.apm.collector.core.client.Client; -import org.skywalking.apm.collector.core.cluster.ClusterDataListenerDefine; -import org.skywalking.apm.collector.core.module.ModuleDefine; - -/** - * @author peng-yongsheng - */ -public abstract class AgentServerModuleDefine extends ModuleDefine implements ClusterDataListenerDefine { - - @Override protected void initializeOtherContext() { - - } - - @Override protected final Client createClient() { - throw new UnsupportedOperationException(""); - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentserver/src/main/java/org/skywalking/apm/collector/agentserver/AgentServerModuleException.java b/apm-collector-3.2.3/apm-collector-agentserver/src/main/java/org/skywalking/apm/collector/agentserver/AgentServerModuleException.java deleted file mode 100644 index 85e1996098..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentserver/src/main/java/org/skywalking/apm/collector/agentserver/AgentServerModuleException.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentserver; - -import org.skywalking.apm.collector.core.module.ModuleException; - -/** - * @author peng-yongsheng - */ -public class AgentServerModuleException extends ModuleException { - - public AgentServerModuleException(String message) { - super(message); - } - - public AgentServerModuleException(String message, Throwable cause) { - super(message, cause); - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentserver/src/main/java/org/skywalking/apm/collector/agentserver/AgentServerModuleGroupDefine.java b/apm-collector-3.2.3/apm-collector-agentserver/src/main/java/org/skywalking/apm/collector/agentserver/AgentServerModuleGroupDefine.java deleted file mode 100644 index f4b4a7e0a5..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentserver/src/main/java/org/skywalking/apm/collector/agentserver/AgentServerModuleGroupDefine.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentserver; - -import org.skywalking.apm.collector.core.config.GroupConfigParser; -import org.skywalking.apm.collector.core.framework.Context; -import org.skywalking.apm.collector.core.module.ModuleGroupDefine; -import org.skywalking.apm.collector.core.module.ModuleInstaller; - -/** - * @author peng-yongsheng - */ -public class AgentServerModuleGroupDefine implements ModuleGroupDefine { - - public static final String GROUP_NAME = "agent_server"; - private final AgentServerModuleInstaller installer; - - public AgentServerModuleGroupDefine() { - installer = new AgentServerModuleInstaller(); - } - - @Override public String name() { - return GROUP_NAME; - } - - @Override public Context groupContext() { - return new AgentServerModuleContext(GROUP_NAME); - } - - @Override public ModuleInstaller moduleInstaller() { - return installer; - } - - @Override public GroupConfigParser groupConfigParser() { - return null; - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentserver/src/main/java/org/skywalking/apm/collector/agentserver/AgentServerModuleInstaller.java b/apm-collector-3.2.3/apm-collector-agentserver/src/main/java/org/skywalking/apm/collector/agentserver/AgentServerModuleInstaller.java deleted file mode 100644 index 7fab0006cf..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentserver/src/main/java/org/skywalking/apm/collector/agentserver/AgentServerModuleInstaller.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentserver; - -import java.util.List; -import org.skywalking.apm.collector.core.framework.Context; -import org.skywalking.apm.collector.core.module.MultipleModuleInstaller; - -/** - * @author peng-yongsheng - */ -public class AgentServerModuleInstaller extends MultipleModuleInstaller { - - @Override public String groupName() { - return AgentServerModuleGroupDefine.GROUP_NAME; - } - - @Override public Context moduleContext() { - return new AgentServerModuleContext(groupName()); - } - - @Override public List dependenceModules() { - return null; - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentserver/src/main/java/org/skywalking/apm/collector/agentserver/jetty/AgentServerJettyConfig.java b/apm-collector-3.2.3/apm-collector-agentserver/src/main/java/org/skywalking/apm/collector/agentserver/jetty/AgentServerJettyConfig.java deleted file mode 100644 index 23daa2ff2d..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentserver/src/main/java/org/skywalking/apm/collector/agentserver/jetty/AgentServerJettyConfig.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentserver.jetty; - -/** - * @author peng-yongsheng - */ -public class AgentServerJettyConfig { - public static String HOST; - public static int PORT; - public static String CONTEXT_PATH; -} diff --git a/apm-collector-3.2.3/apm-collector-agentserver/src/main/java/org/skywalking/apm/collector/agentserver/jetty/AgentServerJettyConfigParser.java b/apm-collector-3.2.3/apm-collector-agentserver/src/main/java/org/skywalking/apm/collector/agentserver/jetty/AgentServerJettyConfigParser.java deleted file mode 100644 index 304cc042fa..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentserver/src/main/java/org/skywalking/apm/collector/agentserver/jetty/AgentServerJettyConfigParser.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentserver.jetty; - -import java.util.Map; -import org.skywalking.apm.collector.core.config.ConfigParseException; -import org.skywalking.apm.collector.core.module.ModuleConfigParser; -import org.skywalking.apm.collector.core.util.ObjectUtils; -import org.skywalking.apm.collector.core.util.StringUtils; - -/** - * @author peng-yongsheng - */ -public class AgentServerJettyConfigParser implements ModuleConfigParser { - - private static final String HOST = "host"; - private static final String PORT = "port"; - public static final String CONTEXT_PATH = "contextPath"; - - @Override public void parse(Map config) throws ConfigParseException { - AgentServerJettyConfig.CONTEXT_PATH = "/"; - - if (ObjectUtils.isEmpty(config) || StringUtils.isEmpty(config.get(HOST))) { - AgentServerJettyConfig.HOST = "localhost"; - } else { - AgentServerJettyConfig.HOST = (String)config.get(HOST); - } - - if (ObjectUtils.isEmpty(config) || StringUtils.isEmpty(config.get(PORT))) { - AgentServerJettyConfig.PORT = 10800; - } else { - AgentServerJettyConfig.PORT = (Integer)config.get(PORT); - } - if (ObjectUtils.isNotEmpty(config) && StringUtils.isNotEmpty(config.get(CONTEXT_PATH))) { - AgentServerJettyConfig.CONTEXT_PATH = (String)config.get(CONTEXT_PATH); - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentserver/src/main/java/org/skywalking/apm/collector/agentserver/jetty/AgentServerJettyDataListener.java b/apm-collector-3.2.3/apm-collector-agentserver/src/main/java/org/skywalking/apm/collector/agentserver/jetty/AgentServerJettyDataListener.java deleted file mode 100644 index 4184b69451..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentserver/src/main/java/org/skywalking/apm/collector/agentserver/jetty/AgentServerJettyDataListener.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentserver.jetty; - -import org.skywalking.apm.collector.agentserver.AgentServerModuleGroupDefine; -import org.skywalking.apm.collector.cluster.ClusterModuleDefine; -import org.skywalking.apm.collector.core.cluster.ClusterDataListener; - -/** - * @author peng-yongsheng - */ -public class AgentServerJettyDataListener extends ClusterDataListener { - - @Override public String path() { - return ClusterModuleDefine.BASE_CATALOG + "." + AgentServerModuleGroupDefine.GROUP_NAME + "." + AgentServerJettyModuleDefine.MODULE_NAME; - } - - @Override public void serverJoinNotify(String serverAddress) { - - } - - @Override public void serverQuitNotify(String serverAddress) { - - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentserver/src/main/java/org/skywalking/apm/collector/agentserver/jetty/AgentServerJettyModuleDefine.java b/apm-collector-3.2.3/apm-collector-agentserver/src/main/java/org/skywalking/apm/collector/agentserver/jetty/AgentServerJettyModuleDefine.java deleted file mode 100644 index d2a58edaba..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentserver/src/main/java/org/skywalking/apm/collector/agentserver/jetty/AgentServerJettyModuleDefine.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentserver.jetty; - -import java.util.LinkedList; -import java.util.List; -import org.skywalking.apm.collector.agentserver.AgentServerModuleDefine; -import org.skywalking.apm.collector.agentserver.AgentServerModuleGroupDefine; -import org.skywalking.apm.collector.agentserver.jetty.handler.AgentStreamGRPCServerHandler; -import org.skywalking.apm.collector.agentserver.jetty.handler.AgentStreamJettyServerHandler; -import org.skywalking.apm.collector.agentserver.jetty.handler.UIJettyServerHandler; -import org.skywalking.apm.collector.core.cluster.ClusterDataListener; -import org.skywalking.apm.collector.core.framework.Handler; -import org.skywalking.apm.collector.core.module.ModuleConfigParser; -import org.skywalking.apm.collector.core.module.ModuleRegistration; -import org.skywalking.apm.collector.core.server.Server; -import org.skywalking.apm.collector.server.jetty.JettyServer; - -/** - * @author peng-yongsheng - */ -public class AgentServerJettyModuleDefine extends AgentServerModuleDefine { - - public static final String MODULE_NAME = "jetty"; - - @Override protected String group() { - return AgentServerModuleGroupDefine.GROUP_NAME; - } - - @Override public String name() { - return MODULE_NAME; - } - - @Override public boolean defaultModule() { - return true; - } - - @Override protected ModuleConfigParser configParser() { - return new AgentServerJettyConfigParser(); - } - - @Override protected Server server() { - return new JettyServer(AgentServerJettyConfig.HOST, AgentServerJettyConfig.PORT, AgentServerJettyConfig.CONTEXT_PATH); - } - - @Override protected ModuleRegistration registration() { - return new AgentServerJettyModuleRegistration(); - } - - @Override public ClusterDataListener listener() { - return new AgentServerJettyDataListener(); - } - - @Override public List handlerList() { - List handlers = new LinkedList<>(); - handlers.add(new AgentStreamGRPCServerHandler()); - handlers.add(new AgentStreamJettyServerHandler()); - handlers.add(new UIJettyServerHandler()); - return handlers; - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentserver/src/main/java/org/skywalking/apm/collector/agentserver/jetty/AgentServerJettyModuleRegistration.java b/apm-collector-3.2.3/apm-collector-agentserver/src/main/java/org/skywalking/apm/collector/agentserver/jetty/AgentServerJettyModuleRegistration.java deleted file mode 100644 index 9e292b7ca2..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentserver/src/main/java/org/skywalking/apm/collector/agentserver/jetty/AgentServerJettyModuleRegistration.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentserver.jetty; - -import org.skywalking.apm.collector.core.module.ModuleRegistration; - -/** - * @author peng-yongsheng - */ -public class AgentServerJettyModuleRegistration extends ModuleRegistration { - - @Override public Value buildValue() { - return new Value(AgentServerJettyConfig.HOST, AgentServerJettyConfig.PORT, AgentServerJettyConfig.CONTEXT_PATH); - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentserver/src/main/java/org/skywalking/apm/collector/agentserver/jetty/handler/AgentStreamGRPCServerHandler.java b/apm-collector-3.2.3/apm-collector-agentserver/src/main/java/org/skywalking/apm/collector/agentserver/jetty/handler/AgentStreamGRPCServerHandler.java deleted file mode 100644 index 2ebdadb72f..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentserver/src/main/java/org/skywalking/apm/collector/agentserver/jetty/handler/AgentStreamGRPCServerHandler.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentserver.jetty.handler; - -import com.google.gson.JsonArray; -import com.google.gson.JsonElement; -import java.util.Set; -import javax.servlet.http.HttpServletRequest; -import org.skywalking.apm.collector.agentstream.grpc.AgentStreamGRPCDataListener; -import org.skywalking.apm.collector.core.cluster.ClusterModuleRegistrationReader; -import org.skywalking.apm.collector.core.framework.CollectorContextHelper; -import org.skywalking.apm.collector.server.jetty.ArgumentsParseException; -import org.skywalking.apm.collector.server.jetty.JettyHandler; - -/** - * @author peng-yongsheng - */ -public class AgentStreamGRPCServerHandler extends JettyHandler { - - @Override public String pathSpec() { - return "/agentstream/grpc"; - } - - @Override protected JsonElement doGet(HttpServletRequest req) throws ArgumentsParseException { - ClusterModuleRegistrationReader reader = CollectorContextHelper.INSTANCE.getClusterModuleContext().getReader(); - Set servers = reader.read(AgentStreamGRPCDataListener.PATH); - JsonArray serverArray = new JsonArray(); - servers.forEach(serverArray::add); - return serverArray; - } - - @Override protected JsonElement doPost(HttpServletRequest req) throws ArgumentsParseException { - throw new UnsupportedOperationException(); - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentserver/src/main/java/org/skywalking/apm/collector/agentserver/jetty/handler/AgentStreamJettyServerHandler.java b/apm-collector-3.2.3/apm-collector-agentserver/src/main/java/org/skywalking/apm/collector/agentserver/jetty/handler/AgentStreamJettyServerHandler.java deleted file mode 100644 index 106a39a694..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentserver/src/main/java/org/skywalking/apm/collector/agentserver/jetty/handler/AgentStreamJettyServerHandler.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentserver.jetty.handler; - -import com.google.gson.JsonArray; -import com.google.gson.JsonElement; -import java.util.Set; -import javax.servlet.http.HttpServletRequest; -import org.skywalking.apm.collector.agentstream.jetty.AgentStreamJettyDataListener; -import org.skywalking.apm.collector.core.cluster.ClusterModuleRegistrationReader; -import org.skywalking.apm.collector.core.framework.CollectorContextHelper; -import org.skywalking.apm.collector.server.jetty.ArgumentsParseException; -import org.skywalking.apm.collector.server.jetty.JettyHandler; - -/** - * @author peng-yongsheng - */ -public class AgentStreamJettyServerHandler extends JettyHandler { - - @Override public String pathSpec() { - return "/agentstream/jetty"; - } - - @Override protected JsonElement doGet(HttpServletRequest req) throws ArgumentsParseException { - ClusterModuleRegistrationReader reader = CollectorContextHelper.INSTANCE.getClusterModuleContext().getReader(); - Set servers = reader.read(AgentStreamJettyDataListener.PATH); - JsonArray serverArray = new JsonArray(); - servers.forEach(serverArray::add); - return serverArray; - } - - @Override protected JsonElement doPost(HttpServletRequest req) throws ArgumentsParseException { - throw new UnsupportedOperationException(); - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentserver/src/main/java/org/skywalking/apm/collector/agentserver/jetty/handler/UIJettyServerHandler.java b/apm-collector-3.2.3/apm-collector-agentserver/src/main/java/org/skywalking/apm/collector/agentserver/jetty/handler/UIJettyServerHandler.java deleted file mode 100644 index 32a9c74c15..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentserver/src/main/java/org/skywalking/apm/collector/agentserver/jetty/handler/UIJettyServerHandler.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentserver.jetty.handler; - -import com.google.gson.JsonArray; -import com.google.gson.JsonElement; -import java.util.Set; -import javax.servlet.http.HttpServletRequest; -import org.skywalking.apm.collector.core.cluster.ClusterModuleRegistrationReader; -import org.skywalking.apm.collector.core.framework.CollectorContextHelper; -import org.skywalking.apm.collector.server.jetty.ArgumentsParseException; -import org.skywalking.apm.collector.server.jetty.JettyHandler; -import org.skywalking.apm.collector.ui.jetty.UIJettyDataListener; - -/** - * @author peng-yongsheng - */ -public class UIJettyServerHandler extends JettyHandler { - - @Override public String pathSpec() { - return "/ui/jetty"; - } - - @Override protected JsonElement doGet(HttpServletRequest req) throws ArgumentsParseException { - ClusterModuleRegistrationReader reader = CollectorContextHelper.INSTANCE.getClusterModuleContext().getReader(); - Set servers = reader.read(UIJettyDataListener.PATH); - JsonArray serverArray = new JsonArray(); - servers.forEach(serverArray::add); - return serverArray; - } - - @Override protected JsonElement doPost(HttpServletRequest req) throws ArgumentsParseException { - throw new UnsupportedOperationException(); - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentserver/src/main/resources/META-INF/defines/group.define b/apm-collector-3.2.3/apm-collector-agentserver/src/main/resources/META-INF/defines/group.define deleted file mode 100644 index 229ed8a563..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentserver/src/main/resources/META-INF/defines/group.define +++ /dev/null @@ -1 +0,0 @@ -org.skywalking.apm.collector.agentserver.AgentServerModuleGroupDefine \ No newline at end of file diff --git a/apm-collector-3.2.3/apm-collector-agentserver/src/main/resources/META-INF/defines/module.define b/apm-collector-3.2.3/apm-collector-agentserver/src/main/resources/META-INF/defines/module.define deleted file mode 100644 index cdd20e3bfa..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentserver/src/main/resources/META-INF/defines/module.define +++ /dev/null @@ -1 +0,0 @@ -org.skywalking.apm.collector.agentserver.jetty.AgentServerJettyModuleDefine \ No newline at end of file diff --git a/apm-collector-3.2.3/apm-collector-agentstream/pom.xml b/apm-collector-3.2.3/apm-collector-agentstream/pom.xml deleted file mode 100644 index f709582d27..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/pom.xml +++ /dev/null @@ -1,70 +0,0 @@ - - - - - - apm-collector-3.2.3 - org.skywalking - 3.2.4-2017 - - 4.0.0 - - apm-collector-3.2.3-agentstream - jar - - - - org.skywalking - apm-collector-3.2.3-stream - ${project.version} - - - org.skywalking - apm-collector-3.2.3-cluster - ${project.version} - - - org.skywalking - apm-collector-3.2.3-server - ${project.version} - - - org.skywalking - apm-collector-3.2.3-storage - ${project.version} - - - org.skywalking - apm-collector-3.2.3-agentjvm - ${project.version} - - - org.skywalking - apm-collector-3.2.3-agentregister - ${project.version} - - - org.skywalking - apm-collector-3.2.3-cache - ${project.version} - - - diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/AgentStreamModuleContext.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/AgentStreamModuleContext.java deleted file mode 100644 index 9a369fba51..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/AgentStreamModuleContext.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream; - -import org.skywalking.apm.collector.core.framework.Context; - -/** - * @author peng-yongsheng - */ -public class AgentStreamModuleContext extends Context { - - public AgentStreamModuleContext(String groupName) { - super(groupName); - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/AgentStreamModuleDefine.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/AgentStreamModuleDefine.java deleted file mode 100644 index abfca76e90..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/AgentStreamModuleDefine.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream; - -import org.skywalking.apm.collector.core.client.Client; -import org.skywalking.apm.collector.core.cluster.ClusterDataListenerDefine; -import org.skywalking.apm.collector.core.module.ModuleDefine; - -/** - * @author peng-yongsheng - */ -public abstract class AgentStreamModuleDefine extends ModuleDefine implements ClusterDataListenerDefine { - - @Override protected final Client createClient() { - throw new UnsupportedOperationException(""); - } - - @Override public final boolean defaultModule() { - return true; - } - - @Override protected void initializeOtherContext() { - - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/AgentStreamModuleException.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/AgentStreamModuleException.java deleted file mode 100644 index e5ec1b86b9..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/AgentStreamModuleException.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream; - -import org.skywalking.apm.collector.core.module.ModuleException; - -/** - * @author peng-yongsheng - */ -public class AgentStreamModuleException extends ModuleException { - public AgentStreamModuleException(String message) { - super(message); - } - - public AgentStreamModuleException(String message, Throwable cause) { - super(message, cause); - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/AgentStreamModuleGroupConfigParser.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/AgentStreamModuleGroupConfigParser.java deleted file mode 100644 index 425b46d595..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/AgentStreamModuleGroupConfigParser.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream; - -import java.util.Map; -import org.skywalking.apm.collector.agentstream.config.BufferFileConfig; -import org.skywalking.apm.collector.core.config.GroupConfigParser; - -/** - * @author peng-yongsheng - */ -public class AgentStreamModuleGroupConfigParser implements GroupConfigParser { - - private static final String BUFFER_OFFSET_MAX_FILE_SIZE = "buffer_offset_max_file_size"; - private static final String BUFFER_SEGMENT_MAX_FILE_SIZE = "buffer_segment_max_file_size"; - - @Override public void parse(Map config) { - if (config.containsKey(GroupConfigParser.NODE_NAME)) { - Map groupConfig = config.get(GroupConfigParser.NODE_NAME); - - if (groupConfig.containsKey(BUFFER_OFFSET_MAX_FILE_SIZE)) { - String sizeStr = groupConfig.get(BUFFER_OFFSET_MAX_FILE_SIZE).toUpperCase(); - if (sizeStr.endsWith("K")) { - int size = Integer.parseInt(sizeStr.replace("K", "")); - BufferFileConfig.BUFFER_OFFSET_MAX_FILE_SIZE = size * 1024; - } else if (sizeStr.endsWith("KB")) { - int size = Integer.parseInt(sizeStr.replace("KB", "")); - BufferFileConfig.BUFFER_OFFSET_MAX_FILE_SIZE = size * 1024; - } else if (sizeStr.endsWith("M")) { - int size = Integer.parseInt(sizeStr.replace("M", "")); - BufferFileConfig.BUFFER_OFFSET_MAX_FILE_SIZE = size * 1024 * 1024; - } else if (sizeStr.endsWith("MB")) { - int size = Integer.parseInt(sizeStr.replace("MB", "")); - BufferFileConfig.BUFFER_OFFSET_MAX_FILE_SIZE = size * 1024 * 1024; - } else { - BufferFileConfig.BUFFER_OFFSET_MAX_FILE_SIZE = 10 * 1024 * 1024; - } - } else { - BufferFileConfig.BUFFER_OFFSET_MAX_FILE_SIZE = 10 * 1024 * 1024; - } - - if (groupConfig.containsKey(BUFFER_SEGMENT_MAX_FILE_SIZE)) { - String sizeStr = groupConfig.get(BUFFER_SEGMENT_MAX_FILE_SIZE).toUpperCase(); - if (sizeStr.endsWith("K")) { - int size = Integer.parseInt(sizeStr.replace("K", "")); - BufferFileConfig.BUFFER_SEGMENT_MAX_FILE_SIZE = size * 1024; - } else if (sizeStr.endsWith("KB")) { - int size = Integer.parseInt(sizeStr.replace("KB", "")); - BufferFileConfig.BUFFER_SEGMENT_MAX_FILE_SIZE = size * 1024; - } else if (sizeStr.endsWith("M")) { - int size = Integer.parseInt(sizeStr.replace("M", "")); - BufferFileConfig.BUFFER_SEGMENT_MAX_FILE_SIZE = size * 1024 * 1024; - } else if (sizeStr.endsWith("MB")) { - int size = Integer.parseInt(sizeStr.replace("MB", "")); - BufferFileConfig.BUFFER_SEGMENT_MAX_FILE_SIZE = size * 1024 * 1024; - } else { - BufferFileConfig.BUFFER_SEGMENT_MAX_FILE_SIZE = 1024 * 1024; - } - } else { - BufferFileConfig.BUFFER_SEGMENT_MAX_FILE_SIZE = 1024 * 1024; - } - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/AgentStreamModuleGroupDefine.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/AgentStreamModuleGroupDefine.java deleted file mode 100644 index 7b2501cda8..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/AgentStreamModuleGroupDefine.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream; - -import org.skywalking.apm.collector.core.config.GroupConfigParser; -import org.skywalking.apm.collector.core.framework.Context; -import org.skywalking.apm.collector.core.module.ModuleGroupDefine; -import org.skywalking.apm.collector.core.module.ModuleInstaller; - -/** - * @author peng-yongsheng - */ -public class AgentStreamModuleGroupDefine implements ModuleGroupDefine { - - public static final String GROUP_NAME = "agent_stream"; - private final AgentStreamModuleInstaller installer; - - public AgentStreamModuleGroupDefine() { - installer = new AgentStreamModuleInstaller(); - } - - @Override public String name() { - return GROUP_NAME; - } - - @Override public Context groupContext() { - return new AgentStreamModuleContext(GROUP_NAME); - } - - @Override public ModuleInstaller moduleInstaller() { - return installer; - } - - @Override public GroupConfigParser groupConfigParser() { - return new AgentStreamModuleGroupConfigParser(); - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/AgentStreamModuleInstaller.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/AgentStreamModuleInstaller.java deleted file mode 100644 index 416e5007ce..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/AgentStreamModuleInstaller.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream; - -import java.util.List; -import org.skywalking.apm.collector.agentstream.worker.storage.PersistenceTimer; -import org.skywalking.apm.collector.core.client.ClientException; -import org.skywalking.apm.collector.core.config.ConfigException; -import org.skywalking.apm.collector.core.framework.Context; -import org.skywalking.apm.collector.core.framework.DefineException; -import org.skywalking.apm.collector.core.module.MultipleModuleInstaller; -import org.skywalking.apm.collector.core.server.ServerException; - -/** - * @author peng-yongsheng - */ -public class AgentStreamModuleInstaller extends MultipleModuleInstaller { - - @Override public String groupName() { - return AgentStreamModuleGroupDefine.GROUP_NAME; - } - - @Override public Context moduleContext() { - return new AgentStreamModuleContext(groupName()); - } - - @Override public List dependenceModules() { - return null; - } - - @Override public void install() throws DefineException, ConfigException, ServerException, ClientException { - super.install(); - new PersistenceTimer().start(); - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/config/BufferFileConfig.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/config/BufferFileConfig.java deleted file mode 100644 index 89ef3183da..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/config/BufferFileConfig.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.config; - -/** - * @author peng-yongsheng - */ -public class BufferFileConfig { - public static int BUFFER_OFFSET_MAX_FILE_SIZE = 10 * 1024 * 1024; - public static int BUFFER_SEGMENT_MAX_FILE_SIZE = 10 * 1024 * 1024; -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/grpc/AgentStreamGRPCConfig.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/grpc/AgentStreamGRPCConfig.java deleted file mode 100644 index e98c32df15..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/grpc/AgentStreamGRPCConfig.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.grpc; - -/** - * @author peng-yongsheng - */ -public class AgentStreamGRPCConfig { - public static String HOST; - public static int PORT; -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/grpc/AgentStreamGRPCConfigParser.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/grpc/AgentStreamGRPCConfigParser.java deleted file mode 100644 index d9e3ef9870..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/grpc/AgentStreamGRPCConfigParser.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.grpc; - -import java.util.Map; -import org.skywalking.apm.collector.core.config.ConfigParseException; -import org.skywalking.apm.collector.core.module.ModuleConfigParser; -import org.skywalking.apm.collector.core.util.ObjectUtils; -import org.skywalking.apm.collector.core.util.StringUtils; - -/** - * @author peng-yongsheng - */ -public class AgentStreamGRPCConfigParser implements ModuleConfigParser { - - private static final String HOST = "host"; - private static final String PORT = "port"; - - @Override public void parse(Map config) throws ConfigParseException { - if (ObjectUtils.isEmpty(config) || StringUtils.isEmpty(config.get(HOST))) { - AgentStreamGRPCConfig.HOST = "localhost"; - } else { - AgentStreamGRPCConfig.HOST = (String)config.get(HOST); - } - - if (ObjectUtils.isEmpty(config) || StringUtils.isEmpty(config.get(PORT))) { - AgentStreamGRPCConfig.PORT = 11800; - } else { - AgentStreamGRPCConfig.PORT = (Integer)config.get(PORT); - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/grpc/AgentStreamGRPCDataListener.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/grpc/AgentStreamGRPCDataListener.java deleted file mode 100644 index fed873fcff..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/grpc/AgentStreamGRPCDataListener.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.grpc; - -import org.skywalking.apm.collector.agentstream.AgentStreamModuleGroupDefine; -import org.skywalking.apm.collector.cluster.ClusterModuleDefine; -import org.skywalking.apm.collector.core.cluster.ClusterDataListener; - -/** - * @author peng-yongsheng - */ -public class AgentStreamGRPCDataListener extends ClusterDataListener { - - public static final String PATH = ClusterModuleDefine.BASE_CATALOG + "." + AgentStreamModuleGroupDefine.GROUP_NAME + "." + AgentStreamGRPCModuleDefine.MODULE_NAME; - - @Override public String path() { - return PATH; - } - - @Override public void serverJoinNotify(String serverAddress) { - - } - - @Override public void serverQuitNotify(String serverAddress) { - - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/grpc/AgentStreamGRPCModuleDefine.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/grpc/AgentStreamGRPCModuleDefine.java deleted file mode 100644 index 23b6435758..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/grpc/AgentStreamGRPCModuleDefine.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.grpc; - -import java.util.LinkedList; -import java.util.List; -import org.skywalking.apm.collector.agentjvm.grpc.handler.JVMMetricsServiceHandler; -import org.skywalking.apm.collector.agentregister.grpc.handler.ApplicationRegisterServiceHandler; -import org.skywalking.apm.collector.agentregister.grpc.handler.InstanceDiscoveryServiceHandler; -import org.skywalking.apm.collector.agentregister.grpc.handler.ServiceNameDiscoveryServiceHandler; -import org.skywalking.apm.collector.agentstream.AgentStreamModuleDefine; -import org.skywalking.apm.collector.agentstream.AgentStreamModuleGroupDefine; -import org.skywalking.apm.collector.agentstream.grpc.handler.TraceSegmentServiceHandler; -import org.skywalking.apm.collector.core.cluster.ClusterDataListener; -import org.skywalking.apm.collector.core.framework.Handler; -import org.skywalking.apm.collector.core.module.ModuleConfigParser; -import org.skywalking.apm.collector.core.module.ModuleRegistration; -import org.skywalking.apm.collector.core.server.Server; -import org.skywalking.apm.collector.server.grpc.GRPCServer; - -/** - * @author peng-yongsheng - */ -public class AgentStreamGRPCModuleDefine extends AgentStreamModuleDefine { - - public static final String MODULE_NAME = "grpc"; - - @Override protected String group() { - return AgentStreamModuleGroupDefine.GROUP_NAME; - } - - @Override public String name() { - return MODULE_NAME; - } - - @Override protected ModuleConfigParser configParser() { - return new AgentStreamGRPCConfigParser(); - } - - @Override protected Server server() { - return new GRPCServer(AgentStreamGRPCConfig.HOST, AgentStreamGRPCConfig.PORT); - } - - @Override protected ModuleRegistration registration() { - return new AgentStreamGRPCModuleRegistration(); - } - - @Override public ClusterDataListener listener() { - return new AgentStreamGRPCDataListener(); - } - - @Override public List handlerList() { - List handlers = new LinkedList<>(); - handlers.add(new TraceSegmentServiceHandler()); - handlers.add(new ApplicationRegisterServiceHandler()); - handlers.add(new InstanceDiscoveryServiceHandler()); - handlers.add(new ServiceNameDiscoveryServiceHandler()); - handlers.add(new JVMMetricsServiceHandler()); - return handlers; - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/grpc/AgentStreamGRPCModuleRegistration.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/grpc/AgentStreamGRPCModuleRegistration.java deleted file mode 100644 index ef742a3b08..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/grpc/AgentStreamGRPCModuleRegistration.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.grpc; - -import org.skywalking.apm.collector.core.module.ModuleRegistration; - -/** - * @author peng-yongsheng - */ -public class AgentStreamGRPCModuleRegistration extends ModuleRegistration { - - @Override public Value buildValue() { - return new Value(AgentStreamGRPCConfig.HOST, AgentStreamGRPCConfig.PORT, null); - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/grpc/handler/TraceSegmentServiceHandler.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/grpc/handler/TraceSegmentServiceHandler.java deleted file mode 100644 index b7382c585d..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/grpc/handler/TraceSegmentServiceHandler.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.grpc.handler; - -import io.grpc.stub.StreamObserver; -import org.skywalking.apm.collector.agentstream.worker.segment.SegmentParse; -import org.skywalking.apm.collector.server.grpc.GRPCHandler; -import org.skywalking.apm.network.proto.Downstream; -import org.skywalking.apm.network.proto.TraceSegmentServiceGrpc; -import org.skywalking.apm.network.proto.UpstreamSegment; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class TraceSegmentServiceHandler extends TraceSegmentServiceGrpc.TraceSegmentServiceImplBase implements GRPCHandler { - - private final Logger logger = LoggerFactory.getLogger(TraceSegmentServiceHandler.class); - - @Override public StreamObserver collect(StreamObserver responseObserver) { - return new StreamObserver() { - @Override public void onNext(UpstreamSegment segment) { - logger.debug("receive segment"); - SegmentParse segmentParse = new SegmentParse(); - segmentParse.parse(segment, SegmentParse.Source.Agent); - } - - @Override public void onError(Throwable throwable) { - logger.error(throwable.getMessage(), throwable); - } - - @Override public void onCompleted() { - responseObserver.onNext(Downstream.newBuilder().build()); - responseObserver.onCompleted(); - } - }; - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/jetty/AgentStreamJettyConfig.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/jetty/AgentStreamJettyConfig.java deleted file mode 100644 index a29bfe1208..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/jetty/AgentStreamJettyConfig.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.jetty; - -/** - * @author peng-yongsheng - */ -public class AgentStreamJettyConfig { - public static String HOST; - public static int PORT; - public static String CONTEXT_PATH; -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/jetty/AgentStreamJettyConfigParser.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/jetty/AgentStreamJettyConfigParser.java deleted file mode 100644 index e73fbd22bb..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/jetty/AgentStreamJettyConfigParser.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.jetty; - -import java.util.Map; -import org.skywalking.apm.collector.core.config.ConfigParseException; -import org.skywalking.apm.collector.core.module.ModuleConfigParser; -import org.skywalking.apm.collector.core.util.ObjectUtils; -import org.skywalking.apm.collector.core.util.StringUtils; - -/** - * @author peng-yongsheng - */ -public class AgentStreamJettyConfigParser implements ModuleConfigParser { - - private static final String HOST = "host"; - private static final String PORT = "port"; - public static final String CONTEXT_PATH = "contextPath"; - - @Override public void parse(Map config) throws ConfigParseException { - AgentStreamJettyConfig.CONTEXT_PATH = "/"; - - if (ObjectUtils.isEmpty(config) || StringUtils.isEmpty(config.get(HOST))) { - AgentStreamJettyConfig.HOST = "localhost"; - } else { - AgentStreamJettyConfig.HOST = (String)config.get(HOST); - } - - if (ObjectUtils.isEmpty(config) || StringUtils.isEmpty(config.get(PORT))) { - AgentStreamJettyConfig.PORT = 12800; - } else { - AgentStreamJettyConfig.PORT = (Integer)config.get(PORT); - } - if (ObjectUtils.isNotEmpty(config) && StringUtils.isNotEmpty(config.get(CONTEXT_PATH))) { - AgentStreamJettyConfig.CONTEXT_PATH = (String)config.get(CONTEXT_PATH); - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/jetty/AgentStreamJettyDataListener.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/jetty/AgentStreamJettyDataListener.java deleted file mode 100644 index 173ee74b52..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/jetty/AgentStreamJettyDataListener.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.jetty; - -import org.skywalking.apm.collector.agentstream.AgentStreamModuleGroupDefine; -import org.skywalking.apm.collector.cluster.ClusterModuleDefine; -import org.skywalking.apm.collector.core.cluster.ClusterDataListener; - -/** - * @author peng-yongsheng - */ -public class AgentStreamJettyDataListener extends ClusterDataListener { - - public static final String PATH = ClusterModuleDefine.BASE_CATALOG + "." + AgentStreamModuleGroupDefine.GROUP_NAME + "." + AgentStreamJettyModuleDefine.MODULE_NAME; - - @Override public String path() { - return PATH; - } - - @Override public void serverJoinNotify(String serverAddress) { - - } - - @Override public void serverQuitNotify(String serverAddress) { - - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/jetty/AgentStreamJettyModuleDefine.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/jetty/AgentStreamJettyModuleDefine.java deleted file mode 100644 index 5867b164e5..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/jetty/AgentStreamJettyModuleDefine.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.jetty; - -import java.util.LinkedList; -import java.util.List; -import org.skywalking.apm.collector.agentregister.jetty.handler.ApplicationRegisterServletHandler; -import org.skywalking.apm.collector.agentregister.jetty.handler.InstanceDiscoveryServletHandler; -import org.skywalking.apm.collector.agentregister.jetty.handler.ServiceNameDiscoveryServiceHandler; -import org.skywalking.apm.collector.agentstream.AgentStreamModuleDefine; -import org.skywalking.apm.collector.agentstream.AgentStreamModuleGroupDefine; -import org.skywalking.apm.collector.agentstream.jetty.handler.TraceSegmentServletHandler; -import org.skywalking.apm.collector.core.cluster.ClusterDataListener; -import org.skywalking.apm.collector.core.framework.Handler; -import org.skywalking.apm.collector.core.module.ModuleConfigParser; -import org.skywalking.apm.collector.core.module.ModuleRegistration; -import org.skywalking.apm.collector.core.server.Server; -import org.skywalking.apm.collector.server.jetty.JettyServer; - -/** - * @author peng-yongsheng - */ -public class AgentStreamJettyModuleDefine extends AgentStreamModuleDefine { - - public static final String MODULE_NAME = "jetty"; - - @Override protected String group() { - return AgentStreamModuleGroupDefine.GROUP_NAME; - } - - @Override public String name() { - return MODULE_NAME; - } - - @Override protected ModuleConfigParser configParser() { - return new AgentStreamJettyConfigParser(); - } - - @Override protected Server server() { - return new JettyServer(AgentStreamJettyConfig.HOST, AgentStreamJettyConfig.PORT, AgentStreamJettyConfig.CONTEXT_PATH); - } - - @Override protected ModuleRegistration registration() { - return new AgentStreamJettyModuleRegistration(); - } - - @Override public ClusterDataListener listener() { - return new AgentStreamJettyDataListener(); - } - - @Override public List handlerList() { - List handlers = new LinkedList<>(); - handlers.add(new TraceSegmentServletHandler()); - handlers.add(new ApplicationRegisterServletHandler()); - handlers.add(new InstanceDiscoveryServletHandler()); - handlers.add(new ServiceNameDiscoveryServiceHandler()); - return handlers; - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/jetty/AgentStreamJettyModuleRegistration.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/jetty/AgentStreamJettyModuleRegistration.java deleted file mode 100644 index ea69f2ea73..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/jetty/AgentStreamJettyModuleRegistration.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.jetty; - -import org.skywalking.apm.collector.core.module.ModuleRegistration; - -/** - * @author peng-yongsheng - */ -public class AgentStreamJettyModuleRegistration extends ModuleRegistration { - - @Override public Value buildValue() { - return new Value(AgentStreamJettyConfig.HOST, AgentStreamJettyConfig.PORT, AgentStreamJettyConfig.CONTEXT_PATH); - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/jetty/handler/TraceSegmentServletHandler.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/jetty/handler/TraceSegmentServletHandler.java deleted file mode 100644 index 552834ce9d..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/jetty/handler/TraceSegmentServletHandler.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.jetty.handler; - -import com.google.gson.JsonElement; -import com.google.gson.stream.JsonReader; -import java.io.BufferedReader; -import java.io.IOException; -import javax.servlet.http.HttpServletRequest; -import org.skywalking.apm.collector.agentstream.jetty.handler.reader.TraceSegment; -import org.skywalking.apm.collector.agentstream.jetty.handler.reader.TraceSegmentJsonReader; -import org.skywalking.apm.collector.agentstream.worker.segment.SegmentParse; -import org.skywalking.apm.collector.server.jetty.ArgumentsParseException; -import org.skywalking.apm.collector.server.jetty.JettyHandler; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class TraceSegmentServletHandler extends JettyHandler { - - private final Logger logger = LoggerFactory.getLogger(TraceSegmentServletHandler.class); - - @Override public String pathSpec() { - return "/segments"; - } - - @Override protected JsonElement doGet(HttpServletRequest req) throws ArgumentsParseException { - throw new UnsupportedOperationException(); - } - - @Override protected JsonElement doPost(HttpServletRequest req) throws ArgumentsParseException { - logger.debug("receive stream segment"); - try { - BufferedReader bufferedReader = req.getReader(); - read(bufferedReader); - } catch (IOException e) { - logger.error(e.getMessage(), e); - } - return null; - } - - private TraceSegmentJsonReader jsonReader = new TraceSegmentJsonReader(); - - private void read(BufferedReader bufferedReader) throws IOException { - JsonReader reader = new JsonReader(bufferedReader); - - reader.beginArray(); - while (reader.hasNext()) { - SegmentParse segmentParse = new SegmentParse(); - TraceSegment traceSegment = jsonReader.read(reader); - segmentParse.parse(traceSegment.getUpstreamSegment(), SegmentParse.Source.Agent); - } - reader.endArray(); - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/jetty/handler/reader/KeyWithStringValueJsonReader.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/jetty/handler/reader/KeyWithStringValueJsonReader.java deleted file mode 100644 index 50fb018935..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/jetty/handler/reader/KeyWithStringValueJsonReader.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.jetty.handler.reader; - -import com.google.gson.stream.JsonReader; -import java.io.IOException; -import org.skywalking.apm.network.proto.KeyWithStringValue; - -/** - * @author peng-yongsheng - */ -public class KeyWithStringValueJsonReader implements StreamJsonReader { - - private static final String KEY = "k"; - private static final String VALUE = "v"; - - @Override public KeyWithStringValue read(JsonReader reader) throws IOException { - KeyWithStringValue.Builder builder = KeyWithStringValue.newBuilder(); - - reader.beginObject(); - while (reader.hasNext()) { - switch (reader.nextName()) { - case KEY: - builder.setKey(reader.nextString()); - break; - case VALUE: - builder.setValue(reader.nextString()); - break; - default: - reader.skipValue(); - break; - } - } - reader.endObject(); - - return builder.build(); - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/jetty/handler/reader/LogJsonReader.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/jetty/handler/reader/LogJsonReader.java deleted file mode 100644 index db95cc41e6..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/jetty/handler/reader/LogJsonReader.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.jetty.handler.reader; - -import com.google.gson.stream.JsonReader; -import java.io.IOException; -import org.skywalking.apm.network.proto.LogMessage; - -/** - * @author peng-yongsheng - */ -public class LogJsonReader implements StreamJsonReader { - - private KeyWithStringValueJsonReader keyWithStringValueJsonReader = new KeyWithStringValueJsonReader(); - - private static final String TIME = "ti"; - private static final String LOG_DATA = "ld"; - - @Override public LogMessage read(JsonReader reader) throws IOException { - LogMessage.Builder builder = LogMessage.newBuilder(); - - while (reader.hasNext()) { - switch (reader.nextName()) { - case TIME: - builder.setTime(reader.nextLong()); - case LOG_DATA: - reader.beginArray(); - while (reader.hasNext()) { - builder.addData(keyWithStringValueJsonReader.read(reader)); - } - reader.endArray(); - default: - reader.skipValue(); - } - } - - return builder.build(); - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/jetty/handler/reader/ReferenceJsonReader.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/jetty/handler/reader/ReferenceJsonReader.java deleted file mode 100644 index efeb7f2142..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/jetty/handler/reader/ReferenceJsonReader.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.jetty.handler.reader; - -import com.google.gson.stream.JsonReader; -import java.io.IOException; -import org.skywalking.apm.network.proto.TraceSegmentReference; - -/** - * @author peng-yongsheng - */ -public class ReferenceJsonReader implements StreamJsonReader { - - private UniqueIdJsonReader uniqueIdJsonReader = new UniqueIdJsonReader(); - - private static final String PARENT_TRACE_SEGMENT_ID = "ts"; - private static final String PARENT_APPLICATION_ID = "ai"; - private static final String PARENT_SPAN_ID = "si"; - private static final String PARENT_SERVICE_ID = "vi"; - private static final String PARENT_SERVICE_NAME = "vn"; - private static final String NETWORK_ADDRESS_ID = "ni"; - private static final String NETWORK_ADDRESS = "nn"; - private static final String ENTRY_APPLICATION_INSTANCE_ID = "ea"; - private static final String ENTRY_SERVICE_ID = "ei"; - private static final String ENTRY_SERVICE_NAME = "en"; - private static final String REF_TYPE_VALUE = "rv"; - - @Override public TraceSegmentReference read(JsonReader reader) throws IOException { - TraceSegmentReference.Builder builder = TraceSegmentReference.newBuilder(); - - reader.beginObject(); - while (reader.hasNext()) { - switch (reader.nextName()) { - case PARENT_TRACE_SEGMENT_ID: - builder.setParentTraceSegmentId(uniqueIdJsonReader.read(reader)); - break; - case PARENT_APPLICATION_ID: - builder.setParentApplicationInstanceId(reader.nextInt()); - break; - case PARENT_SPAN_ID: - builder.setParentSpanId(reader.nextInt()); - break; - case PARENT_SERVICE_ID: - builder.setParentServiceId(reader.nextInt()); - break; - case PARENT_SERVICE_NAME: - builder.setParentServiceName(reader.nextString()); - break; - case NETWORK_ADDRESS_ID: - builder.setNetworkAddressId(reader.nextInt()); - break; - case NETWORK_ADDRESS: - builder.setNetworkAddress(reader.nextString()); - break; - case ENTRY_APPLICATION_INSTANCE_ID: - builder.setEntryApplicationInstanceId(reader.nextInt()); - break; - case ENTRY_SERVICE_ID: - builder.setEntryServiceId(reader.nextInt()); - break; - case ENTRY_SERVICE_NAME: - builder.setEntryServiceName(reader.nextString()); - break; - case REF_TYPE_VALUE: - builder.setRefTypeValue(reader.nextInt()); - break; - default: - reader.skipValue(); - break; - } - } - reader.endObject(); - - return builder.build(); - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/jetty/handler/reader/SegmentJsonReader.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/jetty/handler/reader/SegmentJsonReader.java deleted file mode 100644 index 5a5dde3112..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/jetty/handler/reader/SegmentJsonReader.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.jetty.handler.reader; - -import com.google.gson.stream.JsonReader; -import java.io.IOException; -import org.skywalking.apm.network.proto.TraceSegmentObject; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class SegmentJsonReader implements StreamJsonReader { - - private final Logger logger = LoggerFactory.getLogger(SegmentJsonReader.class); - - private UniqueIdJsonReader uniqueIdJsonReader = new UniqueIdJsonReader(); - private ReferenceJsonReader referenceJsonReader = new ReferenceJsonReader(); - private SpanJsonReader spanJsonReader = new SpanJsonReader(); - - private static final String TRACE_SEGMENT_ID = "ts"; - private static final String APPLICATION_ID = "ai"; - private static final String APPLICATION_INSTANCE_ID = "ii"; - private static final String TRACE_SEGMENT_REFERENCE = "rs"; - private static final String SPANS = "ss"; - - @Override public TraceSegmentObject.Builder read(JsonReader reader) throws IOException { - TraceSegmentObject.Builder builder = TraceSegmentObject.newBuilder(); - - reader.beginObject(); - while (reader.hasNext()) { - switch (reader.nextName()) { - case TRACE_SEGMENT_ID: - builder.setTraceSegmentId(uniqueIdJsonReader.read(reader)); - if (logger.isDebugEnabled()) { - StringBuilder segmentId = new StringBuilder(); - builder.getTraceSegmentId().getIdPartsList().forEach(idPart -> segmentId.append(idPart)); - logger.debug("segment id: {}", segmentId); - } - break; - case APPLICATION_ID: - builder.setApplicationId(reader.nextInt()); - break; - case APPLICATION_INSTANCE_ID: - builder.setApplicationInstanceId(reader.nextInt()); - break; - case TRACE_SEGMENT_REFERENCE: - reader.beginArray(); - while (reader.hasNext()) { - builder.addRefs(referenceJsonReader.read(reader)); - } - reader.endArray(); - break; - case SPANS: - reader.beginArray(); - while (reader.hasNext()) { - builder.addSpans(spanJsonReader.read(reader)); - } - reader.endArray(); - break; - default: - reader.skipValue(); - break; - } - } - reader.endObject(); - - return builder; - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/jetty/handler/reader/SpanJsonReader.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/jetty/handler/reader/SpanJsonReader.java deleted file mode 100644 index 6059b7d80e..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/jetty/handler/reader/SpanJsonReader.java +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.jetty.handler.reader; - -import com.google.gson.stream.JsonReader; -import java.io.IOException; -import org.skywalking.apm.network.proto.SpanObject; - -/** - * @author peng-yongsheng - */ -public class SpanJsonReader implements StreamJsonReader { - - private KeyWithStringValueJsonReader keyWithStringValueJsonReader = new KeyWithStringValueJsonReader(); - private LogJsonReader logJsonReader = new LogJsonReader(); - - private static final String SPAN_ID = "si"; - private static final String SPAN_TYPE_VALUE = "tv"; - private static final String SPAN_LAYER_VALUE = "lv"; - private static final String PARENT_SPAN_ID = "ps"; - private static final String START_TIME = "st"; - private static final String END_TIME = "et"; - private static final String COMPONENT_ID = "ci"; - private static final String COMPONENT_NAME = "cn"; - private static final String OPERATION_NAME_ID = "oi"; - private static final String OPERATION_NAME = "on"; - private static final String PEER_ID = "pi"; - private static final String PEER = "pn"; - private static final String IS_ERROR = "ie"; - private static final String TAGS = "to"; - private static final String LOGS = "lo"; - - @Override public SpanObject read(JsonReader reader) throws IOException { - SpanObject.Builder builder = SpanObject.newBuilder(); - - reader.beginObject(); - while (reader.hasNext()) { - switch (reader.nextName()) { - case SPAN_ID: - builder.setSpanId(reader.nextInt()); - break; - case SPAN_TYPE_VALUE: - builder.setSpanTypeValue(reader.nextInt()); - break; - case SPAN_LAYER_VALUE: - builder.setSpanLayerValue(reader.nextInt()); - break; - case PARENT_SPAN_ID: - builder.setParentSpanId(reader.nextInt()); - break; - case START_TIME: - builder.setStartTime(reader.nextLong()); - break; - case END_TIME: - builder.setEndTime(reader.nextLong()); - break; - case COMPONENT_ID: - builder.setComponentId(reader.nextInt()); - break; - case COMPONENT_NAME: - builder.setComponent(reader.nextString()); - break; - case OPERATION_NAME_ID: - builder.setOperationNameId(reader.nextInt()); - break; - case OPERATION_NAME: - builder.setOperationName(reader.nextString()); - break; - case PEER_ID: - builder.setPeerId(reader.nextInt()); - break; - case PEER: - builder.setPeer(reader.nextString()); - break; - case IS_ERROR: - builder.setIsError(reader.nextBoolean()); - break; - case TAGS: - reader.beginArray(); - while (reader.hasNext()) { - builder.addTags(keyWithStringValueJsonReader.read(reader)); - } - reader.endArray(); - break; - case LOGS: - reader.beginArray(); - while (reader.hasNext()) { - builder.addLogs(logJsonReader.read(reader)); - } - reader.endArray(); - break; - default: - reader.skipValue(); - break; - } - } - reader.endObject(); - - return builder.build(); - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/jetty/handler/reader/StreamJsonReader.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/jetty/handler/reader/StreamJsonReader.java deleted file mode 100644 index 9175c4e800..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/jetty/handler/reader/StreamJsonReader.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.jetty.handler.reader; - -import com.google.gson.stream.JsonReader; -import java.io.IOException; - -/** - * @author peng-yongsheng - */ -public interface StreamJsonReader { - T read(JsonReader reader) throws IOException; -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/jetty/handler/reader/TraceSegment.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/jetty/handler/reader/TraceSegment.java deleted file mode 100644 index 851bbfa1c3..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/jetty/handler/reader/TraceSegment.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.jetty.handler.reader; - -import org.skywalking.apm.network.proto.TraceSegmentObject; -import org.skywalking.apm.network.proto.UniqueId; -import org.skywalking.apm.network.proto.UpstreamSegment; - -/** - * @author peng-yongsheng - */ -public class TraceSegment { - - private UpstreamSegment.Builder builder; - - public TraceSegment() { - builder = UpstreamSegment.newBuilder(); - } - - public void addGlobalTraceId(UniqueId.Builder globalTraceId) { - builder.addGlobalTraceIds(globalTraceId); - } - - public void setTraceSegmentBuilder(TraceSegmentObject.Builder traceSegmentBuilder) { - builder.setSegment(traceSegmentBuilder.build().toByteString()); - } - - public UpstreamSegment getUpstreamSegment() { - return builder.build(); - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/jetty/handler/reader/TraceSegmentJsonReader.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/jetty/handler/reader/TraceSegmentJsonReader.java deleted file mode 100644 index 1390f21cca..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/jetty/handler/reader/TraceSegmentJsonReader.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.jetty.handler.reader; - -import com.google.gson.stream.JsonReader; -import java.io.IOException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class TraceSegmentJsonReader implements StreamJsonReader { - - private final Logger logger = LoggerFactory.getLogger(TraceSegmentJsonReader.class); - - private UniqueIdJsonReader uniqueIdJsonReader = new UniqueIdJsonReader(); - private SegmentJsonReader segmentJsonReader = new SegmentJsonReader(); - - private static final String GLOBAL_TRACE_IDS = "gt"; - private static final String SEGMENT = "sg"; - - @Override public TraceSegment read(JsonReader reader) throws IOException { - TraceSegment traceSegment = new TraceSegment(); - - reader.beginObject(); - while (reader.hasNext()) { - switch (reader.nextName()) { - case GLOBAL_TRACE_IDS: - reader.beginArray(); - while (reader.hasNext()) { - traceSegment.addGlobalTraceId(uniqueIdJsonReader.read(reader)); - } - reader.endArray(); - - break; - case SEGMENT: - traceSegment.setTraceSegmentBuilder(segmentJsonReader.read(reader)); - break; - default: - reader.skipValue(); - break; - } - } - reader.endObject(); - - return traceSegment; - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/jetty/handler/reader/UniqueIdJsonReader.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/jetty/handler/reader/UniqueIdJsonReader.java deleted file mode 100644 index 9bf1c3ed79..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/jetty/handler/reader/UniqueIdJsonReader.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.jetty.handler.reader; - -import com.google.gson.stream.JsonReader; -import java.io.IOException; -import org.skywalking.apm.network.proto.UniqueId; - -/** - * @author peng-yongsheng - */ -public class UniqueIdJsonReader implements StreamJsonReader { - - @Override public UniqueId.Builder read(JsonReader reader) throws IOException { - UniqueId.Builder builder = UniqueId.newBuilder(); - - reader.beginArray(); - while (reader.hasNext()) { - builder.addIdParts(reader.nextLong()); - } - reader.endArray(); - return builder; - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/AgentStreamModuleDefineException.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/AgentStreamModuleDefineException.java deleted file mode 100644 index 4398ca80fd..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/AgentStreamModuleDefineException.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.worker; - -import org.skywalking.apm.collector.core.framework.DefineException; - -/** - * @author peng-yongsheng - */ -public class AgentStreamModuleDefineException extends DefineException { - - public AgentStreamModuleDefineException(String message) { - super(message); - } - - public AgentStreamModuleDefineException(String message, Throwable cause) { - super(message, cause); - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/global/GlobalTracePersistenceWorker.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/global/GlobalTracePersistenceWorker.java deleted file mode 100644 index 9c178c3c2b..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/global/GlobalTracePersistenceWorker.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.worker.global; - -import org.skywalking.apm.collector.agentstream.worker.global.dao.IGlobalTraceDAO; -import org.skywalking.apm.collector.storage.base.dao.DAOContainer; -import org.skywalking.apm.collector.storage.base.define.DataDefine; -import org.skywalking.apm.collector.storage.base.define.global.GlobalTraceDataDefine; -import org.skywalking.apm.collector.stream.worker.AbstractLocalAsyncWorkerProvider; -import org.skywalking.apm.collector.stream.worker.ClusterWorkerContext; -import org.skywalking.apm.collector.stream.worker.ProviderNotFoundException; -import org.skywalking.apm.collector.stream.worker.Role; -import org.skywalking.apm.collector.stream.worker.impl.PersistenceWorker; -import org.skywalking.apm.collector.stream.worker.impl.dao.IPersistenceDAO; -import org.skywalking.apm.collector.stream.worker.selector.RollingSelector; -import org.skywalking.apm.collector.stream.worker.selector.WorkerSelector; - -/** - * @author peng-yongsheng - */ -public class GlobalTracePersistenceWorker extends PersistenceWorker { - - public GlobalTracePersistenceWorker(Role role, ClusterWorkerContext clusterContext) { - super(role, clusterContext); - } - - @Override public void preStart() throws ProviderNotFoundException { - super.preStart(); - } - - @Override protected boolean needMergeDBData() { - return false; - } - - @Override protected IPersistenceDAO persistenceDAO() { - return (IPersistenceDAO)DAOContainer.INSTANCE.get(IGlobalTraceDAO.class.getName()); - } - - public static class Factory extends AbstractLocalAsyncWorkerProvider { - @Override - public Role role() { - return WorkerRole.INSTANCE; - } - - @Override - public GlobalTracePersistenceWorker workerInstance(ClusterWorkerContext clusterContext) { - return new GlobalTracePersistenceWorker(role(), clusterContext); - } - - @Override - public int queueSize() { - return 1024; - } - } - - public enum WorkerRole implements Role { - INSTANCE; - - @Override - public String roleName() { - return GlobalTracePersistenceWorker.class.getSimpleName(); - } - - @Override - public WorkerSelector workerSelector() { - return new RollingSelector(); - } - - @Override public DataDefine dataDefine() { - return new GlobalTraceDataDefine(); - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/global/GlobalTraceSpanListener.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/global/GlobalTraceSpanListener.java deleted file mode 100644 index 2640146df8..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/global/GlobalTraceSpanListener.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.worker.global; - -import java.util.ArrayList; -import java.util.List; -import org.skywalking.apm.collector.agentstream.worker.segment.FirstSpanListener; -import org.skywalking.apm.collector.agentstream.worker.segment.GlobalTraceIdsListener; -import org.skywalking.apm.collector.agentstream.worker.segment.standardization.SpanDecorator; -import org.skywalking.apm.collector.core.framework.CollectorContextHelper; -import org.skywalking.apm.collector.core.util.Const; -import org.skywalking.apm.collector.core.util.TimeBucketUtils; -import org.skywalking.apm.collector.storage.base.define.global.GlobalTraceDataDefine; -import org.skywalking.apm.collector.stream.StreamModuleContext; -import org.skywalking.apm.collector.stream.StreamModuleGroupDefine; -import org.skywalking.apm.collector.stream.worker.WorkerInvokeException; -import org.skywalking.apm.collector.stream.worker.WorkerNotFoundException; -import org.skywalking.apm.network.proto.UniqueId; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class GlobalTraceSpanListener implements FirstSpanListener, GlobalTraceIdsListener { - - private final Logger logger = LoggerFactory.getLogger(GlobalTraceSpanListener.class); - - private List globalTraceIds = new ArrayList<>(); - private String segmentId; - private long timeBucket; - - @Override - public void parseFirst(SpanDecorator spanDecorator, int applicationId, int applicationInstanceId, - String segmentId) { - this.timeBucket = TimeBucketUtils.INSTANCE.getMinuteTimeBucket(spanDecorator.getStartTime()); - this.segmentId = segmentId; - } - - @Override public void parseGlobalTraceId(UniqueId uniqueId) { - StringBuilder globalTraceIdBuilder = new StringBuilder(); - for (int i = 0; i < uniqueId.getIdPartsList().size(); i++) { - if (i == 0) { - globalTraceIdBuilder.append(uniqueId.getIdPartsList().get(i)); - } else { - globalTraceIdBuilder.append(".").append(uniqueId.getIdPartsList().get(i)); - } - } - globalTraceIds.add(globalTraceIdBuilder.toString()); - } - - @Override public void build() { - logger.debug("global trace listener build"); - StreamModuleContext context = (StreamModuleContext)CollectorContextHelper.INSTANCE.getContext(StreamModuleGroupDefine.GROUP_NAME); - - for (String globalTraceId : globalTraceIds) { - GlobalTraceDataDefine.GlobalTrace globalTrace = new GlobalTraceDataDefine.GlobalTrace(); - globalTrace.setGlobalTraceId(globalTraceId); - globalTrace.setId(segmentId + Const.ID_SPLIT + globalTraceId); - globalTrace.setSegmentId(segmentId); - globalTrace.setTimeBucket(timeBucket); - try { - logger.debug("send to global trace persistence worker, id: {}", globalTrace.getId()); - context.getClusterWorkerContext().lookup(GlobalTracePersistenceWorker.WorkerRole.INSTANCE).tell(globalTrace.toData()); - } catch (WorkerInvokeException | WorkerNotFoundException e) { - logger.error(e.getMessage(), e); - } - } - } -} \ No newline at end of file diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/global/dao/GlobalTraceEsDAO.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/global/dao/GlobalTraceEsDAO.java deleted file mode 100644 index f2b71a56c6..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/global/dao/GlobalTraceEsDAO.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.worker.global.dao; - -import java.util.HashMap; -import java.util.Map; -import org.elasticsearch.action.index.IndexRequestBuilder; -import org.elasticsearch.action.update.UpdateRequestBuilder; -import org.skywalking.apm.collector.core.framework.UnexpectedException; -import org.skywalking.apm.collector.core.stream.Data; -import org.skywalking.apm.collector.storage.base.define.DataDefine; -import org.skywalking.apm.collector.storage.base.define.global.GlobalTraceTable; -import org.skywalking.apm.collector.storage.elasticsearch.dao.EsDAO; -import org.skywalking.apm.collector.stream.worker.impl.dao.IPersistenceDAO; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class GlobalTraceEsDAO extends EsDAO implements IGlobalTraceDAO, IPersistenceDAO { - - private final Logger logger = LoggerFactory.getLogger(GlobalTraceEsDAO.class); - - @Override public Data get(String id, DataDefine dataDefine) { - throw new UnexpectedException("There is no need to merge stream data with database data."); - } - - @Override public UpdateRequestBuilder prepareBatchUpdate(Data data) { - throw new UnexpectedException("There is no need to merge stream data with database data."); - } - - @Override public IndexRequestBuilder prepareBatchInsert(Data data) { - Map source = new HashMap<>(); - source.put(GlobalTraceTable.COLUMN_SEGMENT_ID, data.getDataString(1)); - source.put(GlobalTraceTable.COLUMN_GLOBAL_TRACE_ID, data.getDataString(2)); - source.put(GlobalTraceTable.COLUMN_TIME_BUCKET, data.getDataLong(0)); - logger.debug("global trace source: {}", source.toString()); - return getClient().prepareIndex(GlobalTraceTable.TABLE, data.getDataString(0)).setSource(source); - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/global/dao/GlobalTraceH2DAO.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/global/dao/GlobalTraceH2DAO.java deleted file mode 100644 index e01f730b41..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/global/dao/GlobalTraceH2DAO.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.worker.global.dao; - -import java.util.HashMap; -import java.util.Map; -import org.skywalking.apm.collector.core.framework.UnexpectedException; -import org.skywalking.apm.collector.core.stream.Data; -import org.skywalking.apm.collector.storage.base.define.DataDefine; -import org.skywalking.apm.collector.storage.base.define.global.GlobalTraceTable; -import org.skywalking.apm.collector.storage.h2.SqlBuilder; -import org.skywalking.apm.collector.storage.h2.base.dao.H2DAO; -import org.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; -import org.skywalking.apm.collector.stream.worker.impl.dao.IPersistenceDAO; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng, clevertension - */ -public class GlobalTraceH2DAO extends H2DAO implements IGlobalTraceDAO, IPersistenceDAO { - private final Logger logger = LoggerFactory.getLogger(GlobalTraceH2DAO.class); - - @Override public Data get(String id, DataDefine dataDefine) { - throw new UnexpectedException("There is no need to merge stream data with database data."); - } - - @Override public H2SqlEntity prepareBatchUpdate(Data data) { - throw new UnexpectedException("There is no need to merge stream data with database data."); - } - - @Override public H2SqlEntity prepareBatchInsert(Data data) { - Map source = new HashMap<>(); - H2SqlEntity entity = new H2SqlEntity(); - source.put(GlobalTraceTable.COLUMN_ID, data.getDataString(0)); - source.put(GlobalTraceTable.COLUMN_SEGMENT_ID, data.getDataString(1)); - source.put(GlobalTraceTable.COLUMN_GLOBAL_TRACE_ID, data.getDataString(2)); - source.put(GlobalTraceTable.COLUMN_TIME_BUCKET, data.getDataLong(0)); - logger.debug("global trace source: {}", source.toString()); - - String sql = SqlBuilder.buildBatchInsertSql(GlobalTraceTable.TABLE, source.keySet()); - entity.setSql(sql); - entity.setParams(source.values().toArray(new Object[0])); - return entity; - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/global/dao/IGlobalTraceDAO.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/global/dao/IGlobalTraceDAO.java deleted file mode 100644 index e215ca5dd6..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/global/dao/IGlobalTraceDAO.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.worker.global.dao; - -/** - * @author peng-yongsheng - */ -public interface IGlobalTraceDAO { -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/global/define/GlobalTraceEsTableDefine.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/global/define/GlobalTraceEsTableDefine.java deleted file mode 100644 index 9c375320bf..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/global/define/GlobalTraceEsTableDefine.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.worker.global.define; - -import org.skywalking.apm.collector.storage.base.define.global.GlobalTraceTable; -import org.skywalking.apm.collector.storage.elasticsearch.define.ElasticSearchColumnDefine; -import org.skywalking.apm.collector.storage.elasticsearch.define.ElasticSearchTableDefine; - -/** - * @author peng-yongsheng - */ -public class GlobalTraceEsTableDefine extends ElasticSearchTableDefine { - - public GlobalTraceEsTableDefine() { - super(GlobalTraceTable.TABLE); - } - - @Override public int refreshInterval() { - return 5; - } - - @Override public void initialize() { - addColumn(new ElasticSearchColumnDefine(GlobalTraceTable.COLUMN_SEGMENT_ID, ElasticSearchColumnDefine.Type.Keyword.name())); - addColumn(new ElasticSearchColumnDefine(GlobalTraceTable.COLUMN_GLOBAL_TRACE_ID, ElasticSearchColumnDefine.Type.Keyword.name())); - addColumn(new ElasticSearchColumnDefine(GlobalTraceTable.COLUMN_TIME_BUCKET, ElasticSearchColumnDefine.Type.Long.name())); - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/global/define/GlobalTraceH2TableDefine.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/global/define/GlobalTraceH2TableDefine.java deleted file mode 100644 index 8b34dfe91a..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/global/define/GlobalTraceH2TableDefine.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.worker.global.define; - -import org.skywalking.apm.collector.storage.base.define.global.GlobalTraceTable; -import org.skywalking.apm.collector.storage.h2.base.define.H2ColumnDefine; -import org.skywalking.apm.collector.storage.h2.base.define.H2TableDefine; - -/** - * @author peng-yongsheng - */ -public class GlobalTraceH2TableDefine extends H2TableDefine { - - public GlobalTraceH2TableDefine() { - super(GlobalTraceTable.TABLE); - } - - @Override public void initialize() { - addColumn(new H2ColumnDefine(GlobalTraceTable.COLUMN_ID, H2ColumnDefine.Type.Varchar.name())); - addColumn(new H2ColumnDefine(GlobalTraceTable.COLUMN_SEGMENT_ID, H2ColumnDefine.Type.Varchar.name())); - addColumn(new H2ColumnDefine(GlobalTraceTable.COLUMN_GLOBAL_TRACE_ID, H2ColumnDefine.Type.Varchar.name())); - addColumn(new H2ColumnDefine(GlobalTraceTable.COLUMN_TIME_BUCKET, H2ColumnDefine.Type.Bigint.name())); - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/instance/performance/InstPerformancePersistenceWorker.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/instance/performance/InstPerformancePersistenceWorker.java deleted file mode 100644 index f56fb0352d..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/instance/performance/InstPerformancePersistenceWorker.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.worker.instance.performance; - -import org.skywalking.apm.collector.agentstream.worker.instance.performance.dao.IInstPerformanceDAO; -import org.skywalking.apm.collector.storage.base.dao.DAOContainer; -import org.skywalking.apm.collector.storage.base.define.DataDefine; -import org.skywalking.apm.collector.storage.base.define.instance.InstPerformanceDataDefine; -import org.skywalking.apm.collector.stream.worker.AbstractLocalAsyncWorkerProvider; -import org.skywalking.apm.collector.stream.worker.ClusterWorkerContext; -import org.skywalking.apm.collector.stream.worker.ProviderNotFoundException; -import org.skywalking.apm.collector.stream.worker.Role; -import org.skywalking.apm.collector.stream.worker.impl.PersistenceWorker; -import org.skywalking.apm.collector.stream.worker.impl.dao.IPersistenceDAO; -import org.skywalking.apm.collector.stream.worker.selector.HashCodeSelector; -import org.skywalking.apm.collector.stream.worker.selector.WorkerSelector; - -/** - * @author peng-yongsheng - */ -public class InstPerformancePersistenceWorker extends PersistenceWorker { - - public InstPerformancePersistenceWorker(Role role, ClusterWorkerContext clusterContext) { - super(role, clusterContext); - } - - @Override public void preStart() throws ProviderNotFoundException { - super.preStart(); - } - - @Override protected boolean needMergeDBData() { - return true; - } - - @Override protected IPersistenceDAO persistenceDAO() { - return (IPersistenceDAO)DAOContainer.INSTANCE.get(IInstPerformanceDAO.class.getName()); - } - - public static class Factory extends AbstractLocalAsyncWorkerProvider { - @Override - public Role role() { - return WorkerRole.INSTANCE; - } - - @Override - public InstPerformancePersistenceWorker workerInstance(ClusterWorkerContext clusterContext) { - return new InstPerformancePersistenceWorker(role(), clusterContext); - } - - @Override - public int queueSize() { - return 1024; - } - } - - public enum WorkerRole implements Role { - INSTANCE; - - @Override - public String roleName() { - return InstPerformancePersistenceWorker.class.getSimpleName(); - } - - @Override - public WorkerSelector workerSelector() { - return new HashCodeSelector(); - } - - @Override public DataDefine dataDefine() { - return new InstPerformanceDataDefine(); - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/instance/performance/InstPerformanceSpanListener.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/instance/performance/InstPerformanceSpanListener.java deleted file mode 100644 index 18d42b1e3a..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/instance/performance/InstPerformanceSpanListener.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.worker.instance.performance; - -import org.skywalking.apm.collector.agentstream.worker.segment.EntrySpanListener; -import org.skywalking.apm.collector.agentstream.worker.segment.FirstSpanListener; -import org.skywalking.apm.collector.agentstream.worker.segment.standardization.SpanDecorator; -import org.skywalking.apm.collector.core.framework.CollectorContextHelper; -import org.skywalking.apm.collector.core.util.Const; -import org.skywalking.apm.collector.core.util.TimeBucketUtils; -import org.skywalking.apm.collector.storage.base.define.instance.InstPerformanceDataDefine; -import org.skywalking.apm.collector.stream.StreamModuleContext; -import org.skywalking.apm.collector.stream.StreamModuleGroupDefine; -import org.skywalking.apm.collector.stream.worker.WorkerInvokeException; -import org.skywalking.apm.collector.stream.worker.WorkerNotFoundException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class InstPerformanceSpanListener implements EntrySpanListener, FirstSpanListener { - - private final Logger logger = LoggerFactory.getLogger(InstPerformanceSpanListener.class); - - private int applicationId; - private int instanceId; - private long cost; - private long timeBucket; - - @Override - public void parseEntry(SpanDecorator spanDecorator, int applicationId, int applicationInstanceId, - String segmentId) { - } - - @Override - public void parseFirst(SpanDecorator spanDecorator, int applicationId, int applicationInstanceId, - String segmentId) { - this.applicationId = applicationId; - this.instanceId = applicationInstanceId; - this.cost = spanDecorator.getEndTime() - spanDecorator.getStartTime(); - timeBucket = TimeBucketUtils.INSTANCE.getSecondTimeBucket(spanDecorator.getStartTime()); - } - - @Override public void build() { - StreamModuleContext context = (StreamModuleContext)CollectorContextHelper.INSTANCE.getContext(StreamModuleGroupDefine.GROUP_NAME); - - InstPerformanceDataDefine.InstPerformance instPerformance = new InstPerformanceDataDefine.InstPerformance(); - instPerformance.setId(timeBucket + Const.ID_SPLIT + instanceId); - instPerformance.setApplicationId(applicationId); - instPerformance.setInstanceId(instanceId); - instPerformance.setCalls(1); - instPerformance.setCostTotal(cost); - instPerformance.setTimeBucket(timeBucket); - - try { - logger.debug("send to instance performance persistence worker, id: {}", instPerformance.getId()); - context.getClusterWorkerContext().lookup(InstPerformancePersistenceWorker.WorkerRole.INSTANCE).tell(instPerformance.toData()); - } catch (WorkerInvokeException | WorkerNotFoundException e) { - logger.error(e.getMessage(), e); - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/instance/performance/dao/IInstPerformanceDAO.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/instance/performance/dao/IInstPerformanceDAO.java deleted file mode 100644 index 1821d54c16..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/instance/performance/dao/IInstPerformanceDAO.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.worker.instance.performance.dao; - -/** - * @author peng-yongsheng - */ -public interface IInstPerformanceDAO { -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/instance/performance/dao/InstPerformanceEsDAO.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/instance/performance/dao/InstPerformanceEsDAO.java deleted file mode 100644 index 16977d8070..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/instance/performance/dao/InstPerformanceEsDAO.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.worker.instance.performance.dao; - -import java.util.HashMap; -import java.util.Map; -import org.elasticsearch.action.get.GetResponse; -import org.elasticsearch.action.index.IndexRequestBuilder; -import org.elasticsearch.action.update.UpdateRequestBuilder; -import org.skywalking.apm.collector.core.stream.Data; -import org.skywalking.apm.collector.storage.base.define.DataDefine; -import org.skywalking.apm.collector.storage.base.define.instance.InstPerformanceTable; -import org.skywalking.apm.collector.storage.elasticsearch.dao.EsDAO; -import org.skywalking.apm.collector.stream.worker.impl.dao.IPersistenceDAO; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class InstPerformanceEsDAO extends EsDAO implements IInstPerformanceDAO, IPersistenceDAO { - - private final Logger logger = LoggerFactory.getLogger(InstPerformanceEsDAO.class); - - @Override public Data get(String id, DataDefine dataDefine) { - GetResponse getResponse = getClient().prepareGet(InstPerformanceTable.TABLE, id).get(); - if (getResponse.isExists()) { - logger.debug("id: {} is exist", id); - Data data = dataDefine.build(id); - Map source = getResponse.getSource(); - data.setDataInteger(0, (Integer)source.get(InstPerformanceTable.COLUMN_APPLICATION_ID)); - data.setDataInteger(1, (Integer)source.get(InstPerformanceTable.COLUMN_INSTANCE_ID)); - data.setDataInteger(2, (Integer)source.get(InstPerformanceTable.COLUMN_CALLS)); - data.setDataLong(0, ((Number)source.get(InstPerformanceTable.COLUMN_COST_TOTAL)).longValue()); - data.setDataLong(1, ((Number)source.get(InstPerformanceTable.COLUMN_TIME_BUCKET)).longValue()); - return data; - } else { - return null; - } - } - - @Override public IndexRequestBuilder prepareBatchInsert(Data data) { - Map source = new HashMap<>(); - source.put(InstPerformanceTable.COLUMN_APPLICATION_ID, data.getDataInteger(0)); - source.put(InstPerformanceTable.COLUMN_INSTANCE_ID, data.getDataInteger(1)); - source.put(InstPerformanceTable.COLUMN_CALLS, data.getDataInteger(2)); - source.put(InstPerformanceTable.COLUMN_COST_TOTAL, data.getDataLong(0)); - source.put(InstPerformanceTable.COLUMN_TIME_BUCKET, data.getDataLong(1)); - - return getClient().prepareIndex(InstPerformanceTable.TABLE, data.getDataString(0)).setSource(source); - } - - @Override public UpdateRequestBuilder prepareBatchUpdate(Data data) { - Map source = new HashMap<>(); - source.put(InstPerformanceTable.COLUMN_APPLICATION_ID, data.getDataInteger(0)); - source.put(InstPerformanceTable.COLUMN_INSTANCE_ID, data.getDataInteger(1)); - source.put(InstPerformanceTable.COLUMN_CALLS, data.getDataInteger(2)); - source.put(InstPerformanceTable.COLUMN_COST_TOTAL, data.getDataLong(0)); - source.put(InstPerformanceTable.COLUMN_TIME_BUCKET, data.getDataLong(1)); - - return getClient().prepareUpdate(InstPerformanceTable.TABLE, data.getDataString(0)).setDoc(source); - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/instance/performance/dao/InstPerformanceH2DAO.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/instance/performance/dao/InstPerformanceH2DAO.java deleted file mode 100644 index b674ad0ccc..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/instance/performance/dao/InstPerformanceH2DAO.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.worker.instance.performance.dao; - -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import org.skywalking.apm.collector.client.h2.H2Client; -import org.skywalking.apm.collector.client.h2.H2ClientException; -import org.skywalking.apm.collector.core.stream.Data; -import org.skywalking.apm.collector.storage.base.define.DataDefine; -import org.skywalking.apm.collector.storage.base.define.instance.InstPerformanceTable; -import org.skywalking.apm.collector.storage.h2.SqlBuilder; -import org.skywalking.apm.collector.storage.h2.base.dao.H2DAO; -import org.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; -import org.skywalking.apm.collector.stream.worker.impl.dao.IPersistenceDAO; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng, clevertension - */ -public class InstPerformanceH2DAO extends H2DAO implements IInstPerformanceDAO, IPersistenceDAO { - private final Logger logger = LoggerFactory.getLogger(InstPerformanceH2DAO.class); - private static final String GET_SQL = "select * from {0} where {1} = ?"; - - @Override public Data get(String id, DataDefine dataDefine) { - H2Client client = getClient(); - String sql = SqlBuilder.buildSql(GET_SQL, InstPerformanceTable.TABLE, InstPerformanceTable.COLUMN_ID); - Object[] params = new Object[] {id}; - try (ResultSet rs = client.executeQuery(sql, params)) { - if (rs.next()) { - Data data = dataDefine.build(id); - data.setDataInteger(0, rs.getInt(InstPerformanceTable.COLUMN_APPLICATION_ID)); - data.setDataInteger(1, rs.getInt(InstPerformanceTable.COLUMN_INSTANCE_ID)); - data.setDataInteger(2, rs.getInt(InstPerformanceTable.COLUMN_CALLS)); - data.setDataLong(0, rs.getLong(InstPerformanceTable.COLUMN_COST_TOTAL)); - data.setDataLong(1, rs.getLong(InstPerformanceTable.COLUMN_TIME_BUCKET)); - return data; - } - } catch (SQLException | H2ClientException e) { - logger.error(e.getMessage(), e); - } - return null; - } - - @Override public H2SqlEntity prepareBatchInsert(Data data) { - Map source = new HashMap<>(); - H2SqlEntity entity = new H2SqlEntity(); - source.put(InstPerformanceTable.COLUMN_ID, data.getDataString(0)); - source.put(InstPerformanceTable.COLUMN_APPLICATION_ID, data.getDataInteger(0)); - source.put(InstPerformanceTable.COLUMN_INSTANCE_ID, data.getDataInteger(1)); - source.put(InstPerformanceTable.COLUMN_CALLS, data.getDataInteger(2)); - source.put(InstPerformanceTable.COLUMN_COST_TOTAL, data.getDataLong(0)); - source.put(InstPerformanceTable.COLUMN_TIME_BUCKET, data.getDataLong(1)); - String sql = SqlBuilder.buildBatchInsertSql(InstPerformanceTable.TABLE, source.keySet()); - entity.setSql(sql); - entity.setParams(source.values().toArray(new Object[0])); - return entity; - } - - @Override public H2SqlEntity prepareBatchUpdate(Data data) { - Map source = new HashMap<>(); - H2SqlEntity entity = new H2SqlEntity(); - source.put(InstPerformanceTable.COLUMN_APPLICATION_ID, data.getDataInteger(0)); - source.put(InstPerformanceTable.COLUMN_INSTANCE_ID, data.getDataInteger(1)); - source.put(InstPerformanceTable.COLUMN_CALLS, data.getDataInteger(2)); - source.put(InstPerformanceTable.COLUMN_COST_TOTAL, data.getDataLong(0)); - source.put(InstPerformanceTable.COLUMN_TIME_BUCKET, data.getDataLong(1)); - String id = data.getDataString(0); - String sql = SqlBuilder.buildBatchUpdateSql(InstPerformanceTable.TABLE, source.keySet(), InstPerformanceTable.COLUMN_ID); - entity.setSql(sql); - List values = new ArrayList<>(source.values()); - values.add(id); - entity.setParams(values.toArray(new Object[0])); - return entity; - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/instance/performance/define/InstPerformanceEsTableDefine.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/instance/performance/define/InstPerformanceEsTableDefine.java deleted file mode 100644 index 4ec7ca5c7e..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/instance/performance/define/InstPerformanceEsTableDefine.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.worker.instance.performance.define; - -import org.skywalking.apm.collector.storage.base.define.instance.InstPerformanceTable; -import org.skywalking.apm.collector.storage.elasticsearch.define.ElasticSearchColumnDefine; -import org.skywalking.apm.collector.storage.elasticsearch.define.ElasticSearchTableDefine; - -/** - * @author peng-yongsheng - */ -public class InstPerformanceEsTableDefine extends ElasticSearchTableDefine { - - public InstPerformanceEsTableDefine() { - super(InstPerformanceTable.TABLE); - } - - @Override public int refreshInterval() { - return 2; - } - - @Override public void initialize() { - addColumn(new ElasticSearchColumnDefine(InstPerformanceTable.COLUMN_APPLICATION_ID, ElasticSearchColumnDefine.Type.Integer.name())); - addColumn(new ElasticSearchColumnDefine(InstPerformanceTable.COLUMN_INSTANCE_ID, ElasticSearchColumnDefine.Type.Integer.name())); - addColumn(new ElasticSearchColumnDefine(InstPerformanceTable.COLUMN_CALLS, ElasticSearchColumnDefine.Type.Integer.name())); - addColumn(new ElasticSearchColumnDefine(InstPerformanceTable.COLUMN_COST_TOTAL, ElasticSearchColumnDefine.Type.Long.name())); - addColumn(new ElasticSearchColumnDefine(InstPerformanceTable.COLUMN_TIME_BUCKET, ElasticSearchColumnDefine.Type.Long.name())); - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/instance/performance/define/InstPerformanceH2TableDefine.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/instance/performance/define/InstPerformanceH2TableDefine.java deleted file mode 100644 index 60e35f1c40..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/instance/performance/define/InstPerformanceH2TableDefine.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.worker.instance.performance.define; - -import org.skywalking.apm.collector.storage.base.define.instance.InstPerformanceTable; -import org.skywalking.apm.collector.storage.h2.base.define.H2ColumnDefine; -import org.skywalking.apm.collector.storage.h2.base.define.H2TableDefine; - -/** - * @author peng-yongsheng - */ -public class InstPerformanceH2TableDefine extends H2TableDefine { - - public InstPerformanceH2TableDefine() { - super(InstPerformanceTable.TABLE); - } - - @Override public void initialize() { - addColumn(new H2ColumnDefine(InstPerformanceTable.COLUMN_ID, H2ColumnDefine.Type.Varchar.name())); - addColumn(new H2ColumnDefine(InstPerformanceTable.COLUMN_APPLICATION_ID, H2ColumnDefine.Type.Int.name())); - addColumn(new H2ColumnDefine(InstPerformanceTable.COLUMN_INSTANCE_ID, H2ColumnDefine.Type.Int.name())); - addColumn(new H2ColumnDefine(InstPerformanceTable.COLUMN_CALLS, H2ColumnDefine.Type.Int.name())); - addColumn(new H2ColumnDefine(InstPerformanceTable.COLUMN_COST_TOTAL, H2ColumnDefine.Type.Bigint.name())); - addColumn(new H2ColumnDefine(InstPerformanceTable.COLUMN_TIME_BUCKET, H2ColumnDefine.Type.Bigint.name())); - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/node/component/NodeComponentAggregationWorker.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/node/component/NodeComponentAggregationWorker.java deleted file mode 100644 index 0ddc2326c5..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/node/component/NodeComponentAggregationWorker.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.worker.node.component; - -import org.skywalking.apm.collector.storage.base.define.DataDefine; -import org.skywalking.apm.collector.storage.base.define.node.NodeComponentDataDefine; -import org.skywalking.apm.collector.stream.worker.AbstractLocalAsyncWorkerProvider; -import org.skywalking.apm.collector.stream.worker.ClusterWorkerContext; -import org.skywalking.apm.collector.stream.worker.ProviderNotFoundException; -import org.skywalking.apm.collector.stream.worker.Role; -import org.skywalking.apm.collector.stream.worker.WorkerNotFoundException; -import org.skywalking.apm.collector.stream.worker.WorkerRefs; -import org.skywalking.apm.collector.stream.worker.impl.AggregationWorker; -import org.skywalking.apm.collector.stream.worker.selector.HashCodeSelector; -import org.skywalking.apm.collector.stream.worker.selector.WorkerSelector; - -/** - * @author peng-yongsheng - */ -public class NodeComponentAggregationWorker extends AggregationWorker { - - public NodeComponentAggregationWorker(Role role, ClusterWorkerContext clusterContext) { - super(role, clusterContext); - } - - @Override public void preStart() throws ProviderNotFoundException { - super.preStart(); - } - - @Override protected WorkerRefs nextWorkRef(String id) throws WorkerNotFoundException { - return getClusterContext().lookup(NodeComponentRemoteWorker.WorkerRole.INSTANCE); - } - - public static class Factory extends AbstractLocalAsyncWorkerProvider { - @Override - public Role role() { - return WorkerRole.INSTANCE; - } - - @Override - public NodeComponentAggregationWorker workerInstance(ClusterWorkerContext clusterContext) { - return new NodeComponentAggregationWorker(role(), clusterContext); - } - - @Override - public int queueSize() { - return 1024; - } - } - - public enum WorkerRole implements Role { - INSTANCE; - - @Override - public String roleName() { - return NodeComponentAggregationWorker.class.getSimpleName(); - } - - @Override - public WorkerSelector workerSelector() { - return new HashCodeSelector(); - } - - @Override public DataDefine dataDefine() { - return new NodeComponentDataDefine(); - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/node/component/NodeComponentPersistenceWorker.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/node/component/NodeComponentPersistenceWorker.java deleted file mode 100644 index 447012931f..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/node/component/NodeComponentPersistenceWorker.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.worker.node.component; - -import org.skywalking.apm.collector.agentstream.worker.node.component.dao.INodeComponentDAO; -import org.skywalking.apm.collector.storage.base.dao.DAOContainer; -import org.skywalking.apm.collector.storage.base.define.DataDefine; -import org.skywalking.apm.collector.storage.base.define.node.NodeComponentDataDefine; -import org.skywalking.apm.collector.stream.worker.AbstractLocalAsyncWorkerProvider; -import org.skywalking.apm.collector.stream.worker.ClusterWorkerContext; -import org.skywalking.apm.collector.stream.worker.ProviderNotFoundException; -import org.skywalking.apm.collector.stream.worker.Role; -import org.skywalking.apm.collector.stream.worker.impl.PersistenceWorker; -import org.skywalking.apm.collector.stream.worker.impl.dao.IPersistenceDAO; -import org.skywalking.apm.collector.stream.worker.selector.HashCodeSelector; -import org.skywalking.apm.collector.stream.worker.selector.WorkerSelector; - -/** - * @author peng-yongsheng - */ -public class NodeComponentPersistenceWorker extends PersistenceWorker { - - public NodeComponentPersistenceWorker(Role role, ClusterWorkerContext clusterContext) { - super(role, clusterContext); - } - - @Override public void preStart() throws ProviderNotFoundException { - super.preStart(); - } - - @Override protected boolean needMergeDBData() { - return true; - } - - @Override protected IPersistenceDAO persistenceDAO() { - return (IPersistenceDAO)DAOContainer.INSTANCE.get(INodeComponentDAO.class.getName()); - } - - public static class Factory extends AbstractLocalAsyncWorkerProvider { - @Override - public Role role() { - return WorkerRole.INSTANCE; - } - - @Override - public NodeComponentPersistenceWorker workerInstance(ClusterWorkerContext clusterContext) { - return new NodeComponentPersistenceWorker(role(), clusterContext); - } - - @Override - public int queueSize() { - return 1024; - } - } - - public enum WorkerRole implements Role { - INSTANCE; - - @Override - public String roleName() { - return NodeComponentPersistenceWorker.class.getSimpleName(); - } - - @Override - public WorkerSelector workerSelector() { - return new HashCodeSelector(); - } - - @Override public DataDefine dataDefine() { - return new NodeComponentDataDefine(); - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/node/component/NodeComponentRemoteWorker.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/node/component/NodeComponentRemoteWorker.java deleted file mode 100644 index 80f0bcce30..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/node/component/NodeComponentRemoteWorker.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.worker.node.component; - -import org.skywalking.apm.collector.storage.base.define.DataDefine; -import org.skywalking.apm.collector.storage.base.define.node.NodeComponentDataDefine; -import org.skywalking.apm.collector.stream.worker.AbstractRemoteWorker; -import org.skywalking.apm.collector.stream.worker.AbstractRemoteWorkerProvider; -import org.skywalking.apm.collector.stream.worker.ClusterWorkerContext; -import org.skywalking.apm.collector.stream.worker.ProviderNotFoundException; -import org.skywalking.apm.collector.stream.worker.Role; -import org.skywalking.apm.collector.stream.worker.WorkerException; -import org.skywalking.apm.collector.stream.worker.selector.HashCodeSelector; -import org.skywalking.apm.collector.stream.worker.selector.WorkerSelector; - -/** - * @author peng-yongsheng - */ -public class NodeComponentRemoteWorker extends AbstractRemoteWorker { - - protected NodeComponentRemoteWorker(Role role, ClusterWorkerContext clusterContext) { - super(role, clusterContext); - } - - @Override public void preStart() throws ProviderNotFoundException { - - } - - @Override protected void onWork(Object message) throws WorkerException { - getClusterContext().lookup(NodeComponentPersistenceWorker.WorkerRole.INSTANCE).tell(message); - } - - public static class Factory extends AbstractRemoteWorkerProvider { - @Override - public Role role() { - return WorkerRole.INSTANCE; - } - - @Override - public NodeComponentRemoteWorker workerInstance(ClusterWorkerContext clusterContext) { - return new NodeComponentRemoteWorker(role(), clusterContext); - } - } - - public enum WorkerRole implements Role { - INSTANCE; - - @Override - public String roleName() { - return NodeComponentRemoteWorker.class.getSimpleName(); - } - - @Override - public WorkerSelector workerSelector() { - return new HashCodeSelector(); - } - - @Override public DataDefine dataDefine() { - return new NodeComponentDataDefine(); - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/node/component/NodeComponentSpanListener.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/node/component/NodeComponentSpanListener.java deleted file mode 100644 index 26026dc093..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/node/component/NodeComponentSpanListener.java +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.worker.node.component; - -import java.util.ArrayList; -import java.util.List; -import org.skywalking.apm.collector.agentstream.worker.segment.EntrySpanListener; -import org.skywalking.apm.collector.agentstream.worker.segment.ExitSpanListener; -import org.skywalking.apm.collector.agentstream.worker.segment.FirstSpanListener; -import org.skywalking.apm.collector.agentstream.worker.segment.standardization.SpanDecorator; -import org.skywalking.apm.collector.core.framework.CollectorContextHelper; -import org.skywalking.apm.collector.core.util.Const; -import org.skywalking.apm.collector.core.util.TimeBucketUtils; -import org.skywalking.apm.collector.storage.base.define.node.NodeComponentDataDefine; -import org.skywalking.apm.collector.stream.StreamModuleContext; -import org.skywalking.apm.collector.stream.StreamModuleGroupDefine; -import org.skywalking.apm.collector.stream.worker.WorkerInvokeException; -import org.skywalking.apm.collector.stream.worker.WorkerNotFoundException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class NodeComponentSpanListener implements EntrySpanListener, ExitSpanListener, FirstSpanListener { - - private final Logger logger = LoggerFactory.getLogger(NodeComponentSpanListener.class); - - private List nodeComponents = new ArrayList<>(); - private long timeBucket; - - @Override - public void parseExit(SpanDecorator spanDecorator, int applicationId, int applicationInstanceId, String segmentId) { - NodeComponentDataDefine.NodeComponent nodeComponent = new NodeComponentDataDefine.NodeComponent(); - nodeComponent.setComponentId(spanDecorator.getComponentId()); - - String id; - if (spanDecorator.getComponentId() == 0) { - nodeComponent.setComponentName(spanDecorator.getComponent()); - id = nodeComponent.getComponentName(); - } else { - nodeComponent.setComponentName(Const.EMPTY_STRING); - id = String.valueOf(nodeComponent.getComponentId()); - } - - nodeComponent.setPeerId(spanDecorator.getPeerId()); - nodeComponent.setPeer(Const.EMPTY_STRING); - id = id + Const.ID_SPLIT + nodeComponent.getPeerId(); - nodeComponent.setId(id); - nodeComponents.add(nodeComponent); - } - - @Override - public void parseEntry(SpanDecorator spanDecorator, int applicationId, int applicationInstanceId, - String segmentId) { - NodeComponentDataDefine.NodeComponent nodeComponent = new NodeComponentDataDefine.NodeComponent(); - nodeComponent.setComponentId(spanDecorator.getComponentId()); - - String id; - if (spanDecorator.getComponentId() == 0) { - nodeComponent.setComponentName(spanDecorator.getComponent()); - id = nodeComponent.getComponentName(); - } else { - id = String.valueOf(nodeComponent.getComponentId()); - nodeComponent.setComponentName(Const.EMPTY_STRING); - } - - nodeComponent.setPeerId(applicationId); - nodeComponent.setPeer(Const.EMPTY_STRING); - id = id + Const.ID_SPLIT + String.valueOf(applicationId); - nodeComponent.setId(id); - - nodeComponents.add(nodeComponent); - } - - @Override - public void parseFirst(SpanDecorator spanDecorator, int applicationId, int applicationInstanceId, - String segmentId) { - timeBucket = TimeBucketUtils.INSTANCE.getMinuteTimeBucket(spanDecorator.getStartTime()); - } - - @Override public void build() { - StreamModuleContext context = (StreamModuleContext)CollectorContextHelper.INSTANCE.getContext(StreamModuleGroupDefine.GROUP_NAME); - - nodeComponents.forEach(nodeComponent -> { - nodeComponent.setId(timeBucket + Const.ID_SPLIT + nodeComponent.getId()); - nodeComponent.setTimeBucket(timeBucket); - - try { - logger.debug("send to node component aggregation worker, id: {}", nodeComponent.getId()); - context.getClusterWorkerContext().lookup(NodeComponentAggregationWorker.WorkerRole.INSTANCE).tell(nodeComponent.toData()); - } catch (WorkerInvokeException | WorkerNotFoundException e) { - logger.error(e.getMessage(), e); - } - }); - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/node/component/dao/INodeComponentDAO.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/node/component/dao/INodeComponentDAO.java deleted file mode 100644 index 237f2e9f87..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/node/component/dao/INodeComponentDAO.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.worker.node.component.dao; - -/** - * @author peng-yongsheng - */ -public interface INodeComponentDAO { -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/node/component/dao/NodeComponentEsDAO.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/node/component/dao/NodeComponentEsDAO.java deleted file mode 100644 index 867336bd4e..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/node/component/dao/NodeComponentEsDAO.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.worker.node.component.dao; - -import java.util.HashMap; -import java.util.Map; -import org.elasticsearch.action.get.GetResponse; -import org.elasticsearch.action.index.IndexRequestBuilder; -import org.elasticsearch.action.update.UpdateRequestBuilder; -import org.skywalking.apm.collector.core.stream.Data; -import org.skywalking.apm.collector.storage.base.define.DataDefine; -import org.skywalking.apm.collector.storage.base.define.node.NodeComponentTable; -import org.skywalking.apm.collector.storage.elasticsearch.dao.EsDAO; -import org.skywalking.apm.collector.stream.worker.impl.dao.IPersistenceDAO; - -/** - * @author peng-yongsheng - */ -public class NodeComponentEsDAO extends EsDAO implements INodeComponentDAO, IPersistenceDAO { - - @Override public Data get(String id, DataDefine dataDefine) { - GetResponse getResponse = getClient().prepareGet(NodeComponentTable.TABLE, id).get(); - if (getResponse.isExists()) { - Data data = dataDefine.build(id); - Map source = getResponse.getSource(); - data.setDataInteger(0, ((Number)source.get(NodeComponentTable.COLUMN_COMPONENT_ID)).intValue()); - data.setDataString(1, (String)source.get(NodeComponentTable.COLUMN_COMPONENT_NAME)); - data.setDataInteger(1, ((Number)source.get(NodeComponentTable.COLUMN_PEER_ID)).intValue()); - data.setDataString(2, (String)source.get(NodeComponentTable.COLUMN_PEER)); - data.setDataLong(0, (Long)source.get(NodeComponentTable.COLUMN_TIME_BUCKET)); - return data; - } else { - return null; - } - } - - @Override public IndexRequestBuilder prepareBatchInsert(Data data) { - Map source = new HashMap<>(); - source.put(NodeComponentTable.COLUMN_COMPONENT_ID, data.getDataInteger(0)); - source.put(NodeComponentTable.COLUMN_COMPONENT_NAME, data.getDataString(1)); - source.put(NodeComponentTable.COLUMN_PEER_ID, data.getDataInteger(1)); - source.put(NodeComponentTable.COLUMN_PEER, data.getDataString(2)); - source.put(NodeComponentTable.COLUMN_TIME_BUCKET, data.getDataLong(0)); - - return getClient().prepareIndex(NodeComponentTable.TABLE, data.getDataString(0)).setSource(source); - } - - @Override public UpdateRequestBuilder prepareBatchUpdate(Data data) { - Map source = new HashMap<>(); - source.put(NodeComponentTable.COLUMN_COMPONENT_ID, data.getDataInteger(0)); - source.put(NodeComponentTable.COLUMN_COMPONENT_NAME, data.getDataString(1)); - source.put(NodeComponentTable.COLUMN_PEER_ID, data.getDataInteger(1)); - source.put(NodeComponentTable.COLUMN_PEER, data.getDataString(2)); - source.put(NodeComponentTable.COLUMN_TIME_BUCKET, data.getDataLong(0)); - - return getClient().prepareUpdate(NodeComponentTable.TABLE, data.getDataString(0)).setDoc(source); - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/node/component/dao/NodeComponentH2DAO.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/node/component/dao/NodeComponentH2DAO.java deleted file mode 100644 index 6b5365c2cb..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/node/component/dao/NodeComponentH2DAO.java +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.worker.node.component.dao; - -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import org.skywalking.apm.collector.client.h2.H2Client; -import org.skywalking.apm.collector.client.h2.H2ClientException; -import org.skywalking.apm.collector.core.stream.Data; -import org.skywalking.apm.collector.storage.base.define.DataDefine; -import org.skywalking.apm.collector.storage.base.define.node.NodeComponentTable; -import org.skywalking.apm.collector.storage.h2.SqlBuilder; -import org.skywalking.apm.collector.storage.h2.base.dao.H2DAO; -import org.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; -import org.skywalking.apm.collector.stream.worker.impl.dao.IPersistenceDAO; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng, clevertension - */ -public class NodeComponentH2DAO extends H2DAO implements INodeComponentDAO, IPersistenceDAO { - private final Logger logger = LoggerFactory.getLogger(NodeComponentH2DAO.class); - private static final String GET_SQL = "select * from {0} where {1} = ?"; - - @Override - public Data get(String id, DataDefine dataDefine) { - H2Client client = getClient(); - String sql = SqlBuilder.buildSql(GET_SQL, NodeComponentTable.TABLE, NodeComponentTable.COLUMN_ID); - Object[] params = new Object[] {id}; - try (ResultSet rs = client.executeQuery(sql, params)) { - if (rs.next()) { - Data data = dataDefine.build(id); - data.setDataInteger(0, rs.getInt(NodeComponentTable.COLUMN_COMPONENT_ID)); - data.setDataString(1, rs.getString(NodeComponentTable.COLUMN_COMPONENT_NAME)); - data.setDataInteger(1, rs.getInt(NodeComponentTable.COLUMN_PEER_ID)); - data.setDataString(2, rs.getString(NodeComponentTable.COLUMN_PEER)); - data.setDataLong(0, rs.getLong(NodeComponentTable.COLUMN_TIME_BUCKET)); - return data; - } - } catch (SQLException | H2ClientException e) { - logger.error(e.getMessage(), e); - } - return null; - } - - @Override - public H2SqlEntity prepareBatchInsert(Data data) { - Map source = new HashMap<>(); - H2SqlEntity entity = new H2SqlEntity(); - source.put(NodeComponentTable.COLUMN_ID, data.getDataString(0)); - source.put(NodeComponentTable.COLUMN_COMPONENT_ID, data.getDataInteger(0)); - source.put(NodeComponentTable.COLUMN_COMPONENT_NAME, data.getDataString(1)); - source.put(NodeComponentTable.COLUMN_PEER_ID, data.getDataInteger(1)); - source.put(NodeComponentTable.COLUMN_PEER, data.getDataString(2)); - source.put(NodeComponentTable.COLUMN_TIME_BUCKET, data.getDataLong(0)); - - String sql = SqlBuilder.buildBatchInsertSql(NodeComponentTable.TABLE, source.keySet()); - entity.setSql(sql); - entity.setParams(source.values().toArray(new Object[0])); - return entity; - } - - @Override - public H2SqlEntity prepareBatchUpdate(Data data) { - Map source = new HashMap<>(); - H2SqlEntity entity = new H2SqlEntity(); - source.put(NodeComponentTable.COLUMN_COMPONENT_ID, data.getDataInteger(0)); - source.put(NodeComponentTable.COLUMN_COMPONENT_NAME, data.getDataString(1)); - source.put(NodeComponentTable.COLUMN_PEER_ID, data.getDataInteger(1)); - source.put(NodeComponentTable.COLUMN_PEER, data.getDataString(2)); - source.put(NodeComponentTable.COLUMN_TIME_BUCKET, data.getDataLong(0)); - String id = data.getDataString(0); - String sql = SqlBuilder.buildBatchUpdateSql(NodeComponentTable.TABLE, source.keySet(), NodeComponentTable.COLUMN_ID); - entity.setSql(sql); - List values = new ArrayList<>(source.values()); - values.add(id); - entity.setParams(values.toArray(new Object[0])); - return entity; - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/node/component/define/NodeComponentEsTableDefine.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/node/component/define/NodeComponentEsTableDefine.java deleted file mode 100644 index bb781b4c0c..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/node/component/define/NodeComponentEsTableDefine.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.worker.node.component.define; - -import org.skywalking.apm.collector.storage.base.define.node.NodeComponentTable; -import org.skywalking.apm.collector.storage.elasticsearch.define.ElasticSearchColumnDefine; -import org.skywalking.apm.collector.storage.elasticsearch.define.ElasticSearchTableDefine; - -/** - * @author peng-yongsheng - */ -public class NodeComponentEsTableDefine extends ElasticSearchTableDefine { - - public NodeComponentEsTableDefine() { - super(NodeComponentTable.TABLE); - } - - @Override public int refreshInterval() { - return 2; - } - - @Override public void initialize() { - addColumn(new ElasticSearchColumnDefine(NodeComponentTable.COLUMN_COMPONENT_ID, ElasticSearchColumnDefine.Type.Integer.name())); - addColumn(new ElasticSearchColumnDefine(NodeComponentTable.COLUMN_COMPONENT_NAME, ElasticSearchColumnDefine.Type.Keyword.name())); - addColumn(new ElasticSearchColumnDefine(NodeComponentTable.COLUMN_PEER_ID, ElasticSearchColumnDefine.Type.Integer.name())); - addColumn(new ElasticSearchColumnDefine(NodeComponentTable.COLUMN_PEER, ElasticSearchColumnDefine.Type.Keyword.name())); - addColumn(new ElasticSearchColumnDefine(NodeComponentTable.COLUMN_TIME_BUCKET, ElasticSearchColumnDefine.Type.Long.name())); - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/node/component/define/NodeComponentH2TableDefine.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/node/component/define/NodeComponentH2TableDefine.java deleted file mode 100644 index b51abc885c..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/node/component/define/NodeComponentH2TableDefine.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.worker.node.component.define; - -import org.skywalking.apm.collector.storage.base.define.node.NodeComponentTable; -import org.skywalking.apm.collector.storage.h2.base.define.H2ColumnDefine; -import org.skywalking.apm.collector.storage.h2.base.define.H2TableDefine; - -/** - * @author peng-yongsheng - */ -public class NodeComponentH2TableDefine extends H2TableDefine { - - public NodeComponentH2TableDefine() { - super(NodeComponentTable.TABLE); - } - - @Override public void initialize() { - addColumn(new H2ColumnDefine(NodeComponentTable.COLUMN_ID, H2ColumnDefine.Type.Varchar.name())); - addColumn(new H2ColumnDefine(NodeComponentTable.COLUMN_COMPONENT_ID, H2ColumnDefine.Type.Int.name())); - addColumn(new H2ColumnDefine(NodeComponentTable.COLUMN_COMPONENT_NAME, H2ColumnDefine.Type.Varchar.name())); - addColumn(new H2ColumnDefine(NodeComponentTable.COLUMN_PEER_ID, H2ColumnDefine.Type.Int.name())); - addColumn(new H2ColumnDefine(NodeComponentTable.COLUMN_PEER, H2ColumnDefine.Type.Varchar.name())); - addColumn(new H2ColumnDefine(NodeComponentTable.COLUMN_TIME_BUCKET, H2ColumnDefine.Type.Bigint.name())); - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/node/mapping/NodeMappingAggregationWorker.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/node/mapping/NodeMappingAggregationWorker.java deleted file mode 100644 index dae97619c8..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/node/mapping/NodeMappingAggregationWorker.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.worker.node.mapping; - -import org.skywalking.apm.collector.storage.base.define.DataDefine; -import org.skywalking.apm.collector.storage.base.define.node.NodeMappingDataDefine; -import org.skywalking.apm.collector.stream.worker.AbstractLocalAsyncWorkerProvider; -import org.skywalking.apm.collector.stream.worker.ClusterWorkerContext; -import org.skywalking.apm.collector.stream.worker.ProviderNotFoundException; -import org.skywalking.apm.collector.stream.worker.Role; -import org.skywalking.apm.collector.stream.worker.WorkerNotFoundException; -import org.skywalking.apm.collector.stream.worker.WorkerRefs; -import org.skywalking.apm.collector.stream.worker.impl.AggregationWorker; -import org.skywalking.apm.collector.stream.worker.selector.HashCodeSelector; -import org.skywalking.apm.collector.stream.worker.selector.WorkerSelector; - -/** - * @author peng-yongsheng - */ -public class NodeMappingAggregationWorker extends AggregationWorker { - - public NodeMappingAggregationWorker(Role role, ClusterWorkerContext clusterContext) { - super(role, clusterContext); - } - - @Override public void preStart() throws ProviderNotFoundException { - super.preStart(); - } - - @Override protected WorkerRefs nextWorkRef(String id) throws WorkerNotFoundException { - return getClusterContext().lookup(NodeMappingRemoteWorker.WorkerRole.INSTANCE); - } - - public static class Factory extends AbstractLocalAsyncWorkerProvider { - @Override - public Role role() { - return WorkerRole.INSTANCE; - } - - @Override - public NodeMappingAggregationWorker workerInstance(ClusterWorkerContext clusterContext) { - return new NodeMappingAggregationWorker(role(), clusterContext); - } - - @Override - public int queueSize() { - return 1024; - } - } - - public enum WorkerRole implements Role { - INSTANCE; - - @Override - public String roleName() { - return NodeMappingAggregationWorker.class.getSimpleName(); - } - - @Override - public WorkerSelector workerSelector() { - return new HashCodeSelector(); - } - - @Override public DataDefine dataDefine() { - return new NodeMappingDataDefine(); - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/node/mapping/NodeMappingPersistenceWorker.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/node/mapping/NodeMappingPersistenceWorker.java deleted file mode 100644 index b6cb1e5ed1..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/node/mapping/NodeMappingPersistenceWorker.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.worker.node.mapping; - -import org.skywalking.apm.collector.agentstream.worker.node.mapping.dao.INodeMappingDAO; -import org.skywalking.apm.collector.storage.base.dao.DAOContainer; -import org.skywalking.apm.collector.storage.base.define.DataDefine; -import org.skywalking.apm.collector.storage.base.define.node.NodeMappingDataDefine; -import org.skywalking.apm.collector.stream.worker.AbstractLocalAsyncWorkerProvider; -import org.skywalking.apm.collector.stream.worker.ClusterWorkerContext; -import org.skywalking.apm.collector.stream.worker.ProviderNotFoundException; -import org.skywalking.apm.collector.stream.worker.Role; -import org.skywalking.apm.collector.stream.worker.impl.PersistenceWorker; -import org.skywalking.apm.collector.stream.worker.impl.dao.IPersistenceDAO; -import org.skywalking.apm.collector.stream.worker.selector.HashCodeSelector; -import org.skywalking.apm.collector.stream.worker.selector.WorkerSelector; - -/** - * @author peng-yongsheng - */ -public class NodeMappingPersistenceWorker extends PersistenceWorker { - - public NodeMappingPersistenceWorker(Role role, ClusterWorkerContext clusterContext) { - super(role, clusterContext); - } - - @Override public void preStart() throws ProviderNotFoundException { - super.preStart(); - } - - @Override protected boolean needMergeDBData() { - return true; - } - - @Override protected IPersistenceDAO persistenceDAO() { - return (IPersistenceDAO)DAOContainer.INSTANCE.get(INodeMappingDAO.class.getName()); - } - - public static class Factory extends AbstractLocalAsyncWorkerProvider { - @Override - public Role role() { - return WorkerRole.INSTANCE; - } - - @Override - public NodeMappingPersistenceWorker workerInstance(ClusterWorkerContext clusterContext) { - return new NodeMappingPersistenceWorker(role(), clusterContext); - } - - @Override - public int queueSize() { - return 1024; - } - } - - public enum WorkerRole implements Role { - INSTANCE; - - @Override - public String roleName() { - return NodeMappingPersistenceWorker.class.getSimpleName(); - } - - @Override - public WorkerSelector workerSelector() { - return new HashCodeSelector(); - } - - @Override public DataDefine dataDefine() { - return new NodeMappingDataDefine(); - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/node/mapping/NodeMappingRemoteWorker.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/node/mapping/NodeMappingRemoteWorker.java deleted file mode 100644 index e0d9b8861f..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/node/mapping/NodeMappingRemoteWorker.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.worker.node.mapping; - -import org.skywalking.apm.collector.storage.base.define.DataDefine; -import org.skywalking.apm.collector.storage.base.define.node.NodeMappingDataDefine; -import org.skywalking.apm.collector.stream.worker.AbstractRemoteWorker; -import org.skywalking.apm.collector.stream.worker.AbstractRemoteWorkerProvider; -import org.skywalking.apm.collector.stream.worker.ClusterWorkerContext; -import org.skywalking.apm.collector.stream.worker.ProviderNotFoundException; -import org.skywalking.apm.collector.stream.worker.Role; -import org.skywalking.apm.collector.stream.worker.WorkerException; -import org.skywalking.apm.collector.stream.worker.selector.HashCodeSelector; -import org.skywalking.apm.collector.stream.worker.selector.WorkerSelector; - -/** - * @author peng-yongsheng - */ -public class NodeMappingRemoteWorker extends AbstractRemoteWorker { - - protected NodeMappingRemoteWorker(Role role, ClusterWorkerContext clusterContext) { - super(role, clusterContext); - } - - @Override public void preStart() throws ProviderNotFoundException { - - } - - @Override protected void onWork(Object message) throws WorkerException { - getClusterContext().lookup(NodeMappingPersistenceWorker.WorkerRole.INSTANCE).tell(message); - } - - public static class Factory extends AbstractRemoteWorkerProvider { - @Override - public Role role() { - return WorkerRole.INSTANCE; - } - - @Override - public NodeMappingRemoteWorker workerInstance(ClusterWorkerContext clusterContext) { - return new NodeMappingRemoteWorker(role(), clusterContext); - } - } - - public enum WorkerRole implements Role { - INSTANCE; - - @Override - public String roleName() { - return NodeMappingRemoteWorker.class.getSimpleName(); - } - - @Override - public WorkerSelector workerSelector() { - return new HashCodeSelector(); - } - - @Override public DataDefine dataDefine() { - return new NodeMappingDataDefine(); - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/node/mapping/NodeMappingSpanListener.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/node/mapping/NodeMappingSpanListener.java deleted file mode 100644 index d0b76fe344..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/node/mapping/NodeMappingSpanListener.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.worker.node.mapping; - -import java.util.ArrayList; -import java.util.List; -import org.skywalking.apm.collector.agentstream.worker.segment.FirstSpanListener; -import org.skywalking.apm.collector.agentstream.worker.segment.RefsListener; -import org.skywalking.apm.collector.agentstream.worker.segment.standardization.ReferenceDecorator; -import org.skywalking.apm.collector.agentstream.worker.segment.standardization.SpanDecorator; -import org.skywalking.apm.collector.core.framework.CollectorContextHelper; -import org.skywalking.apm.collector.core.util.Const; -import org.skywalking.apm.collector.core.util.TimeBucketUtils; -import org.skywalking.apm.collector.storage.base.define.node.NodeMappingDataDefine; -import org.skywalking.apm.collector.stream.StreamModuleContext; -import org.skywalking.apm.collector.stream.StreamModuleGroupDefine; -import org.skywalking.apm.collector.stream.worker.WorkerInvokeException; -import org.skywalking.apm.collector.stream.worker.WorkerNotFoundException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class NodeMappingSpanListener implements RefsListener, FirstSpanListener { - - private final Logger logger = LoggerFactory.getLogger(NodeMappingSpanListener.class); - - private List nodeMappings = new ArrayList<>(); - private long timeBucket; - - @Override public void parseRef(ReferenceDecorator referenceDecorator, int applicationId, int applicationInstanceId, - String segmentId) { - logger.debug("node mapping listener parse reference"); - NodeMappingDataDefine.NodeMapping nodeMapping = new NodeMappingDataDefine.NodeMapping(); - nodeMapping.setApplicationId(applicationId); - nodeMapping.setAddressId(referenceDecorator.getNetworkAddressId()); - nodeMapping.setAddress(Const.EMPTY_STRING); - String id = String.valueOf(applicationId) + Const.ID_SPLIT + String.valueOf(nodeMapping.getAddressId()); - nodeMapping.setId(id); - nodeMappings.add(nodeMapping); - } - - @Override - public void parseFirst(SpanDecorator spanDecorator, int applicationId, int applicationInstanceId, - String segmentId) { - timeBucket = TimeBucketUtils.INSTANCE.getMinuteTimeBucket(spanDecorator.getStartTime()); - } - - @Override public void build() { - logger.debug("node mapping listener build"); - StreamModuleContext context = (StreamModuleContext)CollectorContextHelper.INSTANCE.getContext(StreamModuleGroupDefine.GROUP_NAME); - - for (NodeMappingDataDefine.NodeMapping nodeMapping : nodeMappings) { - try { - nodeMapping.setId(timeBucket + Const.ID_SPLIT + nodeMapping.getId()); - nodeMapping.setTimeBucket(timeBucket); - logger.debug("send to node mapping aggregation worker, id: {}", nodeMapping.getId()); - context.getClusterWorkerContext().lookup(NodeMappingAggregationWorker.WorkerRole.INSTANCE).tell(nodeMapping.toData()); - } catch (WorkerInvokeException | WorkerNotFoundException e) { - logger.error(e.getMessage(), e); - } - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/node/mapping/dao/INodeMappingDAO.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/node/mapping/dao/INodeMappingDAO.java deleted file mode 100644 index 9049eca2d7..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/node/mapping/dao/INodeMappingDAO.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.worker.node.mapping.dao; - -/** - * @author peng-yongsheng - */ -public interface INodeMappingDAO { -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/node/mapping/dao/NodeMappingEsDAO.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/node/mapping/dao/NodeMappingEsDAO.java deleted file mode 100644 index 63d01e8628..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/node/mapping/dao/NodeMappingEsDAO.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.worker.node.mapping.dao; - -import java.util.HashMap; -import java.util.Map; -import org.elasticsearch.action.get.GetResponse; -import org.elasticsearch.action.index.IndexRequestBuilder; -import org.elasticsearch.action.update.UpdateRequestBuilder; -import org.skywalking.apm.collector.core.stream.Data; -import org.skywalking.apm.collector.storage.base.define.DataDefine; -import org.skywalking.apm.collector.storage.base.define.node.NodeMappingTable; -import org.skywalking.apm.collector.storage.elasticsearch.dao.EsDAO; -import org.skywalking.apm.collector.stream.worker.impl.dao.IPersistenceDAO; - -/** - * @author peng-yongsheng - */ -public class NodeMappingEsDAO extends EsDAO implements INodeMappingDAO, IPersistenceDAO { - - @Override public Data get(String id, DataDefine dataDefine) { - GetResponse getResponse = getClient().prepareGet(NodeMappingTable.TABLE, id).get(); - if (getResponse.isExists()) { - Data data = dataDefine.build(id); - Map source = getResponse.getSource(); - data.setDataInteger(0, ((Number)source.get(NodeMappingTable.COLUMN_APPLICATION_ID)).intValue()); - data.setDataInteger(1, ((Number)source.get(NodeMappingTable.COLUMN_ADDRESS_ID)).intValue()); - data.setDataString(1, (String)source.get(NodeMappingTable.COLUMN_ADDRESS)); - data.setDataLong(0, ((Number)source.get(NodeMappingTable.COLUMN_TIME_BUCKET)).longValue()); - return data; - } else { - return null; - } - } - - @Override public IndexRequestBuilder prepareBatchInsert(Data data) { - Map source = new HashMap<>(); - source.put(NodeMappingTable.COLUMN_APPLICATION_ID, data.getDataInteger(0)); - source.put(NodeMappingTable.COLUMN_ADDRESS_ID, data.getDataInteger(1)); - source.put(NodeMappingTable.COLUMN_ADDRESS, data.getDataString(1)); - source.put(NodeMappingTable.COLUMN_TIME_BUCKET, data.getDataLong(0)); - - return getClient().prepareIndex(NodeMappingTable.TABLE, data.getDataString(0)).setSource(source); - } - - @Override public UpdateRequestBuilder prepareBatchUpdate(Data data) { - Map source = new HashMap<>(); - source.put(NodeMappingTable.COLUMN_APPLICATION_ID, data.getDataInteger(0)); - source.put(NodeMappingTable.COLUMN_ADDRESS_ID, data.getDataInteger(1)); - source.put(NodeMappingTable.COLUMN_ADDRESS, data.getDataString(1)); - source.put(NodeMappingTable.COLUMN_TIME_BUCKET, data.getDataLong(0)); - - return getClient().prepareUpdate(NodeMappingTable.TABLE, data.getDataString(0)).setDoc(source); - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/node/mapping/dao/NodeMappingH2DAO.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/node/mapping/dao/NodeMappingH2DAO.java deleted file mode 100644 index b3ff417943..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/node/mapping/dao/NodeMappingH2DAO.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.worker.node.mapping.dao; - -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import org.skywalking.apm.collector.agentstream.worker.node.component.dao.NodeComponentH2DAO; -import org.skywalking.apm.collector.client.h2.H2Client; -import org.skywalking.apm.collector.client.h2.H2ClientException; -import org.skywalking.apm.collector.core.stream.Data; -import org.skywalking.apm.collector.storage.base.define.DataDefine; -import org.skywalking.apm.collector.storage.base.define.node.NodeMappingTable; -import org.skywalking.apm.collector.storage.h2.SqlBuilder; -import org.skywalking.apm.collector.storage.h2.base.dao.H2DAO; -import org.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; -import org.skywalking.apm.collector.stream.worker.impl.dao.IPersistenceDAO; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng, clevertension - */ -public class NodeMappingH2DAO extends H2DAO implements INodeMappingDAO, IPersistenceDAO { - private final Logger logger = LoggerFactory.getLogger(NodeComponentH2DAO.class); - private static final String GET_SQL = "select * from {0} where {1} = ?"; - - @Override public Data get(String id, DataDefine dataDefine) { - H2Client client = getClient(); - String sql = SqlBuilder.buildSql(GET_SQL, NodeMappingTable.TABLE, NodeMappingTable.COLUMN_ID); - Object[] params = new Object[] {id}; - try (ResultSet rs = client.executeQuery(sql, params)) { - if (rs.next()) { - Data data = dataDefine.build(id); - data.setDataInteger(0, rs.getInt(NodeMappingTable.COLUMN_APPLICATION_ID)); - data.setDataInteger(1, rs.getInt(NodeMappingTable.COLUMN_ADDRESS_ID)); - data.setDataString(1, rs.getString(NodeMappingTable.COLUMN_ADDRESS)); - data.setDataLong(0, rs.getLong(NodeMappingTable.COLUMN_TIME_BUCKET)); - return data; - } - } catch (SQLException | H2ClientException e) { - logger.error(e.getMessage(), e); - } - return null; - } - - @Override public H2SqlEntity prepareBatchInsert(Data data) { - Map source = new HashMap<>(); - H2SqlEntity entity = new H2SqlEntity(); - source.put(NodeMappingTable.COLUMN_ID, data.getDataString(0)); - source.put(NodeMappingTable.COLUMN_APPLICATION_ID, data.getDataInteger(0)); - source.put(NodeMappingTable.COLUMN_ADDRESS_ID, data.getDataInteger(1)); - source.put(NodeMappingTable.COLUMN_ADDRESS, data.getDataString(1)); - source.put(NodeMappingTable.COLUMN_TIME_BUCKET, data.getDataLong(0)); - String sql = SqlBuilder.buildBatchInsertSql(NodeMappingTable.TABLE, source.keySet()); - entity.setSql(sql); - - entity.setParams(source.values().toArray(new Object[0])); - return entity; - } - - @Override public H2SqlEntity prepareBatchUpdate(Data data) { - Map source = new HashMap<>(); - H2SqlEntity entity = new H2SqlEntity(); - source.put(NodeMappingTable.COLUMN_APPLICATION_ID, data.getDataInteger(0)); - source.put(NodeMappingTable.COLUMN_ADDRESS_ID, data.getDataInteger(1)); - source.put(NodeMappingTable.COLUMN_ADDRESS, data.getDataString(1)); - source.put(NodeMappingTable.COLUMN_TIME_BUCKET, data.getDataLong(0)); - String id = data.getDataString(0); - String sql = SqlBuilder.buildBatchUpdateSql(NodeMappingTable.TABLE, source.keySet(), NodeMappingTable.COLUMN_ID); - entity.setSql(sql); - List values = new ArrayList<>(source.values()); - values.add(id); - entity.setParams(values.toArray(new Object[0])); - return entity; - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/node/mapping/define/NodeMappingEsTableDefine.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/node/mapping/define/NodeMappingEsTableDefine.java deleted file mode 100644 index 8914990bdf..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/node/mapping/define/NodeMappingEsTableDefine.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.worker.node.mapping.define; - -import org.skywalking.apm.collector.storage.base.define.node.NodeMappingTable; -import org.skywalking.apm.collector.storage.elasticsearch.define.ElasticSearchColumnDefine; -import org.skywalking.apm.collector.storage.elasticsearch.define.ElasticSearchTableDefine; - -/** - * @author peng-yongsheng - */ -public class NodeMappingEsTableDefine extends ElasticSearchTableDefine { - - public NodeMappingEsTableDefine() { - super(NodeMappingTable.TABLE); - } - - @Override public int refreshInterval() { - return 2; - } - - @Override public void initialize() { - addColumn(new ElasticSearchColumnDefine(NodeMappingTable.COLUMN_APPLICATION_ID, ElasticSearchColumnDefine.Type.Integer.name())); - addColumn(new ElasticSearchColumnDefine(NodeMappingTable.COLUMN_ADDRESS_ID, ElasticSearchColumnDefine.Type.Integer.name())); - addColumn(new ElasticSearchColumnDefine(NodeMappingTable.COLUMN_ADDRESS, ElasticSearchColumnDefine.Type.Keyword.name())); - addColumn(new ElasticSearchColumnDefine(NodeMappingTable.COLUMN_TIME_BUCKET, ElasticSearchColumnDefine.Type.Long.name())); - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/node/mapping/define/NodeMappingH2TableDefine.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/node/mapping/define/NodeMappingH2TableDefine.java deleted file mode 100644 index 445ae00432..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/node/mapping/define/NodeMappingH2TableDefine.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.worker.node.mapping.define; - -import org.skywalking.apm.collector.storage.base.define.node.NodeMappingTable; -import org.skywalking.apm.collector.storage.h2.base.define.H2ColumnDefine; -import org.skywalking.apm.collector.storage.h2.base.define.H2TableDefine; - -/** - * @author peng-yongsheng - */ -public class NodeMappingH2TableDefine extends H2TableDefine { - - public NodeMappingH2TableDefine() { - super(NodeMappingTable.TABLE); - } - - @Override public void initialize() { - addColumn(new H2ColumnDefine(NodeMappingTable.COLUMN_ID, H2ColumnDefine.Type.Varchar.name())); - addColumn(new H2ColumnDefine(NodeMappingTable.COLUMN_APPLICATION_ID, H2ColumnDefine.Type.Int.name())); - addColumn(new H2ColumnDefine(NodeMappingTable.COLUMN_ADDRESS_ID, H2ColumnDefine.Type.Int.name())); - addColumn(new H2ColumnDefine(NodeMappingTable.COLUMN_ADDRESS, H2ColumnDefine.Type.Varchar.name())); - addColumn(new H2ColumnDefine(NodeMappingTable.COLUMN_TIME_BUCKET, H2ColumnDefine.Type.Bigint.name())); - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/noderef/NodeReferenceAggregationWorker.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/noderef/NodeReferenceAggregationWorker.java deleted file mode 100644 index f50ab9bb42..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/noderef/NodeReferenceAggregationWorker.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.worker.noderef; - -import org.skywalking.apm.collector.storage.base.define.DataDefine; -import org.skywalking.apm.collector.storage.base.define.noderef.NodeReferenceDataDefine; -import org.skywalking.apm.collector.stream.worker.AbstractLocalAsyncWorkerProvider; -import org.skywalking.apm.collector.stream.worker.ClusterWorkerContext; -import org.skywalking.apm.collector.stream.worker.ProviderNotFoundException; -import org.skywalking.apm.collector.stream.worker.Role; -import org.skywalking.apm.collector.stream.worker.WorkerNotFoundException; -import org.skywalking.apm.collector.stream.worker.WorkerRefs; -import org.skywalking.apm.collector.stream.worker.impl.AggregationWorker; -import org.skywalking.apm.collector.stream.worker.selector.HashCodeSelector; -import org.skywalking.apm.collector.stream.worker.selector.WorkerSelector; - -/** - * @author peng-yongsheng - */ -public class NodeReferenceAggregationWorker extends AggregationWorker { - - public NodeReferenceAggregationWorker(Role role, ClusterWorkerContext clusterContext) { - super(role, clusterContext); - } - - @Override public void preStart() throws ProviderNotFoundException { - super.preStart(); - } - - @Override protected WorkerRefs nextWorkRef(String id) throws WorkerNotFoundException { - return getClusterContext().lookup(NodeReferenceRemoteWorker.WorkerRole.INSTANCE); - } - - public static class Factory extends AbstractLocalAsyncWorkerProvider { - @Override - public Role role() { - return WorkerRole.INSTANCE; - } - - @Override - public NodeReferenceAggregationWorker workerInstance(ClusterWorkerContext clusterContext) { - return new NodeReferenceAggregationWorker(role(), clusterContext); - } - - @Override - public int queueSize() { - return 1024; - } - } - - public enum WorkerRole implements Role { - INSTANCE; - - @Override - public String roleName() { - return NodeReferenceAggregationWorker.class.getSimpleName(); - } - - @Override - public WorkerSelector workerSelector() { - return new HashCodeSelector(); - } - - @Override public DataDefine dataDefine() { - return new NodeReferenceDataDefine(); - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/noderef/NodeReferencePersistenceWorker.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/noderef/NodeReferencePersistenceWorker.java deleted file mode 100644 index 7ba6e30eda..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/noderef/NodeReferencePersistenceWorker.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.worker.noderef; - -import org.skywalking.apm.collector.agentstream.worker.noderef.dao.INodeReferenceDAO; -import org.skywalking.apm.collector.storage.base.dao.DAOContainer; -import org.skywalking.apm.collector.storage.base.define.DataDefine; -import org.skywalking.apm.collector.storage.base.define.noderef.NodeReferenceDataDefine; -import org.skywalking.apm.collector.stream.worker.AbstractLocalAsyncWorkerProvider; -import org.skywalking.apm.collector.stream.worker.ClusterWorkerContext; -import org.skywalking.apm.collector.stream.worker.ProviderNotFoundException; -import org.skywalking.apm.collector.stream.worker.Role; -import org.skywalking.apm.collector.stream.worker.impl.PersistenceWorker; -import org.skywalking.apm.collector.stream.worker.impl.dao.IPersistenceDAO; -import org.skywalking.apm.collector.stream.worker.selector.HashCodeSelector; -import org.skywalking.apm.collector.stream.worker.selector.WorkerSelector; - -/** - * @author peng-yongsheng - */ -public class NodeReferencePersistenceWorker extends PersistenceWorker { - - public NodeReferencePersistenceWorker(Role role, ClusterWorkerContext clusterContext) { - super(role, clusterContext); - } - - @Override public void preStart() throws ProviderNotFoundException { - super.preStart(); - } - - @Override protected boolean needMergeDBData() { - return true; - } - - @Override protected IPersistenceDAO persistenceDAO() { - return (IPersistenceDAO)DAOContainer.INSTANCE.get(INodeReferenceDAO.class.getName()); - } - - public static class Factory extends AbstractLocalAsyncWorkerProvider { - @Override - public Role role() { - return WorkerRole.INSTANCE; - } - - @Override - public NodeReferencePersistenceWorker workerInstance(ClusterWorkerContext clusterContext) { - return new NodeReferencePersistenceWorker(role(), clusterContext); - } - - @Override - public int queueSize() { - return 1024; - } - } - - public enum WorkerRole implements Role { - INSTANCE; - - @Override - public String roleName() { - return NodeReferencePersistenceWorker.class.getSimpleName(); - } - - @Override - public WorkerSelector workerSelector() { - return new HashCodeSelector(); - } - - @Override public DataDefine dataDefine() { - return new NodeReferenceDataDefine(); - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/noderef/NodeReferenceRemoteWorker.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/noderef/NodeReferenceRemoteWorker.java deleted file mode 100644 index 94968a0bfc..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/noderef/NodeReferenceRemoteWorker.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.worker.noderef; - -import org.skywalking.apm.collector.storage.base.define.DataDefine; -import org.skywalking.apm.collector.storage.base.define.noderef.NodeReferenceDataDefine; -import org.skywalking.apm.collector.stream.worker.AbstractRemoteWorker; -import org.skywalking.apm.collector.stream.worker.AbstractRemoteWorkerProvider; -import org.skywalking.apm.collector.stream.worker.ClusterWorkerContext; -import org.skywalking.apm.collector.stream.worker.ProviderNotFoundException; -import org.skywalking.apm.collector.stream.worker.Role; -import org.skywalking.apm.collector.stream.worker.WorkerException; -import org.skywalking.apm.collector.stream.worker.selector.HashCodeSelector; -import org.skywalking.apm.collector.stream.worker.selector.WorkerSelector; - -/** - * @author peng-yongsheng - */ -public class NodeReferenceRemoteWorker extends AbstractRemoteWorker { - - protected NodeReferenceRemoteWorker(Role role, ClusterWorkerContext clusterContext) { - super(role, clusterContext); - } - - @Override public void preStart() throws ProviderNotFoundException { - - } - - @Override protected void onWork(Object message) throws WorkerException { - getClusterContext().lookup(NodeReferencePersistenceWorker.WorkerRole.INSTANCE).tell(message); - } - - public static class Factory extends AbstractRemoteWorkerProvider { - @Override - public Role role() { - return WorkerRole.INSTANCE; - } - - @Override - public NodeReferenceRemoteWorker workerInstance(ClusterWorkerContext clusterContext) { - return new NodeReferenceRemoteWorker(role(), clusterContext); - } - } - - public enum WorkerRole implements Role { - INSTANCE; - - @Override - public String roleName() { - return NodeReferenceRemoteWorker.class.getSimpleName(); - } - - @Override - public WorkerSelector workerSelector() { - return new HashCodeSelector(); - } - - @Override public DataDefine dataDefine() { - return new NodeReferenceDataDefine(); - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/noderef/NodeReferenceSpanListener.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/noderef/NodeReferenceSpanListener.java deleted file mode 100644 index 8e309c69e1..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/noderef/NodeReferenceSpanListener.java +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.worker.noderef; - -import java.util.LinkedList; -import java.util.List; -import org.skywalking.apm.collector.agentstream.worker.segment.EntrySpanListener; -import org.skywalking.apm.collector.agentstream.worker.segment.ExitSpanListener; -import org.skywalking.apm.collector.agentstream.worker.segment.RefsListener; -import org.skywalking.apm.collector.agentstream.worker.segment.standardization.ReferenceDecorator; -import org.skywalking.apm.collector.agentstream.worker.segment.standardization.SpanDecorator; -import org.skywalking.apm.collector.cache.InstanceCache; -import org.skywalking.apm.collector.core.framework.CollectorContextHelper; -import org.skywalking.apm.collector.core.util.CollectionUtils; -import org.skywalking.apm.collector.core.util.Const; -import org.skywalking.apm.collector.core.util.TimeBucketUtils; -import org.skywalking.apm.collector.storage.base.define.noderef.NodeReferenceDataDefine; -import org.skywalking.apm.collector.stream.StreamModuleContext; -import org.skywalking.apm.collector.stream.StreamModuleGroupDefine; -import org.skywalking.apm.collector.stream.worker.WorkerInvokeException; -import org.skywalking.apm.collector.stream.worker.WorkerNotFoundException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class NodeReferenceSpanListener implements EntrySpanListener, ExitSpanListener, RefsListener { - - private final Logger logger = LoggerFactory.getLogger(NodeReferenceSpanListener.class); - - private List nodeReferences = new LinkedList<>(); - private List references = new LinkedList<>(); - - @Override - public void parseExit(SpanDecorator spanDecorator, int applicationId, int applicationInstanceId, String segmentId) { - NodeReferenceDataDefine.NodeReference nodeReference = new NodeReferenceDataDefine.NodeReference(); - nodeReference.setFrontApplicationId(applicationId); - nodeReference.setBehindApplicationId(spanDecorator.getPeerId()); - nodeReference.setBehindPeer(Const.EMPTY_STRING); - nodeReference.setTimeBucket(TimeBucketUtils.INSTANCE.getMinuteTimeBucket(spanDecorator.getStartTime())); - - StringBuilder idBuilder = new StringBuilder(); - idBuilder.append(nodeReference.getTimeBucket()).append(Const.ID_SPLIT).append(applicationId) - .append(Const.ID_SPLIT).append(spanDecorator.getPeerId()); - - nodeReference.setId(idBuilder.toString()); - nodeReferences.add(buildNodeRefSum(nodeReference, spanDecorator.getStartTime(), spanDecorator.getEndTime(), spanDecorator.getIsError())); - } - - @Override - public void parseEntry(SpanDecorator spanDecorator, int applicationId, int applicationInstanceId, - String segmentId) { - if (CollectionUtils.isNotEmpty(references)) { - references.forEach(nodeReference -> { - nodeReference.setTimeBucket(TimeBucketUtils.INSTANCE.getMinuteTimeBucket(spanDecorator.getStartTime())); - String idBuilder = String.valueOf(nodeReference.getTimeBucket()) + Const.ID_SPLIT + nodeReference.getFrontApplicationId() + - Const.ID_SPLIT + nodeReference.getBehindApplicationId(); - - nodeReference.setId(idBuilder); - nodeReferences.add(buildNodeRefSum(nodeReference, spanDecorator.getStartTime(), spanDecorator.getEndTime(), spanDecorator.getIsError())); - }); - } else { - NodeReferenceDataDefine.NodeReference nodeReference = new NodeReferenceDataDefine.NodeReference(); - nodeReference.setFrontApplicationId(Const.USER_ID); - nodeReference.setBehindApplicationId(applicationId); - nodeReference.setBehindPeer(Const.EMPTY_STRING); - nodeReference.setTimeBucket(TimeBucketUtils.INSTANCE.getMinuteTimeBucket(spanDecorator.getStartTime())); - - String idBuilder = String.valueOf(nodeReference.getTimeBucket()) + Const.ID_SPLIT + nodeReference.getFrontApplicationId() + - Const.ID_SPLIT + nodeReference.getBehindApplicationId(); - - nodeReference.setId(idBuilder); - nodeReferences.add(buildNodeRefSum(nodeReference, spanDecorator.getStartTime(), spanDecorator.getEndTime(), spanDecorator.getIsError())); - } - } - - @Override public void parseRef(ReferenceDecorator referenceDecorator, int applicationId, int applicationInstanceId, - String segmentId) { - int parentApplicationId = InstanceCache.get(referenceDecorator.getParentApplicationInstanceId()); - - NodeReferenceDataDefine.NodeReference referenceSum = new NodeReferenceDataDefine.NodeReference(); - referenceSum.setFrontApplicationId(parentApplicationId); - referenceSum.setBehindApplicationId(applicationId); - referenceSum.setBehindPeer(Const.EMPTY_STRING); - references.add(referenceSum); - } - - @Override public void build() { - logger.debug("node reference summary listener build"); - StreamModuleContext context = (StreamModuleContext)CollectorContextHelper.INSTANCE.getContext(StreamModuleGroupDefine.GROUP_NAME); - - for (NodeReferenceDataDefine.NodeReference nodeReference : nodeReferences) { - try { - logger.debug("send to node reference summary aggregation worker, id: {}", nodeReference.getId()); - context.getClusterWorkerContext().lookup(NodeReferenceAggregationWorker.WorkerRole.INSTANCE).tell(nodeReference.toData()); - } catch (WorkerInvokeException | WorkerNotFoundException e) { - logger.error(e.getMessage(), e); - } - } - } - - private NodeReferenceDataDefine.NodeReference buildNodeRefSum(NodeReferenceDataDefine.NodeReference reference, - long startTime, long endTime, boolean isError) { - long cost = endTime - startTime; - if (cost <= 1000 && !isError) { - reference.setS1LTE(1); - } else if (1000 < cost && cost <= 3000 && !isError) { - reference.setS3LTE(1); - } else if (3000 < cost && cost <= 5000 && !isError) { - reference.setS5LTE(1); - } else if (5000 < cost && !isError) { - reference.setS5GT(1); - } else { - reference.setError(1); - } - reference.setSummary(1); - return reference; - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/noderef/dao/INodeReferenceDAO.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/noderef/dao/INodeReferenceDAO.java deleted file mode 100644 index db8d485d2b..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/noderef/dao/INodeReferenceDAO.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.worker.noderef.dao; - -/** - * @author peng-yongsheng - */ -public interface INodeReferenceDAO { -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/noderef/dao/NodeReferenceEsDAO.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/noderef/dao/NodeReferenceEsDAO.java deleted file mode 100644 index 9a6c639825..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/noderef/dao/NodeReferenceEsDAO.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.worker.noderef.dao; - -import java.util.HashMap; -import java.util.Map; -import org.elasticsearch.action.get.GetResponse; -import org.elasticsearch.action.index.IndexRequestBuilder; -import org.elasticsearch.action.update.UpdateRequestBuilder; -import org.skywalking.apm.collector.core.stream.Data; -import org.skywalking.apm.collector.storage.base.define.DataDefine; -import org.skywalking.apm.collector.storage.base.define.noderef.NodeReferenceTable; -import org.skywalking.apm.collector.storage.elasticsearch.dao.EsDAO; -import org.skywalking.apm.collector.stream.worker.impl.dao.IPersistenceDAO; - -/** - * @author peng-yongsheng - */ -public class NodeReferenceEsDAO extends EsDAO implements INodeReferenceDAO, IPersistenceDAO { - - @Override public Data get(String id, DataDefine dataDefine) { - GetResponse getResponse = getClient().prepareGet(NodeReferenceTable.TABLE, id).get(); - if (getResponse.isExists()) { - Data data = dataDefine.build(id); - Map source = getResponse.getSource(); - data.setDataInteger(0, ((Number)source.get(NodeReferenceTable.COLUMN_FRONT_APPLICATION_ID)).intValue()); - data.setDataInteger(1, ((Number)source.get(NodeReferenceTable.COLUMN_BEHIND_APPLICATION_ID)).intValue()); - data.setDataString(1, (String)source.get(NodeReferenceTable.COLUMN_BEHIND_PEER)); - data.setDataInteger(2, ((Number)source.get(NodeReferenceTable.COLUMN_S1_LTE)).intValue()); - data.setDataInteger(3, ((Number)source.get(NodeReferenceTable.COLUMN_S3_LTE)).intValue()); - data.setDataInteger(4, ((Number)source.get(NodeReferenceTable.COLUMN_S5_LTE)).intValue()); - data.setDataInteger(5, ((Number)source.get(NodeReferenceTable.COLUMN_S5_GT)).intValue()); - data.setDataInteger(6, ((Number)source.get(NodeReferenceTable.COLUMN_SUMMARY)).intValue()); - data.setDataInteger(7, ((Number)source.get(NodeReferenceTable.COLUMN_ERROR)).intValue()); - data.setDataLong(0, ((Number)source.get(NodeReferenceTable.COLUMN_TIME_BUCKET)).longValue()); - return data; - } else { - return null; - } - } - - @Override public IndexRequestBuilder prepareBatchInsert(Data data) { - Map source = new HashMap<>(); - source.put(NodeReferenceTable.COLUMN_FRONT_APPLICATION_ID, data.getDataInteger(0)); - source.put(NodeReferenceTable.COLUMN_BEHIND_APPLICATION_ID, data.getDataInteger(1)); - source.put(NodeReferenceTable.COLUMN_BEHIND_PEER, data.getDataString(1)); - source.put(NodeReferenceTable.COLUMN_S1_LTE, data.getDataInteger(2)); - source.put(NodeReferenceTable.COLUMN_S3_LTE, data.getDataInteger(3)); - source.put(NodeReferenceTable.COLUMN_S5_LTE, data.getDataInteger(4)); - source.put(NodeReferenceTable.COLUMN_S5_GT, data.getDataInteger(5)); - source.put(NodeReferenceTable.COLUMN_SUMMARY, data.getDataInteger(6)); - source.put(NodeReferenceTable.COLUMN_ERROR, data.getDataInteger(7)); - source.put(NodeReferenceTable.COLUMN_TIME_BUCKET, data.getDataLong(0)); - - return getClient().prepareIndex(NodeReferenceTable.TABLE, data.getDataString(0)).setSource(source); - } - - @Override public UpdateRequestBuilder prepareBatchUpdate(Data data) { - Map source = new HashMap<>(); - source.put(NodeReferenceTable.COLUMN_FRONT_APPLICATION_ID, data.getDataInteger(0)); - source.put(NodeReferenceTable.COLUMN_BEHIND_APPLICATION_ID, data.getDataInteger(1)); - source.put(NodeReferenceTable.COLUMN_BEHIND_PEER, data.getDataString(1)); - source.put(NodeReferenceTable.COLUMN_S1_LTE, data.getDataInteger(2)); - source.put(NodeReferenceTable.COLUMN_S3_LTE, data.getDataInteger(3)); - source.put(NodeReferenceTable.COLUMN_S5_LTE, data.getDataInteger(4)); - source.put(NodeReferenceTable.COLUMN_S5_GT, data.getDataInteger(5)); - source.put(NodeReferenceTable.COLUMN_SUMMARY, data.getDataInteger(6)); - source.put(NodeReferenceTable.COLUMN_ERROR, data.getDataInteger(7)); - source.put(NodeReferenceTable.COLUMN_TIME_BUCKET, data.getDataLong(0)); - - return getClient().prepareUpdate(NodeReferenceTable.TABLE, data.getDataString(0)).setDoc(source); - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/noderef/dao/NodeReferenceH2DAO.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/noderef/dao/NodeReferenceH2DAO.java deleted file mode 100644 index 73733d89e8..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/noderef/dao/NodeReferenceH2DAO.java +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.worker.noderef.dao; - -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import org.skywalking.apm.collector.client.h2.H2Client; -import org.skywalking.apm.collector.client.h2.H2ClientException; -import org.skywalking.apm.collector.core.stream.Data; -import org.skywalking.apm.collector.storage.base.define.DataDefine; -import org.skywalking.apm.collector.storage.base.define.noderef.NodeReferenceTable; -import org.skywalking.apm.collector.storage.h2.SqlBuilder; -import org.skywalking.apm.collector.storage.h2.base.dao.H2DAO; -import org.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; -import org.skywalking.apm.collector.stream.worker.impl.dao.IPersistenceDAO; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng, clevertension - */ -public class NodeReferenceH2DAO extends H2DAO implements INodeReferenceDAO, IPersistenceDAO { - private final Logger logger = LoggerFactory.getLogger(NodeReferenceH2DAO.class); - private static final String GET_SQL = "select * from {0} where {1} = ?"; - - @Override public Data get(String id, DataDefine dataDefine) { - H2Client client = getClient(); - String sql = SqlBuilder.buildSql(GET_SQL, NodeReferenceTable.TABLE, NodeReferenceTable.COLUMN_ID); - Object[] params = new Object[] {id}; - try (ResultSet rs = client.executeQuery(sql, params)) { - if (rs.next()) { - Data data = dataDefine.build(id); - data.setDataInteger(0, rs.getInt(NodeReferenceTable.COLUMN_FRONT_APPLICATION_ID)); - data.setDataInteger(1, rs.getInt(NodeReferenceTable.COLUMN_BEHIND_APPLICATION_ID)); - data.setDataString(1, rs.getString(NodeReferenceTable.COLUMN_BEHIND_PEER)); - data.setDataInteger(2, rs.getInt(NodeReferenceTable.COLUMN_S1_LTE)); - data.setDataInteger(3, rs.getInt(NodeReferenceTable.COLUMN_S3_LTE)); - data.setDataInteger(4, rs.getInt(NodeReferenceTable.COLUMN_S5_LTE)); - data.setDataInteger(5, rs.getInt(NodeReferenceTable.COLUMN_S5_GT)); - data.setDataInteger(6, rs.getInt(NodeReferenceTable.COLUMN_SUMMARY)); - data.setDataInteger(7, rs.getInt(NodeReferenceTable.COLUMN_ERROR)); - data.setDataLong(0, rs.getLong(NodeReferenceTable.COLUMN_TIME_BUCKET)); - return data; - } - } catch (SQLException | H2ClientException e) { - logger.error(e.getMessage(), e); - } - return null; - } - - @Override public H2SqlEntity prepareBatchInsert(Data data) { - Map source = new HashMap<>(); - H2SqlEntity entity = new H2SqlEntity(); - source.put(NodeReferenceTable.COLUMN_ID, data.getDataString(0)); - source.put(NodeReferenceTable.COLUMN_FRONT_APPLICATION_ID, data.getDataInteger(0)); - source.put(NodeReferenceTable.COLUMN_BEHIND_APPLICATION_ID, data.getDataInteger(1)); - source.put(NodeReferenceTable.COLUMN_BEHIND_PEER, data.getDataString(1)); - source.put(NodeReferenceTable.COLUMN_S1_LTE, data.getDataInteger(2)); - source.put(NodeReferenceTable.COLUMN_S3_LTE, data.getDataInteger(3)); - source.put(NodeReferenceTable.COLUMN_S5_LTE, data.getDataInteger(4)); - source.put(NodeReferenceTable.COLUMN_S5_GT, data.getDataInteger(5)); - source.put(NodeReferenceTable.COLUMN_SUMMARY, data.getDataInteger(6)); - source.put(NodeReferenceTable.COLUMN_ERROR, data.getDataInteger(7)); - source.put(NodeReferenceTable.COLUMN_TIME_BUCKET, data.getDataLong(0)); - String sql = SqlBuilder.buildBatchInsertSql(NodeReferenceTable.TABLE, source.keySet()); - entity.setSql(sql); - - entity.setParams(source.values().toArray(new Object[0])); - return entity; - } - - @Override public H2SqlEntity prepareBatchUpdate(Data data) { - Map source = new HashMap<>(); - H2SqlEntity entity = new H2SqlEntity(); - source.put(NodeReferenceTable.COLUMN_FRONT_APPLICATION_ID, data.getDataInteger(0)); - source.put(NodeReferenceTable.COLUMN_BEHIND_APPLICATION_ID, data.getDataInteger(1)); - source.put(NodeReferenceTable.COLUMN_BEHIND_PEER, data.getDataString(1)); - source.put(NodeReferenceTable.COLUMN_S1_LTE, data.getDataInteger(2)); - source.put(NodeReferenceTable.COLUMN_S3_LTE, data.getDataInteger(3)); - source.put(NodeReferenceTable.COLUMN_S5_LTE, data.getDataInteger(4)); - source.put(NodeReferenceTable.COLUMN_S5_GT, data.getDataInteger(5)); - source.put(NodeReferenceTable.COLUMN_SUMMARY, data.getDataInteger(6)); - source.put(NodeReferenceTable.COLUMN_ERROR, data.getDataInteger(7)); - source.put(NodeReferenceTable.COLUMN_TIME_BUCKET, data.getDataLong(0)); - String id = data.getDataString(0); - String sql = SqlBuilder.buildBatchUpdateSql(NodeReferenceTable.TABLE, source.keySet(), NodeReferenceTable.COLUMN_ID); - entity.setSql(sql); - List values = new ArrayList<>(source.values()); - values.add(id); - entity.setParams(values.toArray(new Object[0])); - return entity; - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/noderef/define/NodeReferenceEsTableDefine.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/noderef/define/NodeReferenceEsTableDefine.java deleted file mode 100644 index 896a3494be..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/noderef/define/NodeReferenceEsTableDefine.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.worker.noderef.define; - -import org.skywalking.apm.collector.storage.base.define.noderef.NodeReferenceTable; -import org.skywalking.apm.collector.storage.elasticsearch.define.ElasticSearchColumnDefine; -import org.skywalking.apm.collector.storage.elasticsearch.define.ElasticSearchTableDefine; - -/** - * @author peng-yongsheng - */ -public class NodeReferenceEsTableDefine extends ElasticSearchTableDefine { - - public NodeReferenceEsTableDefine() { - super(NodeReferenceTable.TABLE); - } - - @Override public int refreshInterval() { - return 2; - } - - @Override public void initialize() { - addColumn(new ElasticSearchColumnDefine(NodeReferenceTable.COLUMN_FRONT_APPLICATION_ID, ElasticSearchColumnDefine.Type.Integer.name())); - addColumn(new ElasticSearchColumnDefine(NodeReferenceTable.COLUMN_BEHIND_APPLICATION_ID, ElasticSearchColumnDefine.Type.Integer.name())); - addColumn(new ElasticSearchColumnDefine(NodeReferenceTable.COLUMN_BEHIND_PEER, ElasticSearchColumnDefine.Type.Keyword.name())); - addColumn(new ElasticSearchColumnDefine(NodeReferenceTable.COLUMN_S1_LTE, ElasticSearchColumnDefine.Type.Integer.name())); - addColumn(new ElasticSearchColumnDefine(NodeReferenceTable.COLUMN_S3_LTE, ElasticSearchColumnDefine.Type.Integer.name())); - addColumn(new ElasticSearchColumnDefine(NodeReferenceTable.COLUMN_S5_LTE, ElasticSearchColumnDefine.Type.Integer.name())); - addColumn(new ElasticSearchColumnDefine(NodeReferenceTable.COLUMN_S5_GT, ElasticSearchColumnDefine.Type.Integer.name())); - addColumn(new ElasticSearchColumnDefine(NodeReferenceTable.COLUMN_SUMMARY, ElasticSearchColumnDefine.Type.Integer.name())); - addColumn(new ElasticSearchColumnDefine(NodeReferenceTable.COLUMN_ERROR, ElasticSearchColumnDefine.Type.Integer.name())); - addColumn(new ElasticSearchColumnDefine(NodeReferenceTable.COLUMN_TIME_BUCKET, ElasticSearchColumnDefine.Type.Long.name())); - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/noderef/define/NodeReferenceH2TableDefine.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/noderef/define/NodeReferenceH2TableDefine.java deleted file mode 100644 index 0618f71628..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/noderef/define/NodeReferenceH2TableDefine.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.worker.noderef.define; - -import org.skywalking.apm.collector.storage.base.define.noderef.NodeReferenceTable; -import org.skywalking.apm.collector.storage.h2.base.define.H2ColumnDefine; -import org.skywalking.apm.collector.storage.h2.base.define.H2TableDefine; - -/** - * @author peng-yongsheng - */ -public class NodeReferenceH2TableDefine extends H2TableDefine { - - public NodeReferenceH2TableDefine() { - super(NodeReferenceTable.TABLE); - } - - @Override public void initialize() { - addColumn(new H2ColumnDefine(NodeReferenceTable.COLUMN_ID, H2ColumnDefine.Type.Varchar.name())); - addColumn(new H2ColumnDefine(NodeReferenceTable.COLUMN_FRONT_APPLICATION_ID, H2ColumnDefine.Type.Int.name())); - addColumn(new H2ColumnDefine(NodeReferenceTable.COLUMN_BEHIND_APPLICATION_ID, H2ColumnDefine.Type.Int.name())); - addColumn(new H2ColumnDefine(NodeReferenceTable.COLUMN_BEHIND_PEER, H2ColumnDefine.Type.Varchar.name())); - addColumn(new H2ColumnDefine(NodeReferenceTable.COLUMN_S1_LTE, H2ColumnDefine.Type.Int.name())); - addColumn(new H2ColumnDefine(NodeReferenceTable.COLUMN_S3_LTE, H2ColumnDefine.Type.Int.name())); - addColumn(new H2ColumnDefine(NodeReferenceTable.COLUMN_S5_LTE, H2ColumnDefine.Type.Int.name())); - addColumn(new H2ColumnDefine(NodeReferenceTable.COLUMN_S5_GT, H2ColumnDefine.Type.Int.name())); - addColumn(new H2ColumnDefine(NodeReferenceTable.COLUMN_SUMMARY, H2ColumnDefine.Type.Int.name())); - addColumn(new H2ColumnDefine(NodeReferenceTable.COLUMN_ERROR, H2ColumnDefine.Type.Int.name())); - addColumn(new H2ColumnDefine(NodeReferenceTable.COLUMN_TIME_BUCKET, H2ColumnDefine.Type.Bigint.name())); - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/EntrySpanListener.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/EntrySpanListener.java deleted file mode 100644 index 1b62201b1b..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/EntrySpanListener.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.worker.segment; - -import org.skywalking.apm.collector.agentstream.worker.segment.standardization.SpanDecorator; - -/** - * @author peng-yongsheng - */ -public interface EntrySpanListener extends SpanListener { - void parseEntry(SpanDecorator spanDecorator, int applicationId, int applicationInstanceId, String segmentId); -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/ExitSpanListener.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/ExitSpanListener.java deleted file mode 100644 index 96302d359e..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/ExitSpanListener.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.worker.segment; - -import org.skywalking.apm.collector.agentstream.worker.segment.standardization.SpanDecorator; - -/** - * @author peng-yongsheng - */ -public interface ExitSpanListener extends SpanListener { - void parseExit(SpanDecorator spanDecorator, int applicationId, int applicationInstanceId, String segmentId); -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/FirstSpanListener.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/FirstSpanListener.java deleted file mode 100644 index 72764229ef..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/FirstSpanListener.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.worker.segment; - -import org.skywalking.apm.collector.agentstream.worker.segment.standardization.SpanDecorator; - -/** - * @author peng-yongsheng - */ -public interface FirstSpanListener extends SpanListener { - void parseFirst(SpanDecorator spanDecorator, int applicationId, int applicationInstanceId, String segmentId); -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/GlobalTraceIdsListener.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/GlobalTraceIdsListener.java deleted file mode 100644 index 5ddf355fec..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/GlobalTraceIdsListener.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.worker.segment; - -import org.skywalking.apm.network.proto.UniqueId; - -/** - * @author peng-yongsheng - */ -public interface GlobalTraceIdsListener extends SpanListener { - void parseGlobalTraceId(UniqueId uniqueId); -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/LocalSpanListener.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/LocalSpanListener.java deleted file mode 100644 index 8f17f243ab..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/LocalSpanListener.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.worker.segment; - -import org.skywalking.apm.collector.agentstream.worker.segment.standardization.SpanDecorator; - -/** - * @author peng-yongsheng - */ -public interface LocalSpanListener extends SpanListener { - void parseLocal(SpanDecorator spanDecorator, int applicationId, int applicationInstanceId, String segmentId); -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/RefsListener.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/RefsListener.java deleted file mode 100644 index ac8fa6f425..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/RefsListener.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.worker.segment; - -import org.skywalking.apm.collector.agentstream.worker.segment.standardization.ReferenceDecorator; - -/** - * @author peng-yongsheng - */ -public interface RefsListener extends SpanListener { - void parseRef(ReferenceDecorator referenceDecorator, int applicationId, int applicationInstanceId, String segmentId); -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/SegmentParse.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/SegmentParse.java deleted file mode 100644 index ed969b954a..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/SegmentParse.java +++ /dev/null @@ -1,238 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.worker.segment; - -import com.google.protobuf.InvalidProtocolBufferException; -import java.util.ArrayList; -import java.util.List; -import org.skywalking.apm.collector.agentstream.worker.global.GlobalTraceSpanListener; -import org.skywalking.apm.collector.agentstream.worker.instance.performance.InstPerformanceSpanListener; -import org.skywalking.apm.collector.agentstream.worker.node.component.NodeComponentSpanListener; -import org.skywalking.apm.collector.agentstream.worker.node.mapping.NodeMappingSpanListener; -import org.skywalking.apm.collector.agentstream.worker.noderef.NodeReferenceSpanListener; -import org.skywalking.apm.collector.agentstream.worker.segment.cost.SegmentCostSpanListener; -import org.skywalking.apm.collector.agentstream.worker.segment.origin.SegmentPersistenceWorker; -import org.skywalking.apm.collector.agentstream.worker.segment.standardization.ReferenceDecorator; -import org.skywalking.apm.collector.agentstream.worker.segment.standardization.ReferenceIdExchanger; -import org.skywalking.apm.collector.agentstream.worker.segment.standardization.SegmentDecorator; -import org.skywalking.apm.collector.agentstream.worker.segment.standardization.SegmentStandardizationWorker; -import org.skywalking.apm.collector.agentstream.worker.segment.standardization.SpanDecorator; -import org.skywalking.apm.collector.agentstream.worker.segment.standardization.SpanIdExchanger; -import org.skywalking.apm.collector.agentstream.worker.service.entry.ServiceEntrySpanListener; -import org.skywalking.apm.collector.agentstream.worker.serviceref.ServiceReferenceSpanListener; -import org.skywalking.apm.collector.core.framework.CollectorContextHelper; -import org.skywalking.apm.collector.storage.base.define.segment.SegmentDataDefine; -import org.skywalking.apm.collector.stream.StreamModuleContext; -import org.skywalking.apm.collector.stream.StreamModuleGroupDefine; -import org.skywalking.apm.collector.stream.worker.WorkerInvokeException; -import org.skywalking.apm.collector.stream.worker.WorkerNotFoundException; -import org.skywalking.apm.network.proto.SpanType; -import org.skywalking.apm.network.proto.TraceSegmentObject; -import org.skywalking.apm.network.proto.UniqueId; -import org.skywalking.apm.network.proto.UpstreamSegment; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class SegmentParse { - - private final Logger logger = LoggerFactory.getLogger(SegmentParse.class); - - private List spanListeners; - private String segmentId; - - public SegmentParse() { - spanListeners = new ArrayList<>(); - spanListeners.add(new NodeComponentSpanListener()); - spanListeners.add(new NodeMappingSpanListener()); - spanListeners.add(new NodeReferenceSpanListener()); - spanListeners.add(new SegmentCostSpanListener()); - spanListeners.add(new GlobalTraceSpanListener()); - spanListeners.add(new ServiceEntrySpanListener()); - spanListeners.add(new ServiceReferenceSpanListener()); - spanListeners.add(new InstPerformanceSpanListener()); - } - - public boolean parse(UpstreamSegment segment, Source source) { - try { - List traceIds = segment.getGlobalTraceIdsList(); - TraceSegmentObject segmentObject = TraceSegmentObject.parseFrom(segment.getSegment()); - - SegmentDecorator segmentDecorator = new SegmentDecorator(segmentObject); - if (!preBuild(traceIds, segmentDecorator)) { - logger.debug("This segment id exchange not success, write to buffer file, id: {}", segmentId); - - if (source.equals(Source.Agent)) { - writeToBufferFile(segmentId, segment); - } - return false; - } else { - logger.debug("This segment id exchange success, id: {}", segmentId); - notifyListenerToBuild(); - buildSegment(segmentId, segmentDecorator.toByteArray()); - return true; - } - } catch (InvalidProtocolBufferException e) { - logger.error(e.getMessage(), e); - } - return false; - } - - private boolean preBuild(List traceIds, SegmentDecorator segmentDecorator) { - StringBuilder segmentIdBuilder = new StringBuilder(); - - for (int i = 0; i < segmentDecorator.getTraceSegmentId().getIdPartsList().size(); i++) { - if (i == 0) { - segmentIdBuilder.append(segmentDecorator.getTraceSegmentId().getIdPartsList().get(i)); - } else { - segmentIdBuilder.append(".").append(segmentDecorator.getTraceSegmentId().getIdPartsList().get(i)); - } - } - - segmentId = segmentIdBuilder.toString(); - - for (UniqueId uniqueId : traceIds) { - notifyGlobalsListener(uniqueId); - } - - int applicationId = segmentDecorator.getApplicationId(); - int applicationInstanceId = segmentDecorator.getApplicationInstanceId(); - - for (int i = 0; i < segmentDecorator.getRefsCount(); i++) { - ReferenceDecorator referenceDecorator = segmentDecorator.getRefs(i); - if (!ReferenceIdExchanger.getInstance().exchange(referenceDecorator, applicationId)) { - return false; - } - - notifyRefsListener(referenceDecorator, applicationId, applicationInstanceId, segmentId); - } - - for (int i = 0; i < segmentDecorator.getSpansCount(); i++) { - SpanDecorator spanDecorator = segmentDecorator.getSpans(i); - - if (!SpanIdExchanger.getInstance().exchange(spanDecorator, applicationId)) { - return false; - } - - if (spanDecorator.getSpanId() == 0) { - notifyFirstListener(spanDecorator, applicationId, applicationInstanceId, segmentId); - } - - if (SpanType.Exit.equals(spanDecorator.getSpanType())) { - notifyExitListener(spanDecorator, applicationId, applicationInstanceId, segmentId); - } else if (SpanType.Entry.equals(spanDecorator.getSpanType())) { - notifyEntryListener(spanDecorator, applicationId, applicationInstanceId, segmentId); - } else if (SpanType.Local.equals(spanDecorator.getSpanType())) { - notifyLocalListener(spanDecorator, applicationId, applicationInstanceId, segmentId); - } else { - logger.error("span type value was unexpected, span type name: {}", spanDecorator.getSpanType().name()); - } - } - - return true; - } - - private void buildSegment(String id, byte[] dataBinary) { - StreamModuleContext context = (StreamModuleContext)CollectorContextHelper.INSTANCE.getContext(StreamModuleGroupDefine.GROUP_NAME); - SegmentDataDefine.Segment segment = new SegmentDataDefine.Segment(); - segment.setId(id); - segment.setDataBinary(dataBinary); - - try { - logger.debug("send to segment persistence worker, id: {}, dataBinary length: {}", segment.getId(), dataBinary.length); - context.getClusterWorkerContext().lookup(SegmentPersistenceWorker.WorkerRole.INSTANCE).tell(segment.toData()); - } catch (WorkerInvokeException | WorkerNotFoundException e) { - logger.error(e.getMessage(), e); - } - } - - private void writeToBufferFile(String id, UpstreamSegment upstreamSegment) { - StreamModuleContext context = (StreamModuleContext)CollectorContextHelper.INSTANCE.getContext(StreamModuleGroupDefine.GROUP_NAME); - - try { - logger.debug("send to segment buffer write worker, id: {}", id); - context.getClusterWorkerContext().lookup(SegmentStandardizationWorker.WorkerRole.INSTANCE).tell(upstreamSegment); - } catch (WorkerInvokeException | WorkerNotFoundException e) { - logger.error(e.getMessage(), e); - } - } - - private void notifyListenerToBuild() { - spanListeners.forEach(SpanListener::build); - } - - private void notifyExitListener(SpanDecorator spanDecorator, int applicationId, int applicationInstanceId, - String segmentId) { - for (SpanListener listener : spanListeners) { - if (listener instanceof ExitSpanListener) { - ((ExitSpanListener)listener).parseExit(spanDecorator, applicationId, applicationInstanceId, segmentId); - } - } - } - - private void notifyEntryListener(SpanDecorator spanDecorator, int applicationId, int applicationInstanceId, - String segmentId) { - for (SpanListener listener : spanListeners) { - if (listener instanceof EntrySpanListener) { - ((EntrySpanListener)listener).parseEntry(spanDecorator, applicationId, applicationInstanceId, segmentId); - } - } - } - - private void notifyLocalListener(SpanDecorator spanDecorator, int applicationId, int applicationInstanceId, - String segmentId) { - for (SpanListener listener : spanListeners) { - if (listener instanceof LocalSpanListener) { - ((LocalSpanListener)listener).parseLocal(spanDecorator, applicationId, applicationInstanceId, segmentId); - } - } - } - - private void notifyFirstListener(SpanDecorator spanDecorator, int applicationId, int applicationInstanceId, - String segmentId) { - for (SpanListener listener : spanListeners) { - if (listener instanceof FirstSpanListener) { - ((FirstSpanListener)listener).parseFirst(spanDecorator, applicationId, applicationInstanceId, segmentId); - } - } - } - - private void notifyRefsListener(ReferenceDecorator reference, int applicationId, int applicationInstanceId, - String segmentId) { - for (SpanListener listener : spanListeners) { - if (listener instanceof RefsListener) { - ((RefsListener)listener).parseRef(reference, applicationId, applicationInstanceId, segmentId); - } - } - } - - private void notifyGlobalsListener(UniqueId uniqueId) { - for (SpanListener listener : spanListeners) { - if (listener instanceof GlobalTraceIdsListener) { - ((GlobalTraceIdsListener)listener).parseGlobalTraceId(uniqueId); - } - } - } - - public enum Source { - Agent, Buffer - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/SpanListener.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/SpanListener.java deleted file mode 100644 index e52fc8b7c5..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/SpanListener.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.worker.segment; - -/** - * @author peng-yongsheng - */ -public interface SpanListener { - void build(); -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/buffer/Offset.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/buffer/Offset.java deleted file mode 100644 index 2ea0896ac4..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/buffer/Offset.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.worker.segment.buffer; - -/** - * @author peng-yongsheng - */ -public class Offset { - - private static final String SPLIT_CHARACTER = ","; - private ReadOffset readOffset; - private WriteOffset writeOffset; - - public Offset() { - readOffset = new ReadOffset(); - writeOffset = new WriteOffset(); - } - - public String serialize() { - return readOffset.getReadFileName() + SPLIT_CHARACTER + String.valueOf(readOffset.getReadFileOffset()) - + SPLIT_CHARACTER + writeOffset.getWriteFileName() + SPLIT_CHARACTER + String.valueOf(writeOffset.getWriteFileOffset()); - } - - public void deserialize(String value) { - String[] values = value.split(SPLIT_CHARACTER); - if (values.length == 4) { - this.readOffset.readFileName = values[0]; - this.readOffset.readFileOffset = Long.parseLong(values[1]); - this.writeOffset.writeFileName = values[2]; - this.writeOffset.writeFileOffset = Long.parseLong(values[3]); - } - } - - public ReadOffset getReadOffset() { - return readOffset; - } - - public WriteOffset getWriteOffset() { - return writeOffset; - } - - public static class ReadOffset { - private String readFileName; - private long readFileOffset = 0; - - public String getReadFileName() { - return readFileName; - } - - public long getReadFileOffset() { - return readFileOffset; - } - - public void setReadFileName(String readFileName) { - this.readFileName = readFileName; - } - - public void setReadFileOffset(long readFileOffset) { - this.readFileOffset = readFileOffset; - } - } - - public static class WriteOffset { - private String writeFileName; - private long writeFileOffset = 0; - - public String getWriteFileName() { - return writeFileName; - } - - public long getWriteFileOffset() { - return writeFileOffset; - } - - public void setWriteFileName(String writeFileName) { - this.writeFileName = writeFileName; - } - - public void setWriteFileOffset(long writeFileOffset) { - this.writeFileOffset = writeFileOffset; - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/buffer/OffsetManager.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/buffer/OffsetManager.java deleted file mode 100644 index 3e95187493..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/buffer/OffsetManager.java +++ /dev/null @@ -1,148 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.worker.segment.buffer; - -import java.io.File; -import java.io.FilenameFilter; -import java.io.IOException; -import java.io.RandomAccessFile; -import java.util.concurrent.Executors; -import java.util.concurrent.TimeUnit; -import org.skywalking.apm.collector.agentstream.config.BufferFileConfig; -import org.skywalking.apm.collector.agentstream.worker.util.FileUtils; -import org.skywalking.apm.collector.core.util.CollectionUtils; -import org.skywalking.apm.collector.core.util.Const; -import org.skywalking.apm.collector.core.util.TimeBucketUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public enum OffsetManager { - INSTANCE; - - private final Logger logger = LoggerFactory.getLogger(OffsetManager.class); - - private static final String OFFSET_FILE_PREFIX = "offset"; - private File offsetFile; - private Offset offset; - private boolean initialized = false; - private RandomAccessFile randomAccessFile = null; - private String lastOffsetRecord = Const.EMPTY_STRING; - - public synchronized void initialize() throws IOException { - if (!initialized) { - this.offset = new Offset(); - File dataPath = new File(SegmentBufferConfig.BUFFER_PATH); - if (dataPath.mkdirs()) { - createOffsetFile(); - } else { - File[] offsetFiles = dataPath.listFiles(new PrefixFileNameFilter()); - if (CollectionUtils.isNotEmpty(offsetFiles) && offsetFiles.length > 0) { - for (int i = 0; i < offsetFiles.length; i++) { - if (i != offsetFiles.length - 1) { - offsetFiles[i].delete(); - } else { - offsetFile = offsetFiles[i]; - } - } - } else { - createOffsetFile(); - } - } - String offsetRecord = FileUtils.INSTANCE.readLastLine(offsetFile); - offset.deserialize(offsetRecord); - initialized = true; - - Executors.newSingleThreadScheduledExecutor().scheduleAtFixedRate(() -> flush(), 10, 3, TimeUnit.SECONDS); - } - } - - private void createOffsetFile() throws IOException { - String timeBucket = String.valueOf(TimeBucketUtils.INSTANCE.getSecondTimeBucket(System.currentTimeMillis())); - String offsetFileName = OFFSET_FILE_PREFIX + "_" + timeBucket + "." + Const.FILE_SUFFIX; - offsetFile = new File(SegmentBufferConfig.BUFFER_PATH + offsetFileName); - this.offset.getWriteOffset().setWriteFileName(Const.EMPTY_STRING); - this.offset.getWriteOffset().setWriteFileOffset(0); - this.offset.getReadOffset().setReadFileName(Const.EMPTY_STRING); - this.offset.getReadOffset().setReadFileOffset(0); - this.flush(); - } - - public void flush() { - String offsetRecord = offset.serialize(); - if (!lastOffsetRecord.equals(offsetRecord)) { - if (offsetFile.length() >= BufferFileConfig.BUFFER_OFFSET_MAX_FILE_SIZE) { - nextFile(); - } - FileUtils.INSTANCE.writeAppendToLast(offsetFile, randomAccessFile, offsetRecord); - lastOffsetRecord = offsetRecord; - } - } - - private void nextFile() { - String timeBucket = String.valueOf(TimeBucketUtils.INSTANCE.getSecondTimeBucket(System.currentTimeMillis())); - String offsetFileName = OFFSET_FILE_PREFIX + "_" + timeBucket + "." + Const.FILE_SUFFIX; - File newOffsetFile = new File(SegmentBufferConfig.BUFFER_PATH + offsetFileName); - offsetFile.delete(); - offsetFile = newOffsetFile; - this.flush(); - } - - public String getReadFileName() { - return offset.getReadOffset().getReadFileName(); - } - - public long getReadFileOffset() { - return offset.getReadOffset().getReadFileOffset(); - } - - public void setReadOffset(long readFileOffset) { - offset.getReadOffset().setReadFileOffset(readFileOffset); - } - - public void setReadOffset(String readFileName, long readFileOffset) { - offset.getReadOffset().setReadFileName(readFileName); - offset.getReadOffset().setReadFileOffset(readFileOffset); - } - - public String getWriteFileName() { - return offset.getWriteOffset().getWriteFileName(); - } - - public long getWriteFileOffset() { - return offset.getWriteOffset().getWriteFileOffset(); - } - - public void setWriteOffset(String writeFileName, long writeFileOffset) { - offset.getWriteOffset().setWriteFileName(writeFileName); - offset.getWriteOffset().setWriteFileOffset(writeFileOffset); - } - - public void setWriteOffset(long writeFileOffset) { - offset.getWriteOffset().setWriteFileOffset(writeFileOffset); - } - - class PrefixFileNameFilter implements FilenameFilter { - @Override public boolean accept(File dir, String name) { - return name.startsWith(OFFSET_FILE_PREFIX); - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/buffer/SegmentBufferConfig.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/buffer/SegmentBufferConfig.java deleted file mode 100644 index 16fab593d7..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/buffer/SegmentBufferConfig.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.worker.segment.buffer; - -import org.skywalking.apm.collector.core.config.SystemConfig; - -/** - * @author peng-yongsheng - */ -public class SegmentBufferConfig { - public static String BUFFER_PATH = SystemConfig.DATA_PATH + "/buffer/"; -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/buffer/SegmentBufferManager.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/buffer/SegmentBufferManager.java deleted file mode 100644 index 07339d596a..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/buffer/SegmentBufferManager.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.worker.segment.buffer; - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import org.skywalking.apm.collector.agentstream.config.BufferFileConfig; -import org.skywalking.apm.collector.core.util.Const; -import org.skywalking.apm.collector.core.util.StringUtils; -import org.skywalking.apm.collector.core.util.TimeBucketUtils; -import org.skywalking.apm.network.proto.UpstreamSegment; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public enum SegmentBufferManager { - INSTANCE; - - private final Logger logger = LoggerFactory.getLogger(SegmentBufferManager.class); - - public static final String DATA_FILE_PREFIX = "data"; - private FileOutputStream outputStream; - - public synchronized void initialize() { - logger.info("segment buffer initialize"); - try { - OffsetManager.INSTANCE.initialize(); - if (new File(SegmentBufferConfig.BUFFER_PATH).mkdirs()) { - newDataFile(); - } else { - String writeFileName = OffsetManager.INSTANCE.getWriteFileName(); - if (StringUtils.isNotEmpty(writeFileName)) { - File dataFile = new File(SegmentBufferConfig.BUFFER_PATH + writeFileName); - if (dataFile.exists()) { - outputStream = new FileOutputStream(new File(SegmentBufferConfig.BUFFER_PATH + writeFileName), true); - } else { - newDataFile(); - } - } else { - newDataFile(); - } - } - SegmentBufferReader.INSTANCE.initialize(); - } catch (IOException e) { - logger.error(e.getMessage(), e); - } - } - - public synchronized void writeBuffer(UpstreamSegment segment) { - try { - segment.writeDelimitedTo(outputStream); - long position = outputStream.getChannel().position(); - if (position > BufferFileConfig.BUFFER_SEGMENT_MAX_FILE_SIZE) { - newDataFile(); - } else { - OffsetManager.INSTANCE.setWriteOffset(position); - } - } catch (IOException e) { - logger.error(e.getMessage(), e); - } - } - - private void newDataFile() throws IOException { - logger.debug("create new segment buffer file"); - String timeBucket = String.valueOf(TimeBucketUtils.INSTANCE.getSecondTimeBucket(System.currentTimeMillis())); - String writeFileName = DATA_FILE_PREFIX + "_" + timeBucket + "." + Const.FILE_SUFFIX; - File dataFile = new File(SegmentBufferConfig.BUFFER_PATH + writeFileName); - dataFile.createNewFile(); - OffsetManager.INSTANCE.setWriteOffset(writeFileName, 0); - try { - if (outputStream != null) { - outputStream.close(); - } - outputStream = new FileOutputStream(dataFile); - outputStream.getChannel().position(0); - } catch (IOException e) { - logger.error(e.getMessage(), e); - } - } - - public synchronized void flush() { - - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/buffer/SegmentBufferReader.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/buffer/SegmentBufferReader.java deleted file mode 100644 index 4f8c767985..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/buffer/SegmentBufferReader.java +++ /dev/null @@ -1,147 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.worker.segment.buffer; - -import com.google.protobuf.CodedOutputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.FilenameFilter; -import java.io.IOException; -import java.io.InputStream; -import java.util.concurrent.Executors; -import java.util.concurrent.TimeUnit; -import org.skywalking.apm.collector.agentstream.worker.segment.SegmentParse; -import org.skywalking.apm.collector.core.util.CollectionUtils; -import org.skywalking.apm.collector.core.util.Const; -import org.skywalking.apm.collector.core.util.StringUtils; -import org.skywalking.apm.network.proto.UpstreamSegment; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public enum SegmentBufferReader { - INSTANCE; - - private final Logger logger = LoggerFactory.getLogger(SegmentBufferReader.class); - private InputStream inputStream; - - public void initialize() { - Executors.newSingleThreadScheduledExecutor().scheduleAtFixedRate(this::preRead, 3, 3, TimeUnit.SECONDS); - } - - private void preRead() { - String readFileName = OffsetManager.INSTANCE.getReadFileName(); - if (StringUtils.isNotEmpty(readFileName)) { - File readFile = new File(SegmentBufferConfig.BUFFER_PATH + readFileName); - if (readFile.exists()) { - deleteTheDataFilesBeforeReadFile(readFileName); - long readFileOffset = OffsetManager.INSTANCE.getReadFileOffset(); - read(readFile, readFileOffset); - readEarliestCreateDataFile(); - } else { - deleteTheDataFilesBeforeReadFile(readFileName); - readEarliestCreateDataFile(); - } - } else { - readEarliestCreateDataFile(); - } - } - - private void deleteTheDataFilesBeforeReadFile(String readFileName) { - File[] dataFiles = new File(SegmentBufferConfig.BUFFER_PATH).listFiles(new PrefixFileNameFilter()); - - long readFileCreateTime = getFileCreateTime(readFileName); - for (File dataFile : dataFiles) { - long fileCreateTime = getFileCreateTime(dataFile.getName()); - if (fileCreateTime < readFileCreateTime) { - dataFile.delete(); - } else if (fileCreateTime == readFileCreateTime) { - break; - } - } - } - - private long getFileCreateTime(String fileName) { - fileName = fileName.replace(SegmentBufferManager.DATA_FILE_PREFIX + "_", Const.EMPTY_STRING); - fileName = fileName.replace("." + Const.FILE_SUFFIX, Const.EMPTY_STRING); - return Long.valueOf(fileName); - } - - private void readEarliestCreateDataFile() { - String readFileName = OffsetManager.INSTANCE.getReadFileName(); - File[] dataFiles = new File(SegmentBufferConfig.BUFFER_PATH).listFiles(new PrefixFileNameFilter()); - - if (CollectionUtils.isNotEmpty(dataFiles)) { - if (dataFiles[0].getName().equals(readFileName)) { - return; - } - } - - for (File dataFile : dataFiles) { - logger.debug("Reading segment buffer data file, file name: {}", dataFile.getAbsolutePath()); - OffsetManager.INSTANCE.setReadOffset(dataFile.getName(), 0); - if (!read(dataFile, 0)) { - break; - } - } - } - - private boolean read(File readFile, long readFileOffset) { - try { - inputStream = new FileInputStream(readFile); - inputStream.skip(readFileOffset); - - String writeFileName = OffsetManager.INSTANCE.getWriteFileName(); - long endPoint = readFile.length(); - if (writeFileName.equals(readFile.getName())) { - endPoint = OffsetManager.INSTANCE.getWriteFileOffset(); - } - - while (readFile.length() > readFileOffset && readFileOffset < endPoint) { - UpstreamSegment upstreamSegment = UpstreamSegment.parser().parseDelimitedFrom(inputStream); - SegmentParse parse = new SegmentParse(); - if (!parse.parse(upstreamSegment, SegmentParse.Source.Buffer)) { - return false; - } - - final int serialized = upstreamSegment.getSerializedSize(); - readFileOffset = readFileOffset + CodedOutputStream.computeUInt32SizeNoTag(serialized) + serialized; - logger.debug("read segment buffer from file: {}, offset: {}, file length: {}", readFile.getName(), readFileOffset, readFile.length()); - OffsetManager.INSTANCE.setReadOffset(readFileOffset); - } - - inputStream.close(); - if (!writeFileName.equals(readFile.getName())) { - readFile.delete(); - } - } catch (IOException e) { - logger.error(e.getMessage(), e); - return false; - } - return true; - } - - class PrefixFileNameFilter implements FilenameFilter { - @Override public boolean accept(File dir, String name) { - return name.startsWith(SegmentBufferManager.DATA_FILE_PREFIX); - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/cost/SegmentCostPersistenceWorker.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/cost/SegmentCostPersistenceWorker.java deleted file mode 100644 index 1a5a0a01a2..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/cost/SegmentCostPersistenceWorker.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.worker.segment.cost; - -import org.skywalking.apm.collector.agentstream.worker.segment.cost.dao.ISegmentCostDAO; -import org.skywalking.apm.collector.storage.base.dao.DAOContainer; -import org.skywalking.apm.collector.storage.base.define.DataDefine; -import org.skywalking.apm.collector.storage.base.define.segment.SegmentCostDataDefine; -import org.skywalking.apm.collector.stream.worker.AbstractLocalAsyncWorkerProvider; -import org.skywalking.apm.collector.stream.worker.ClusterWorkerContext; -import org.skywalking.apm.collector.stream.worker.ProviderNotFoundException; -import org.skywalking.apm.collector.stream.worker.Role; -import org.skywalking.apm.collector.stream.worker.impl.PersistenceWorker; -import org.skywalking.apm.collector.stream.worker.impl.dao.IPersistenceDAO; -import org.skywalking.apm.collector.stream.worker.selector.RollingSelector; -import org.skywalking.apm.collector.stream.worker.selector.WorkerSelector; - -/** - * @author peng-yongsheng - */ -public class SegmentCostPersistenceWorker extends PersistenceWorker { - - public SegmentCostPersistenceWorker(Role role, ClusterWorkerContext clusterContext) { - super(role, clusterContext); - } - - @Override public void preStart() throws ProviderNotFoundException { - super.preStart(); - } - - @Override protected boolean needMergeDBData() { - return false; - } - - @Override protected IPersistenceDAO persistenceDAO() { - return (IPersistenceDAO)DAOContainer.INSTANCE.get(ISegmentCostDAO.class.getName()); - } - - public static class Factory extends AbstractLocalAsyncWorkerProvider { - @Override - public Role role() { - return WorkerRole.INSTANCE; - } - - @Override - public SegmentCostPersistenceWorker workerInstance(ClusterWorkerContext clusterContext) { - return new SegmentCostPersistenceWorker(role(), clusterContext); - } - - @Override - public int queueSize() { - return 1024; - } - } - - public enum WorkerRole implements Role { - INSTANCE; - - @Override - public String roleName() { - return SegmentCostPersistenceWorker.class.getSimpleName(); - } - - @Override - public WorkerSelector workerSelector() { - return new RollingSelector(); - } - - @Override public DataDefine dataDefine() { - return new SegmentCostDataDefine(); - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/cost/SegmentCostSpanListener.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/cost/SegmentCostSpanListener.java deleted file mode 100644 index d72d224850..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/cost/SegmentCostSpanListener.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.worker.segment.cost; - -import java.util.ArrayList; -import java.util.List; -import org.skywalking.apm.collector.agentstream.worker.segment.EntrySpanListener; -import org.skywalking.apm.collector.agentstream.worker.segment.ExitSpanListener; -import org.skywalking.apm.collector.agentstream.worker.segment.FirstSpanListener; -import org.skywalking.apm.collector.agentstream.worker.segment.LocalSpanListener; -import org.skywalking.apm.collector.agentstream.worker.segment.standardization.SpanDecorator; -import org.skywalking.apm.collector.cache.ServiceNameCache; -import org.skywalking.apm.collector.core.framework.CollectorContextHelper; -import org.skywalking.apm.collector.core.util.TimeBucketUtils; -import org.skywalking.apm.collector.storage.base.define.segment.SegmentCostDataDefine; -import org.skywalking.apm.collector.stream.StreamModuleContext; -import org.skywalking.apm.collector.stream.StreamModuleGroupDefine; -import org.skywalking.apm.collector.stream.worker.WorkerInvokeException; -import org.skywalking.apm.collector.stream.worker.WorkerNotFoundException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class SegmentCostSpanListener implements EntrySpanListener, ExitSpanListener, LocalSpanListener, FirstSpanListener { - - private final Logger logger = LoggerFactory.getLogger(SegmentCostSpanListener.class); - - private List segmentCosts = new ArrayList<>(); - private boolean isError = false; - private long timeBucket; - - @Override - public void parseFirst(SpanDecorator spanDecorator, int applicationId, int applicationInstanceId, - String segmentId) { - timeBucket = TimeBucketUtils.INSTANCE.getMinuteTimeBucket(spanDecorator.getStartTime()); - - SegmentCostDataDefine.SegmentCost segmentCost = new SegmentCostDataDefine.SegmentCost(); - segmentCost.setSegmentId(segmentId); - segmentCost.setApplicationId(applicationId); - segmentCost.setCost(spanDecorator.getEndTime() - spanDecorator.getStartTime()); - segmentCost.setStartTime(spanDecorator.getStartTime()); - segmentCost.setEndTime(spanDecorator.getEndTime()); - segmentCost.setId(segmentId); - if (spanDecorator.getOperationNameId() == 0) { - segmentCost.setServiceName(spanDecorator.getOperationName()); - } else { - segmentCost.setServiceName(ServiceNameCache.getSplitServiceName(ServiceNameCache.get(spanDecorator.getOperationNameId()))); - } - - segmentCosts.add(segmentCost); - isError = isError || spanDecorator.getIsError(); - } - - @Override - public void parseEntry(SpanDecorator spanDecorator, int applicationId, int applicationInstanceId, - String segmentId) { - isError = isError || spanDecorator.getIsError(); - } - - @Override - public void parseExit(SpanDecorator spanDecorator, int applicationId, int applicationInstanceId, String segmentId) { - isError = isError || spanDecorator.getIsError(); - } - - @Override - public void parseLocal(SpanDecorator spanDecorator, int applicationId, int applicationInstanceId, - String segmentId) { - isError = isError || spanDecorator.getIsError(); - } - - @Override public void build() { - logger.debug("segment cost listener build"); - StreamModuleContext context = (StreamModuleContext)CollectorContextHelper.INSTANCE.getContext(StreamModuleGroupDefine.GROUP_NAME); - - for (SegmentCostDataDefine.SegmentCost segmentCost : segmentCosts) { - segmentCost.setError(isError); - segmentCost.setTimeBucket(timeBucket); - try { - logger.debug("send to segment cost persistence worker, id: {}", segmentCost.getId()); - context.getClusterWorkerContext().lookup(SegmentCostPersistenceWorker.WorkerRole.INSTANCE).tell(segmentCost.toData()); - } catch (WorkerInvokeException | WorkerNotFoundException e) { - logger.error(e.getMessage(), e); - } - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/cost/dao/ISegmentCostDAO.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/cost/dao/ISegmentCostDAO.java deleted file mode 100644 index b09d6d3306..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/cost/dao/ISegmentCostDAO.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.worker.segment.cost.dao; - -/** - * @author peng-yongsheng - */ -public interface ISegmentCostDAO { -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/cost/dao/SegmentCostEsDAO.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/cost/dao/SegmentCostEsDAO.java deleted file mode 100644 index cfa7ef1805..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/cost/dao/SegmentCostEsDAO.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.worker.segment.cost.dao; - -import java.util.HashMap; -import java.util.Map; -import org.elasticsearch.action.index.IndexRequestBuilder; -import org.elasticsearch.action.update.UpdateRequestBuilder; -import org.skywalking.apm.collector.core.stream.Data; -import org.skywalking.apm.collector.storage.base.define.DataDefine; -import org.skywalking.apm.collector.storage.base.define.segment.SegmentCostTable; -import org.skywalking.apm.collector.storage.elasticsearch.dao.EsDAO; -import org.skywalking.apm.collector.stream.worker.impl.dao.IPersistenceDAO; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class SegmentCostEsDAO extends EsDAO implements ISegmentCostDAO, IPersistenceDAO { - - private final Logger logger = LoggerFactory.getLogger(SegmentCostEsDAO.class); - - @Override public Data get(String id, DataDefine dataDefine) { - return null; - } - - @Override public UpdateRequestBuilder prepareBatchUpdate(Data data) { - return null; - } - - @Override public IndexRequestBuilder prepareBatchInsert(Data data) { - logger.debug("segment cost prepareBatchInsert, id: {}", data.getDataString(0)); - Map source = new HashMap<>(); - source.put(SegmentCostTable.COLUMN_SEGMENT_ID, data.getDataString(1)); - source.put(SegmentCostTable.COLUMN_APPLICATION_ID, data.getDataInteger(0)); - source.put(SegmentCostTable.COLUMN_SERVICE_NAME, data.getDataString(2)); - source.put(SegmentCostTable.COLUMN_COST, data.getDataLong(0)); - source.put(SegmentCostTable.COLUMN_START_TIME, data.getDataLong(1)); - source.put(SegmentCostTable.COLUMN_END_TIME, data.getDataLong(2)); - source.put(SegmentCostTable.COLUMN_IS_ERROR, data.getDataBoolean(0)); - source.put(SegmentCostTable.COLUMN_TIME_BUCKET, data.getDataLong(3)); - logger.debug("segment cost source: {}", source.toString()); - return getClient().prepareIndex(SegmentCostTable.TABLE, data.getDataString(0)).setSource(source); - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/cost/dao/SegmentCostH2DAO.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/cost/dao/SegmentCostH2DAO.java deleted file mode 100644 index bb93190208..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/cost/dao/SegmentCostH2DAO.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.worker.segment.cost.dao; - -import java.util.HashMap; -import java.util.Map; -import org.skywalking.apm.collector.core.stream.Data; -import org.skywalking.apm.collector.storage.base.define.DataDefine; -import org.skywalking.apm.collector.storage.base.define.segment.SegmentCostTable; -import org.skywalking.apm.collector.storage.h2.SqlBuilder; -import org.skywalking.apm.collector.storage.h2.base.dao.H2DAO; -import org.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; -import org.skywalking.apm.collector.stream.worker.impl.dao.IPersistenceDAO; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng, clevertension - */ -public class SegmentCostH2DAO extends H2DAO implements ISegmentCostDAO, IPersistenceDAO { - private final Logger logger = LoggerFactory.getLogger(SegmentCostH2DAO.class); - - @Override public Data get(String id, DataDefine dataDefine) { - return null; - } - - @Override public H2SqlEntity prepareBatchInsert(Data data) { - logger.debug("segment cost prepareBatchInsert, id: {}", data.getDataString(0)); - H2SqlEntity entity = new H2SqlEntity(); - Map source = new HashMap<>(); - source.put(SegmentCostTable.COLUMN_ID, data.getDataString(0)); - source.put(SegmentCostTable.COLUMN_SEGMENT_ID, data.getDataString(1)); - source.put(SegmentCostTable.COLUMN_APPLICATION_ID, data.getDataInteger(0)); - source.put(SegmentCostTable.COLUMN_SERVICE_NAME, data.getDataString(2)); - source.put(SegmentCostTable.COLUMN_COST, data.getDataLong(0)); - source.put(SegmentCostTable.COLUMN_START_TIME, data.getDataLong(1)); - source.put(SegmentCostTable.COLUMN_END_TIME, data.getDataLong(2)); - source.put(SegmentCostTable.COLUMN_IS_ERROR, data.getDataBoolean(0)); - source.put(SegmentCostTable.COLUMN_TIME_BUCKET, data.getDataLong(3)); - logger.debug("segment cost source: {}", source.toString()); - - String sql = SqlBuilder.buildBatchInsertSql(SegmentCostTable.TABLE, source.keySet()); - entity.setSql(sql); - entity.setParams(source.values().toArray(new Object[0])); - return entity; - } - - @Override public H2SqlEntity prepareBatchUpdate(Data data) { - return null; - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/cost/define/SegmentCostEsTableDefine.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/cost/define/SegmentCostEsTableDefine.java deleted file mode 100644 index 6fdd31170b..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/cost/define/SegmentCostEsTableDefine.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.worker.segment.cost.define; - -import org.skywalking.apm.collector.storage.base.define.segment.SegmentCostTable; -import org.skywalking.apm.collector.storage.elasticsearch.define.ElasticSearchColumnDefine; -import org.skywalking.apm.collector.storage.elasticsearch.define.ElasticSearchTableDefine; - -/** - * @author peng-yongsheng - */ -public class SegmentCostEsTableDefine extends ElasticSearchTableDefine { - - public SegmentCostEsTableDefine() { - super(SegmentCostTable.TABLE); - } - - @Override public int refreshInterval() { - return 5; - } - - @Override public void initialize() { - addColumn(new ElasticSearchColumnDefine(SegmentCostTable.COLUMN_SEGMENT_ID, ElasticSearchColumnDefine.Type.Keyword.name())); - addColumn(new ElasticSearchColumnDefine(SegmentCostTable.COLUMN_APPLICATION_ID, ElasticSearchColumnDefine.Type.Integer.name())); - addColumn(new ElasticSearchColumnDefine(SegmentCostTable.COLUMN_SERVICE_NAME, ElasticSearchColumnDefine.Type.Text.name())); - addColumn(new ElasticSearchColumnDefine(SegmentCostTable.COLUMN_COST, ElasticSearchColumnDefine.Type.Long.name())); - addColumn(new ElasticSearchColumnDefine(SegmentCostTable.COLUMN_START_TIME, ElasticSearchColumnDefine.Type.Long.name())); - addColumn(new ElasticSearchColumnDefine(SegmentCostTable.COLUMN_END_TIME, ElasticSearchColumnDefine.Type.Long.name())); - addColumn(new ElasticSearchColumnDefine(SegmentCostTable.COLUMN_IS_ERROR, ElasticSearchColumnDefine.Type.Boolean.name())); - addColumn(new ElasticSearchColumnDefine(SegmentCostTable.COLUMN_TIME_BUCKET, ElasticSearchColumnDefine.Type.Long.name())); - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/cost/define/SegmentCostH2TableDefine.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/cost/define/SegmentCostH2TableDefine.java deleted file mode 100644 index 687daff881..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/cost/define/SegmentCostH2TableDefine.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.worker.segment.cost.define; - -import org.skywalking.apm.collector.storage.base.define.segment.SegmentCostTable; -import org.skywalking.apm.collector.storage.h2.base.define.H2ColumnDefine; -import org.skywalking.apm.collector.storage.h2.base.define.H2TableDefine; - -/** - * @author peng-yongsheng - */ -public class SegmentCostH2TableDefine extends H2TableDefine { - - public SegmentCostH2TableDefine() { - super(SegmentCostTable.TABLE); - } - - @Override public void initialize() { - addColumn(new H2ColumnDefine(SegmentCostTable.COLUMN_ID, H2ColumnDefine.Type.Varchar.name())); - addColumn(new H2ColumnDefine(SegmentCostTable.COLUMN_SEGMENT_ID, H2ColumnDefine.Type.Varchar.name())); - addColumn(new H2ColumnDefine(SegmentCostTable.COLUMN_APPLICATION_ID, H2ColumnDefine.Type.Int.name())); - addColumn(new H2ColumnDefine(SegmentCostTable.COLUMN_SERVICE_NAME, H2ColumnDefine.Type.Varchar.name())); - addColumn(new H2ColumnDefine(SegmentCostTable.COLUMN_COST, H2ColumnDefine.Type.Bigint.name())); - addColumn(new H2ColumnDefine(SegmentCostTable.COLUMN_START_TIME, H2ColumnDefine.Type.Bigint.name())); - addColumn(new H2ColumnDefine(SegmentCostTable.COLUMN_END_TIME, H2ColumnDefine.Type.Bigint.name())); - addColumn(new H2ColumnDefine(SegmentCostTable.COLUMN_IS_ERROR, H2ColumnDefine.Type.Boolean.name())); - addColumn(new H2ColumnDefine(SegmentCostTable.COLUMN_TIME_BUCKET, H2ColumnDefine.Type.Bigint.name())); - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/origin/SegmentPersistenceWorker.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/origin/SegmentPersistenceWorker.java deleted file mode 100644 index 8a2e9a0465..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/origin/SegmentPersistenceWorker.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.worker.segment.origin; - -import org.skywalking.apm.collector.agentstream.worker.segment.origin.dao.ISegmentDAO; -import org.skywalking.apm.collector.storage.base.dao.DAOContainer; -import org.skywalking.apm.collector.storage.base.define.DataDefine; -import org.skywalking.apm.collector.storage.base.define.segment.SegmentDataDefine; -import org.skywalking.apm.collector.stream.worker.AbstractLocalAsyncWorkerProvider; -import org.skywalking.apm.collector.stream.worker.ClusterWorkerContext; -import org.skywalking.apm.collector.stream.worker.ProviderNotFoundException; -import org.skywalking.apm.collector.stream.worker.Role; -import org.skywalking.apm.collector.stream.worker.impl.PersistenceWorker; -import org.skywalking.apm.collector.stream.worker.impl.dao.IPersistenceDAO; -import org.skywalking.apm.collector.stream.worker.selector.RollingSelector; -import org.skywalking.apm.collector.stream.worker.selector.WorkerSelector; - -/** - * @author peng-yongsheng - */ -public class SegmentPersistenceWorker extends PersistenceWorker { - - public SegmentPersistenceWorker(Role role, ClusterWorkerContext clusterContext) { - super(role, clusterContext); - } - - @Override public void preStart() throws ProviderNotFoundException { - super.preStart(); - } - - @Override protected boolean needMergeDBData() { - return false; - } - - @Override protected IPersistenceDAO persistenceDAO() { - return (IPersistenceDAO)DAOContainer.INSTANCE.get(ISegmentDAO.class.getName()); - } - - public static class Factory extends AbstractLocalAsyncWorkerProvider { - @Override - public Role role() { - return WorkerRole.INSTANCE; - } - - @Override - public SegmentPersistenceWorker workerInstance(ClusterWorkerContext clusterContext) { - return new SegmentPersistenceWorker(role(), clusterContext); - } - - @Override - public int queueSize() { - return 1024; - } - } - - public enum WorkerRole implements Role { - INSTANCE; - - @Override - public String roleName() { - return SegmentPersistenceWorker.class.getSimpleName(); - } - - @Override - public WorkerSelector workerSelector() { - return new RollingSelector(); - } - - @Override public DataDefine dataDefine() { - return new SegmentDataDefine(); - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/origin/dao/ISegmentDAO.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/origin/dao/ISegmentDAO.java deleted file mode 100644 index eb3ef5a525..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/origin/dao/ISegmentDAO.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.worker.segment.origin.dao; - -/** - * @author peng-yongsheng - */ -public interface ISegmentDAO { -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/origin/dao/SegmentEsDAO.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/origin/dao/SegmentEsDAO.java deleted file mode 100644 index 60ba2044f6..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/origin/dao/SegmentEsDAO.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.worker.segment.origin.dao; - -import java.util.Base64; -import java.util.HashMap; -import java.util.Map; -import org.elasticsearch.action.index.IndexRequestBuilder; -import org.elasticsearch.action.update.UpdateRequestBuilder; -import org.skywalking.apm.collector.core.stream.Data; -import org.skywalking.apm.collector.storage.base.define.DataDefine; -import org.skywalking.apm.collector.storage.base.define.segment.SegmentTable; -import org.skywalking.apm.collector.storage.elasticsearch.dao.EsDAO; -import org.skywalking.apm.collector.stream.worker.impl.dao.IPersistenceDAO; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class SegmentEsDAO extends EsDAO implements ISegmentDAO, IPersistenceDAO { - - private final Logger logger = LoggerFactory.getLogger(SegmentEsDAO.class); - - @Override public Data get(String id, DataDefine dataDefine) { - return null; - } - - @Override public UpdateRequestBuilder prepareBatchUpdate(Data data) { - return null; - } - - @Override public IndexRequestBuilder prepareBatchInsert(Data data) { - Map source = new HashMap<>(); - source.put(SegmentTable.COLUMN_DATA_BINARY, new String(Base64.getEncoder().encode(data.getDataBytes(0)))); - logger.debug("segment source: {}", source.toString()); - return getClient().prepareIndex(SegmentTable.TABLE, data.getDataString(0)).setSource(source); - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/origin/dao/SegmentH2DAO.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/origin/dao/SegmentH2DAO.java deleted file mode 100644 index c5cc429b7c..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/origin/dao/SegmentH2DAO.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.worker.segment.origin.dao; - -import java.util.HashMap; -import java.util.Map; -import org.skywalking.apm.collector.agentstream.worker.segment.cost.dao.SegmentCostH2DAO; -import org.skywalking.apm.collector.core.stream.Data; -import org.skywalking.apm.collector.storage.base.define.DataDefine; -import org.skywalking.apm.collector.storage.base.define.segment.SegmentTable; -import org.skywalking.apm.collector.storage.h2.SqlBuilder; -import org.skywalking.apm.collector.storage.h2.base.dao.H2DAO; -import org.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; -import org.skywalking.apm.collector.stream.worker.impl.dao.IPersistenceDAO; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng, clevertension - */ -public class SegmentH2DAO extends H2DAO implements ISegmentDAO, IPersistenceDAO { - private final Logger logger = LoggerFactory.getLogger(SegmentCostH2DAO.class); - - @Override public Data get(String id, DataDefine dataDefine) { - return null; - } - - @Override public H2SqlEntity prepareBatchInsert(Data data) { - Map source = new HashMap<>(); - H2SqlEntity entity = new H2SqlEntity(); - source.put(SegmentTable.COLUMN_ID, data.getDataString(0)); - source.put(SegmentTable.COLUMN_DATA_BINARY, data.getDataBytes(0)); - logger.debug("segment source: {}", source.toString()); - - String sql = SqlBuilder.buildBatchInsertSql(SegmentTable.TABLE, source.keySet()); - entity.setSql(sql); - entity.setParams(source.values().toArray(new Object[0])); - return entity; - } - - @Override public H2SqlEntity prepareBatchUpdate(Data data) { - return null; - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/origin/define/SegmentEsTableDefine.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/origin/define/SegmentEsTableDefine.java deleted file mode 100644 index acb00444f9..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/origin/define/SegmentEsTableDefine.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.worker.segment.origin.define; - -import org.skywalking.apm.collector.storage.base.define.segment.SegmentTable; -import org.skywalking.apm.collector.storage.elasticsearch.define.ElasticSearchColumnDefine; -import org.skywalking.apm.collector.storage.elasticsearch.define.ElasticSearchTableDefine; - -/** - * @author peng-yongsheng - */ -public class SegmentEsTableDefine extends ElasticSearchTableDefine { - - public SegmentEsTableDefine() { - super(SegmentTable.TABLE); - } - - @Override public int refreshInterval() { - return 10; - } - - @Override public void initialize() { - addColumn(new ElasticSearchColumnDefine(SegmentTable.COLUMN_DATA_BINARY, ElasticSearchColumnDefine.Type.Binary.name())); - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/origin/define/SegmentH2TableDefine.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/origin/define/SegmentH2TableDefine.java deleted file mode 100644 index f05be709ad..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/origin/define/SegmentH2TableDefine.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.worker.segment.origin.define; - -import org.skywalking.apm.collector.storage.base.define.segment.SegmentTable; -import org.skywalking.apm.collector.storage.h2.base.define.H2ColumnDefine; -import org.skywalking.apm.collector.storage.h2.base.define.H2TableDefine; - -/** - * @author peng-yongsheng - */ -public class SegmentH2TableDefine extends H2TableDefine { - - public SegmentH2TableDefine() { - super(SegmentTable.TABLE); - } - - @Override public void initialize() { - addColumn(new H2ColumnDefine(SegmentTable.COLUMN_ID, H2ColumnDefine.Type.Varchar.name())); - addColumn(new H2ColumnDefine(SegmentTable.COLUMN_DATA_BINARY, H2ColumnDefine.Type.BINARY.name())); - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/standardization/IdExchanger.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/standardization/IdExchanger.java deleted file mode 100644 index 2d052f3f09..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/standardization/IdExchanger.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.worker.segment.standardization; - -/** - * @author peng-yongsheng - */ -public interface IdExchanger { - boolean exchange(T standardBuilder, int applicationId); -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/standardization/ReferenceDecorator.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/standardization/ReferenceDecorator.java deleted file mode 100644 index 4c9f1db725..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/standardization/ReferenceDecorator.java +++ /dev/null @@ -1,190 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.worker.segment.standardization; - -import org.skywalking.apm.network.proto.RefType; -import org.skywalking.apm.network.proto.TraceSegmentReference; -import org.skywalking.apm.network.proto.UniqueId; - -/** - * @author peng-yongsheng - */ -public class ReferenceDecorator implements StandardBuilder { - private boolean isOrigin = true; - private StandardBuilder standardBuilder; - private TraceSegmentReference referenceObject; - private TraceSegmentReference.Builder referenceBuilder; - - public ReferenceDecorator(TraceSegmentReference referenceObject, StandardBuilder standardBuilder) { - this.referenceObject = referenceObject; - this.standardBuilder = standardBuilder; - } - - public ReferenceDecorator(TraceSegmentReference.Builder referenceBuilder, StandardBuilder standardBuilder) { - this.referenceBuilder = referenceBuilder; - this.standardBuilder = standardBuilder; - this.isOrigin = false; - } - - public RefType getRefType() { - if (isOrigin) { - return referenceObject.getRefType(); - } else { - return referenceBuilder.getRefType(); - } - } - - public int getRefTypeValue() { - if (isOrigin) { - return referenceObject.getRefTypeValue(); - } else { - return referenceBuilder.getRefTypeValue(); - } - } - - public int getEntryServiceId() { - if (isOrigin) { - return referenceObject.getEntryServiceId(); - } else { - return referenceBuilder.getEntryServiceId(); - } - } - - public void setEntryServiceId(int value) { - if (isOrigin) { - toBuilder(); - } - referenceBuilder.setEntryServiceId(value); - } - - public String getEntryServiceName() { - if (isOrigin) { - return referenceObject.getEntryServiceName(); - } else { - return referenceBuilder.getEntryServiceName(); - } - } - - public void setEntryServiceName(String value) { - if (isOrigin) { - toBuilder(); - } - referenceBuilder.setEntryServiceName(value); - } - - public int getEntryApplicationInstanceId() { - if (isOrigin) { - return referenceObject.getEntryApplicationInstanceId(); - } else { - return referenceBuilder.getEntryApplicationInstanceId(); - } - } - - public int getParentApplicationInstanceId() { - if (isOrigin) { - return referenceObject.getParentApplicationInstanceId(); - } else { - return referenceBuilder.getParentApplicationInstanceId(); - } - } - - public int getParentServiceId() { - if (isOrigin) { - return referenceObject.getParentServiceId(); - } else { - return referenceBuilder.getParentServiceId(); - } - } - - public void setParentServiceId(int value) { - if (isOrigin) { - toBuilder(); - } - referenceBuilder.setParentServiceId(value); - } - - public int getParentSpanId() { - if (isOrigin) { - return referenceObject.getParentSpanId(); - } else { - return referenceBuilder.getParentSpanId(); - } - } - - public String getParentServiceName() { - if (isOrigin) { - return referenceObject.getParentServiceName(); - } else { - return referenceBuilder.getParentServiceName(); - } - } - - public void setParentServiceName(String value) { - if (isOrigin) { - toBuilder(); - } - referenceBuilder.setParentServiceName(value); - } - - public UniqueId getParentTraceSegmentId() { - if (isOrigin) { - return referenceObject.getParentTraceSegmentId(); - } else { - return referenceBuilder.getParentTraceSegmentId(); - } - } - - public int getNetworkAddressId() { - if (isOrigin) { - return referenceObject.getNetworkAddressId(); - } else { - return referenceBuilder.getNetworkAddressId(); - } - } - - public void setNetworkAddressId(int value) { - if (isOrigin) { - toBuilder(); - } - referenceBuilder.setNetworkAddressId(value); - } - - public String getNetworkAddress() { - if (isOrigin) { - return referenceObject.getNetworkAddress(); - } else { - return referenceBuilder.getNetworkAddress(); - } - } - - public void setNetworkAddress(String value) { - if (isOrigin) { - toBuilder(); - } - referenceBuilder.setNetworkAddress(value); - } - - @Override public void toBuilder() { - if (this.isOrigin) { - this.isOrigin = false; - referenceBuilder = referenceObject.toBuilder(); - standardBuilder.toBuilder(); - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/standardization/ReferenceIdExchanger.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/standardization/ReferenceIdExchanger.java deleted file mode 100644 index da0fefdffc..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/standardization/ReferenceIdExchanger.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.worker.segment.standardization; - -import org.skywalking.apm.collector.agentregister.servicename.ServiceNameService; -import org.skywalking.apm.collector.cache.ApplicationCache; -import org.skywalking.apm.collector.cache.InstanceCache; -import org.skywalking.apm.collector.core.util.Const; -import org.skywalking.apm.collector.core.util.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class ReferenceIdExchanger implements IdExchanger { - - private final Logger logger = LoggerFactory.getLogger(ReferenceIdExchanger.class); - - private static ReferenceIdExchanger EXCHANGER; - private ServiceNameService serviceNameService; - - public static ReferenceIdExchanger getInstance() { - if (EXCHANGER == null) { - EXCHANGER = new ReferenceIdExchanger(); - } - return EXCHANGER; - } - - public ReferenceIdExchanger() { - serviceNameService = new ServiceNameService(); - } - - @Override public boolean exchange(ReferenceDecorator standardBuilder, int applicationId) { - if (standardBuilder.getEntryServiceId() == 0 && StringUtils.isNotEmpty(standardBuilder.getEntryServiceName())) { - int entryServiceId = serviceNameService.getOrCreate(InstanceCache.get(standardBuilder.getEntryApplicationInstanceId()), standardBuilder.getEntryServiceName()); - if (entryServiceId == 0) { - return false; - } else { - standardBuilder.toBuilder(); - standardBuilder.setEntryServiceId(entryServiceId); - standardBuilder.setEntryServiceName(Const.EMPTY_STRING); - } - } - - if (standardBuilder.getParentServiceId() == 0 && StringUtils.isNotEmpty(standardBuilder.getParentServiceName())) { - int parentServiceId = serviceNameService.getOrCreate(InstanceCache.get(standardBuilder.getParentApplicationInstanceId()), standardBuilder.getParentServiceName()); - if (parentServiceId == 0) { - return false; - } else { - standardBuilder.toBuilder(); - standardBuilder.setParentServiceId(parentServiceId); - standardBuilder.setParentServiceName(Const.EMPTY_STRING); - } - } - - if (standardBuilder.getNetworkAddressId() == 0 && StringUtils.isNotEmpty(standardBuilder.getNetworkAddress())) { - int networkAddressId = ApplicationCache.get(standardBuilder.getNetworkAddress()); - if (networkAddressId == 0) { - return false; - } else { - standardBuilder.toBuilder(); - standardBuilder.setNetworkAddressId(networkAddressId); - standardBuilder.setNetworkAddress(Const.EMPTY_STRING); - } - } - return true; - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/standardization/SegmentDecorator.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/standardization/SegmentDecorator.java deleted file mode 100644 index 2e0bf92c1a..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/standardization/SegmentDecorator.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.worker.segment.standardization; - -import org.skywalking.apm.network.proto.TraceSegmentObject; -import org.skywalking.apm.network.proto.UniqueId; - -/** - * @author peng-yongsheng - */ -public class SegmentDecorator implements StandardBuilder { - private boolean isOrigin = true; - private final TraceSegmentObject segmentObject; - private TraceSegmentObject.Builder segmentBuilder; - - public SegmentDecorator(TraceSegmentObject segmentObject) { - this.segmentObject = segmentObject; - } - - public int getApplicationId() { - return segmentObject.getApplicationId(); - } - - public int getApplicationInstanceId() { - return segmentObject.getApplicationInstanceId(); - } - - public UniqueId getTraceSegmentId() { - return segmentObject.getTraceSegmentId(); - } - - public int getSpansCount() { - return segmentObject.getSpansCount(); - } - - public SpanDecorator getSpans(int index) { - if (isOrigin) { - return new SpanDecorator(segmentObject.getSpans(index), this); - } else { - return new SpanDecorator(segmentBuilder.getSpansBuilder(index), this); - } - } - - public int getRefsCount() { - return segmentObject.getRefsCount(); - } - - public ReferenceDecorator getRefs(int index) { - if (isOrigin) { - return new ReferenceDecorator(segmentObject.getRefs(index), this); - } else { - return new ReferenceDecorator(segmentBuilder.getRefsBuilder(index), this); - } - } - - public byte[] toByteArray() { - if (isOrigin) { - return segmentObject.toByteArray(); - } else { - return segmentBuilder.build().toByteArray(); - } - } - - @Override public void toBuilder() { - if (isOrigin) { - this.isOrigin = false; - this.segmentBuilder = segmentObject.toBuilder(); - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/standardization/SegmentStandardizationWorker.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/standardization/SegmentStandardizationWorker.java deleted file mode 100644 index 529ca69b9b..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/standardization/SegmentStandardizationWorker.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.worker.segment.standardization; - -import org.skywalking.apm.collector.agentstream.worker.segment.buffer.SegmentBufferManager; -import org.skywalking.apm.collector.core.queue.EndOfBatchCommand; -import org.skywalking.apm.collector.storage.base.define.DataDefine; -import org.skywalking.apm.collector.stream.worker.AbstractLocalAsyncWorker; -import org.skywalking.apm.collector.stream.worker.AbstractLocalAsyncWorkerProvider; -import org.skywalking.apm.collector.stream.worker.ClusterWorkerContext; -import org.skywalking.apm.collector.stream.worker.ProviderNotFoundException; -import org.skywalking.apm.collector.stream.worker.Role; -import org.skywalking.apm.collector.stream.worker.WorkerException; -import org.skywalking.apm.collector.stream.worker.impl.FlushAndSwitch; -import org.skywalking.apm.collector.stream.worker.selector.ForeverFirstSelector; -import org.skywalking.apm.collector.stream.worker.selector.WorkerSelector; -import org.skywalking.apm.network.proto.UpstreamSegment; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class SegmentStandardizationWorker extends AbstractLocalAsyncWorker { - - private final Logger logger = LoggerFactory.getLogger(SegmentStandardizationWorker.class); - - public SegmentStandardizationWorker(Role role, ClusterWorkerContext clusterContext) { - super(role, clusterContext); - } - - @Override public void preStart() throws ProviderNotFoundException { - super.preStart(); - SegmentBufferManager.INSTANCE.initialize(); - } - - @Override protected void onWork(Object message) throws WorkerException { - if (message instanceof FlushAndSwitch) { - SegmentBufferManager.INSTANCE.flush(); - } else if (message instanceof EndOfBatchCommand) { - } else if (message instanceof UpstreamSegment) { - UpstreamSegment upstreamSegment = (UpstreamSegment)message; - SegmentBufferManager.INSTANCE.writeBuffer(upstreamSegment); - } else { - logger.error("unhandled message, message instance must UpstreamSegment, but is %s", message.getClass().toString()); - } - } - - public static class Factory extends AbstractLocalAsyncWorkerProvider { - @Override - public Role role() { - return SegmentStandardizationWorker.WorkerRole.INSTANCE; - } - - @Override - public SegmentStandardizationWorker workerInstance(ClusterWorkerContext clusterContext) { - return new SegmentStandardizationWorker(role(), clusterContext); - } - - @Override public int queueSize() { - return 1024; - } - } - - public enum WorkerRole implements Role { - INSTANCE; - - @Override - public String roleName() { - return SegmentStandardizationWorker.class.getSimpleName(); - } - - @Override - public WorkerSelector workerSelector() { - return new ForeverFirstSelector(); - } - - @Override public DataDefine dataDefine() { - return null; - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/standardization/SpanDecorator.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/standardization/SpanDecorator.java deleted file mode 100644 index e4373ae36f..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/standardization/SpanDecorator.java +++ /dev/null @@ -1,200 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.worker.segment.standardization; - -import org.skywalking.apm.network.proto.SpanLayer; -import org.skywalking.apm.network.proto.SpanObject; -import org.skywalking.apm.network.proto.SpanType; - -/** - * @author peng-yongsheng - */ -public class SpanDecorator implements StandardBuilder { - private boolean isOrigin = true; - private StandardBuilder standardBuilder; - private SpanObject spanObject; - private SpanObject.Builder spanBuilder; - - public SpanDecorator(SpanObject spanObject, StandardBuilder standardBuilder) { - this.spanObject = spanObject; - this.standardBuilder = standardBuilder; - } - - public SpanDecorator(SpanObject.Builder spanBuilder, StandardBuilder standardBuilder) { - this.spanBuilder = spanBuilder; - this.standardBuilder = standardBuilder; - this.isOrigin = false; - } - - public int getSpanId() { - if (isOrigin) { - return spanObject.getSpanId(); - } else { - return spanBuilder.getSpanId(); - } - } - - public int getParentSpanId() { - if (isOrigin) { - return spanObject.getParentSpanId(); - } else { - return spanBuilder.getParentSpanId(); - } - } - - public SpanType getSpanType() { - if (isOrigin) { - return spanObject.getSpanType(); - } else { - return spanBuilder.getSpanType(); - } - } - - public int getSpanTypeValue() { - if (isOrigin) { - return spanObject.getSpanTypeValue(); - } else { - return spanBuilder.getSpanTypeValue(); - } - } - - public SpanLayer getSpanLayer() { - if (isOrigin) { - return spanObject.getSpanLayer(); - } else { - return spanBuilder.getSpanLayer(); - } - } - - public int getSpanLayerValue() { - if (isOrigin) { - return spanObject.getSpanLayerValue(); - } else { - return spanBuilder.getSpanLayerValue(); - } - } - - public long getStartTime() { - if (isOrigin) { - return spanObject.getStartTime(); - } else { - return spanBuilder.getStartTime(); - } - } - - public long getEndTime() { - if (isOrigin) { - return spanObject.getEndTime(); - } else { - return spanBuilder.getEndTime(); - } - } - - public int getComponentId() { - if (isOrigin) { - return spanObject.getComponentId(); - } else { - return spanBuilder.getComponentId(); - } - } - - public String getComponent() { - if (isOrigin) { - return spanObject.getComponent(); - } else { - return spanBuilder.getComponent(); - } - } - - public int getPeerId() { - if (isOrigin) { - return spanObject.getPeerId(); - } else { - return spanBuilder.getPeerId(); - } - } - - public void setPeerId(int peerId) { - if (isOrigin) { - toBuilder(); - } - spanBuilder.setPeerId(peerId); - } - - public String getPeer() { - if (isOrigin) { - return spanObject.getPeer(); - } else { - return spanBuilder.getPeer(); - } - } - - public void setPeer(String peer) { - if (isOrigin) { - toBuilder(); - } - spanBuilder.setPeer(peer); - } - - public int getOperationNameId() { - if (isOrigin) { - return spanObject.getOperationNameId(); - } else { - return spanBuilder.getOperationNameId(); - } - } - - public void setOperationNameId(int value) { - if (isOrigin) { - toBuilder(); - } - spanBuilder.setOperationNameId(value); - } - - public String getOperationName() { - if (isOrigin) { - return spanObject.getOperationName(); - } else { - return spanBuilder.getOperationName(); - } - } - - public void setOperationName(String value) { - if (isOrigin) { - toBuilder(); - } - spanBuilder.setOperationName(value); - } - - public boolean getIsError() { - if (isOrigin) { - return spanObject.getIsError(); - } else { - return spanBuilder.getIsError(); - } - } - - @Override public void toBuilder() { - if (this.isOrigin) { - this.isOrigin = false; - spanBuilder = spanObject.toBuilder(); - standardBuilder.toBuilder(); - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/standardization/SpanIdExchanger.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/standardization/SpanIdExchanger.java deleted file mode 100644 index 2a5cfe6c1c..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/standardization/SpanIdExchanger.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.worker.segment.standardization; - -import org.skywalking.apm.collector.agentregister.servicename.ServiceNameService; -import org.skywalking.apm.collector.cache.ApplicationCache; -import org.skywalking.apm.collector.core.util.Const; -import org.skywalking.apm.collector.core.util.StringUtils; - -/** - * @author peng-yongsheng - */ -public class SpanIdExchanger implements IdExchanger { - - private static SpanIdExchanger EXCHANGER; - private ServiceNameService serviceNameService; - - public static SpanIdExchanger getInstance() { - if (EXCHANGER == null) { - EXCHANGER = new SpanIdExchanger(); - } - return EXCHANGER; - } - - public SpanIdExchanger() { - serviceNameService = new ServiceNameService(); - } - - @Override public boolean exchange(SpanDecorator standardBuilder, int applicationId) { - if (standardBuilder.getPeerId() == 0 && StringUtils.isNotEmpty(standardBuilder.getPeer())) { - int peerId = ApplicationCache.get(standardBuilder.getPeer()); - if (peerId == 0) { - return false; - } else { - standardBuilder.toBuilder(); - standardBuilder.setPeerId(peerId); - standardBuilder.setPeer(Const.EMPTY_STRING); - } - } - - if (standardBuilder.getOperationNameId() == 0 && StringUtils.isNotEmpty(standardBuilder.getOperationName())) { - int operationNameId = serviceNameService.getOrCreate(applicationId, standardBuilder.getOperationName()); - if (operationNameId == 0) { - return false; - } else { - standardBuilder.toBuilder(); - standardBuilder.setOperationNameId(operationNameId); - standardBuilder.setOperationName(Const.EMPTY_STRING); - } - } - return true; - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/standardization/StandardBuilder.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/standardization/StandardBuilder.java deleted file mode 100644 index 8002fd6e27..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/segment/standardization/StandardBuilder.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.worker.segment.standardization; - -/** - * @author peng-yongsheng - */ -public interface StandardBuilder { - void toBuilder(); -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/service/entry/ServiceEntryAggregationWorker.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/service/entry/ServiceEntryAggregationWorker.java deleted file mode 100644 index f155e0d9f2..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/service/entry/ServiceEntryAggregationWorker.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.worker.service.entry; - -import org.skywalking.apm.collector.storage.base.define.DataDefine; -import org.skywalking.apm.collector.storage.base.define.service.ServiceEntryDataDefine; -import org.skywalking.apm.collector.stream.worker.AbstractLocalAsyncWorkerProvider; -import org.skywalking.apm.collector.stream.worker.ClusterWorkerContext; -import org.skywalking.apm.collector.stream.worker.ProviderNotFoundException; -import org.skywalking.apm.collector.stream.worker.Role; -import org.skywalking.apm.collector.stream.worker.WorkerNotFoundException; -import org.skywalking.apm.collector.stream.worker.WorkerRefs; -import org.skywalking.apm.collector.stream.worker.impl.AggregationWorker; -import org.skywalking.apm.collector.stream.worker.selector.HashCodeSelector; -import org.skywalking.apm.collector.stream.worker.selector.WorkerSelector; - -/** - * @author peng-yongsheng - */ -public class ServiceEntryAggregationWorker extends AggregationWorker { - - public ServiceEntryAggregationWorker(Role role, ClusterWorkerContext clusterContext) { - super(role, clusterContext); - } - - @Override public void preStart() throws ProviderNotFoundException { - super.preStart(); - } - - @Override protected WorkerRefs nextWorkRef(String id) throws WorkerNotFoundException { - return getClusterContext().lookup(ServiceEntryRemoteWorker.WorkerRole.INSTANCE); - } - - public static class Factory extends AbstractLocalAsyncWorkerProvider { - @Override - public Role role() { - return WorkerRole.INSTANCE; - } - - @Override - public ServiceEntryAggregationWorker workerInstance(ClusterWorkerContext clusterContext) { - return new ServiceEntryAggregationWorker(role(), clusterContext); - } - - @Override - public int queueSize() { - return 1024; - } - } - - public enum WorkerRole implements Role { - INSTANCE; - - @Override - public String roleName() { - return ServiceEntryAggregationWorker.class.getSimpleName(); - } - - @Override - public WorkerSelector workerSelector() { - return new HashCodeSelector(); - } - - @Override public DataDefine dataDefine() { - return new ServiceEntryDataDefine(); - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/service/entry/ServiceEntryPersistenceWorker.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/service/entry/ServiceEntryPersistenceWorker.java deleted file mode 100644 index f0e2e196cd..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/service/entry/ServiceEntryPersistenceWorker.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.worker.service.entry; - -import org.skywalking.apm.collector.agentstream.worker.service.entry.dao.IServiceEntryDAO; -import org.skywalking.apm.collector.storage.base.dao.DAOContainer; -import org.skywalking.apm.collector.storage.base.define.DataDefine; -import org.skywalking.apm.collector.storage.base.define.service.ServiceEntryDataDefine; -import org.skywalking.apm.collector.stream.worker.AbstractLocalAsyncWorkerProvider; -import org.skywalking.apm.collector.stream.worker.ClusterWorkerContext; -import org.skywalking.apm.collector.stream.worker.ProviderNotFoundException; -import org.skywalking.apm.collector.stream.worker.Role; -import org.skywalking.apm.collector.stream.worker.impl.PersistenceWorker; -import org.skywalking.apm.collector.stream.worker.impl.dao.IPersistenceDAO; -import org.skywalking.apm.collector.stream.worker.selector.HashCodeSelector; -import org.skywalking.apm.collector.stream.worker.selector.WorkerSelector; - -/** - * @author peng-yongsheng - */ -public class ServiceEntryPersistenceWorker extends PersistenceWorker { - - public ServiceEntryPersistenceWorker(Role role, ClusterWorkerContext clusterContext) { - super(role, clusterContext); - } - - @Override public void preStart() throws ProviderNotFoundException { - super.preStart(); - } - - @Override protected boolean needMergeDBData() { - return true; - } - - @Override protected IPersistenceDAO persistenceDAO() { - return (IPersistenceDAO)DAOContainer.INSTANCE.get(IServiceEntryDAO.class.getName()); - } - - public static class Factory extends AbstractLocalAsyncWorkerProvider { - @Override - public Role role() { - return WorkerRole.INSTANCE; - } - - @Override - public ServiceEntryPersistenceWorker workerInstance(ClusterWorkerContext clusterContext) { - return new ServiceEntryPersistenceWorker(role(), clusterContext); - } - - @Override - public int queueSize() { - return 1024; - } - } - - public enum WorkerRole implements Role { - INSTANCE; - - @Override - public String roleName() { - return ServiceEntryPersistenceWorker.class.getSimpleName(); - } - - @Override - public WorkerSelector workerSelector() { - return new HashCodeSelector(); - } - - @Override public DataDefine dataDefine() { - return new ServiceEntryDataDefine(); - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/service/entry/ServiceEntryRemoteWorker.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/service/entry/ServiceEntryRemoteWorker.java deleted file mode 100644 index 5dc4c43541..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/service/entry/ServiceEntryRemoteWorker.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.worker.service.entry; - -import org.skywalking.apm.collector.storage.base.define.DataDefine; -import org.skywalking.apm.collector.storage.base.define.service.ServiceEntryDataDefine; -import org.skywalking.apm.collector.stream.worker.AbstractRemoteWorker; -import org.skywalking.apm.collector.stream.worker.AbstractRemoteWorkerProvider; -import org.skywalking.apm.collector.stream.worker.ClusterWorkerContext; -import org.skywalking.apm.collector.stream.worker.ProviderNotFoundException; -import org.skywalking.apm.collector.stream.worker.Role; -import org.skywalking.apm.collector.stream.worker.WorkerException; -import org.skywalking.apm.collector.stream.worker.selector.HashCodeSelector; -import org.skywalking.apm.collector.stream.worker.selector.WorkerSelector; - -/** - * @author peng-yongsheng - */ -public class ServiceEntryRemoteWorker extends AbstractRemoteWorker { - - protected ServiceEntryRemoteWorker(Role role, ClusterWorkerContext clusterContext) { - super(role, clusterContext); - } - - @Override public void preStart() throws ProviderNotFoundException { - - } - - @Override protected void onWork(Object message) throws WorkerException { - getClusterContext().lookup(ServiceEntryPersistenceWorker.WorkerRole.INSTANCE).tell(message); - } - - public static class Factory extends AbstractRemoteWorkerProvider { - @Override - public Role role() { - return WorkerRole.INSTANCE; - } - - @Override - public ServiceEntryRemoteWorker workerInstance(ClusterWorkerContext clusterContext) { - return new ServiceEntryRemoteWorker(role(), clusterContext); - } - } - - public enum WorkerRole implements Role { - INSTANCE; - - @Override - public String roleName() { - return ServiceEntryRemoteWorker.class.getSimpleName(); - } - - @Override - public WorkerSelector workerSelector() { - return new HashCodeSelector(); - } - - @Override public DataDefine dataDefine() { - return new ServiceEntryDataDefine(); - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/service/entry/ServiceEntrySpanListener.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/service/entry/ServiceEntrySpanListener.java deleted file mode 100644 index 615b165362..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/service/entry/ServiceEntrySpanListener.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.worker.service.entry; - -import org.skywalking.apm.collector.agentstream.worker.segment.EntrySpanListener; -import org.skywalking.apm.collector.agentstream.worker.segment.FirstSpanListener; -import org.skywalking.apm.collector.agentstream.worker.segment.RefsListener; -import org.skywalking.apm.collector.agentstream.worker.segment.standardization.ReferenceDecorator; -import org.skywalking.apm.collector.agentstream.worker.segment.standardization.SpanDecorator; -import org.skywalking.apm.collector.cache.ServiceNameCache; -import org.skywalking.apm.collector.core.framework.CollectorContextHelper; -import org.skywalking.apm.collector.core.util.Const; -import org.skywalking.apm.collector.core.util.TimeBucketUtils; -import org.skywalking.apm.collector.storage.base.define.service.ServiceEntryDataDefine; -import org.skywalking.apm.collector.stream.StreamModuleContext; -import org.skywalking.apm.collector.stream.StreamModuleGroupDefine; -import org.skywalking.apm.collector.stream.worker.WorkerInvokeException; -import org.skywalking.apm.collector.stream.worker.WorkerNotFoundException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class ServiceEntrySpanListener implements RefsListener, FirstSpanListener, EntrySpanListener { - - private final Logger logger = LoggerFactory.getLogger(ServiceEntrySpanListener.class); - - private long timeBucket; - private boolean hasReference = false; - private int applicationId; - private int entryServiceId; - private String entryServiceName; - private boolean hasEntry = false; - - @Override - public void parseEntry(SpanDecorator spanDecorator, int applicationId, int applicationInstanceId, - String segmentId) { - this.applicationId = applicationId; - this.entryServiceId = spanDecorator.getOperationNameId(); - this.entryServiceName = ServiceNameCache.getSplitServiceName(ServiceNameCache.get(entryServiceId)); - this.hasEntry = true; - } - - @Override public void parseRef(ReferenceDecorator referenceDecorator, int applicationId, int applicationInstanceId, - String segmentId) { - hasReference = true; - } - - @Override - public void parseFirst(SpanDecorator spanDecorator, int applicationId, int applicationInstanceId, - String segmentId) { - timeBucket = TimeBucketUtils.INSTANCE.getMinuteTimeBucket(spanDecorator.getStartTime()); - } - - @Override public void build() { - logger.debug("entry service listener build"); - StreamModuleContext context = (StreamModuleContext)CollectorContextHelper.INSTANCE.getContext(StreamModuleGroupDefine.GROUP_NAME); - if (!hasReference && hasEntry) { - ServiceEntryDataDefine.ServiceEntry serviceEntry = new ServiceEntryDataDefine.ServiceEntry(); - serviceEntry.setId(applicationId + Const.ID_SPLIT + entryServiceId); - serviceEntry.setApplicationId(applicationId); - serviceEntry.setEntryServiceId(entryServiceId); - serviceEntry.setEntryServiceName(entryServiceName); - serviceEntry.setRegisterTime(timeBucket); - serviceEntry.setNewestTime(timeBucket); - - try { - logger.debug("send to service entry aggregation worker, id: {}", serviceEntry.getId()); - context.getClusterWorkerContext().lookup(ServiceEntryAggregationWorker.WorkerRole.INSTANCE).tell(serviceEntry.toData()); - } catch (WorkerInvokeException | WorkerNotFoundException e) { - logger.error(e.getMessage(), e); - } - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/service/entry/dao/IServiceEntryDAO.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/service/entry/dao/IServiceEntryDAO.java deleted file mode 100644 index eb1fc88c4b..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/service/entry/dao/IServiceEntryDAO.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.worker.service.entry.dao; - -/** - * @author peng-yongsheng - */ -public interface IServiceEntryDAO { -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/service/entry/dao/ServiceEntryEsDAO.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/service/entry/dao/ServiceEntryEsDAO.java deleted file mode 100644 index 29ee4d2b82..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/service/entry/dao/ServiceEntryEsDAO.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.worker.service.entry.dao; - -import java.util.HashMap; -import java.util.Map; -import org.elasticsearch.action.get.GetResponse; -import org.elasticsearch.action.index.IndexRequestBuilder; -import org.elasticsearch.action.update.UpdateRequestBuilder; -import org.skywalking.apm.collector.core.stream.Data; -import org.skywalking.apm.collector.storage.base.define.DataDefine; -import org.skywalking.apm.collector.storage.base.define.service.ServiceEntryTable; -import org.skywalking.apm.collector.storage.elasticsearch.dao.EsDAO; -import org.skywalking.apm.collector.stream.worker.impl.dao.IPersistenceDAO; - -/** - * @author peng-yongsheng - */ -public class ServiceEntryEsDAO extends EsDAO implements IServiceEntryDAO, IPersistenceDAO { - - @Override public Data get(String id, DataDefine dataDefine) { - GetResponse getResponse = getClient().prepareGet(ServiceEntryTable.TABLE, id).get(); - if (getResponse.isExists()) { - Data data = dataDefine.build(id); - Map source = getResponse.getSource(); - data.setDataInteger(0, ((Number)source.get(ServiceEntryTable.COLUMN_APPLICATION_ID)).intValue()); - data.setDataInteger(1, ((Number)source.get(ServiceEntryTable.COLUMN_ENTRY_SERVICE_ID)).intValue()); - data.setDataString(1, (String)source.get(ServiceEntryTable.COLUMN_ENTRY_SERVICE_NAME)); - data.setDataLong(0, ((Number)source.get(ServiceEntryTable.COLUMN_REGISTER_TIME)).longValue()); - data.setDataLong(1, ((Number)source.get(ServiceEntryTable.COLUMN_NEWEST_TIME)).longValue()); - return data; - } else { - return null; - } - } - - @Override public IndexRequestBuilder prepareBatchInsert(Data data) { - Map source = new HashMap<>(); - source.put(ServiceEntryTable.COLUMN_APPLICATION_ID, data.getDataInteger(0)); - source.put(ServiceEntryTable.COLUMN_ENTRY_SERVICE_ID, data.getDataInteger(1)); - source.put(ServiceEntryTable.COLUMN_ENTRY_SERVICE_NAME, data.getDataString(1)); - source.put(ServiceEntryTable.COLUMN_REGISTER_TIME, data.getDataLong(0)); - source.put(ServiceEntryTable.COLUMN_NEWEST_TIME, data.getDataLong(1)); - return getClient().prepareIndex(ServiceEntryTable.TABLE, data.getDataString(0)).setSource(source); - } - - @Override public UpdateRequestBuilder prepareBatchUpdate(Data data) { - Map source = new HashMap<>(); - source.put(ServiceEntryTable.COLUMN_APPLICATION_ID, data.getDataInteger(0)); - source.put(ServiceEntryTable.COLUMN_ENTRY_SERVICE_ID, data.getDataInteger(1)); - source.put(ServiceEntryTable.COLUMN_ENTRY_SERVICE_NAME, data.getDataString(1)); - source.put(ServiceEntryTable.COLUMN_REGISTER_TIME, data.getDataLong(0)); - source.put(ServiceEntryTable.COLUMN_NEWEST_TIME, data.getDataLong(1)); - - return getClient().prepareUpdate(ServiceEntryTable.TABLE, data.getDataString(0)).setDoc(source); - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/service/entry/dao/ServiceEntryH2DAO.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/service/entry/dao/ServiceEntryH2DAO.java deleted file mode 100644 index 415a9f3c00..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/service/entry/dao/ServiceEntryH2DAO.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.worker.service.entry.dao; - -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import org.skywalking.apm.collector.client.h2.H2Client; -import org.skywalking.apm.collector.client.h2.H2ClientException; -import org.skywalking.apm.collector.core.stream.Data; -import org.skywalking.apm.collector.storage.base.define.DataDefine; -import org.skywalking.apm.collector.storage.base.define.service.ServiceEntryTable; -import org.skywalking.apm.collector.storage.h2.SqlBuilder; -import org.skywalking.apm.collector.storage.h2.base.dao.H2DAO; -import org.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; -import org.skywalking.apm.collector.stream.worker.impl.dao.IPersistenceDAO; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng, clevertension - */ -public class ServiceEntryH2DAO extends H2DAO implements IServiceEntryDAO, IPersistenceDAO { - private final Logger logger = LoggerFactory.getLogger(ServiceEntryH2DAO.class); - private static final String GET_SERVICE_ENTRY_SQL = "select * from {0} where {1} = ?"; - - @Override public Data get(String id, DataDefine dataDefine) { - H2Client client = getClient(); - String sql = SqlBuilder.buildSql(GET_SERVICE_ENTRY_SQL, ServiceEntryTable.TABLE, ServiceEntryTable.COLUMN_ID); - Object[] params = new Object[] {id}; - try (ResultSet rs = client.executeQuery(sql, params)) { - if (rs.next()) { - Data data = dataDefine.build(id); - data.setDataInteger(0, rs.getInt(ServiceEntryTable.COLUMN_APPLICATION_ID)); - data.setDataInteger(1, rs.getInt(ServiceEntryTable.COLUMN_ENTRY_SERVICE_ID)); - data.setDataString(1, rs.getString(ServiceEntryTable.COLUMN_ENTRY_SERVICE_NAME)); - data.setDataLong(0, rs.getLong(ServiceEntryTable.COLUMN_REGISTER_TIME)); - data.setDataLong(1, rs.getLong(ServiceEntryTable.COLUMN_NEWEST_TIME)); - return data; - } - } catch (SQLException | H2ClientException e) { - logger.error(e.getMessage(), e); - } - return null; - } - - @Override public H2SqlEntity prepareBatchInsert(Data data) { - H2SqlEntity entity = new H2SqlEntity(); - Map source = new HashMap<>(); - source.put(ServiceEntryTable.COLUMN_ID, data.getDataString(0)); - source.put(ServiceEntryTable.COLUMN_APPLICATION_ID, data.getDataInteger(0)); - source.put(ServiceEntryTable.COLUMN_ENTRY_SERVICE_ID, data.getDataInteger(1)); - source.put(ServiceEntryTable.COLUMN_ENTRY_SERVICE_NAME, data.getDataString(1)); - source.put(ServiceEntryTable.COLUMN_REGISTER_TIME, data.getDataLong(0)); - source.put(ServiceEntryTable.COLUMN_NEWEST_TIME, data.getDataLong(1)); - String sql = SqlBuilder.buildBatchInsertSql(ServiceEntryTable.TABLE, source.keySet()); - entity.setSql(sql); - entity.setParams(source.values().toArray(new Object[0])); - return entity; - } - - @Override public H2SqlEntity prepareBatchUpdate(Data data) { - H2SqlEntity entity = new H2SqlEntity(); - Map source = new HashMap<>(); - source.put(ServiceEntryTable.COLUMN_APPLICATION_ID, data.getDataInteger(0)); - source.put(ServiceEntryTable.COLUMN_ENTRY_SERVICE_ID, data.getDataInteger(1)); - source.put(ServiceEntryTable.COLUMN_ENTRY_SERVICE_NAME, data.getDataString(1)); - source.put(ServiceEntryTable.COLUMN_REGISTER_TIME, data.getDataLong(0)); - source.put(ServiceEntryTable.COLUMN_NEWEST_TIME, data.getDataLong(1)); - String id = data.getDataString(0); - String sql = SqlBuilder.buildBatchUpdateSql(ServiceEntryTable.TABLE, source.keySet(), ServiceEntryTable.COLUMN_ID); - entity.setSql(sql); - List values = new ArrayList<>(source.values()); - values.add(id); - entity.setParams(values.toArray(new Object[0])); - return entity; - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/service/entry/define/ServiceEntryEsTableDefine.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/service/entry/define/ServiceEntryEsTableDefine.java deleted file mode 100644 index 7abb59b127..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/service/entry/define/ServiceEntryEsTableDefine.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.worker.service.entry.define; - -import org.skywalking.apm.collector.storage.base.define.service.ServiceEntryTable; -import org.skywalking.apm.collector.storage.elasticsearch.define.ElasticSearchColumnDefine; -import org.skywalking.apm.collector.storage.elasticsearch.define.ElasticSearchTableDefine; - -/** - * @author peng-yongsheng - */ -public class ServiceEntryEsTableDefine extends ElasticSearchTableDefine { - - public ServiceEntryEsTableDefine() { - super(ServiceEntryTable.TABLE); - } - - @Override public int refreshInterval() { - return 2; - } - - @Override public void initialize() { - addColumn(new ElasticSearchColumnDefine(ServiceEntryTable.COLUMN_APPLICATION_ID, ElasticSearchColumnDefine.Type.Integer.name())); - addColumn(new ElasticSearchColumnDefine(ServiceEntryTable.COLUMN_ENTRY_SERVICE_ID, ElasticSearchColumnDefine.Type.Integer.name())); - addColumn(new ElasticSearchColumnDefine(ServiceEntryTable.COLUMN_ENTRY_SERVICE_NAME, ElasticSearchColumnDefine.Type.Text.name())); - addColumn(new ElasticSearchColumnDefine(ServiceEntryTable.COLUMN_REGISTER_TIME, ElasticSearchColumnDefine.Type.Long.name())); - addColumn(new ElasticSearchColumnDefine(ServiceEntryTable.COLUMN_NEWEST_TIME, ElasticSearchColumnDefine.Type.Long.name())); - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/service/entry/define/ServiceEntryH2TableDefine.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/service/entry/define/ServiceEntryH2TableDefine.java deleted file mode 100644 index e814f2f006..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/service/entry/define/ServiceEntryH2TableDefine.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.worker.service.entry.define; - -import org.skywalking.apm.collector.storage.base.define.service.ServiceEntryTable; -import org.skywalking.apm.collector.storage.h2.base.define.H2ColumnDefine; -import org.skywalking.apm.collector.storage.h2.base.define.H2TableDefine; - -/** - * @author peng-yongsheng - */ -public class ServiceEntryH2TableDefine extends H2TableDefine { - - public ServiceEntryH2TableDefine() { - super(ServiceEntryTable.TABLE); - } - - @Override public void initialize() { - addColumn(new H2ColumnDefine(ServiceEntryTable.COLUMN_ID, H2ColumnDefine.Type.Varchar.name())); - addColumn(new H2ColumnDefine(ServiceEntryTable.COLUMN_APPLICATION_ID, H2ColumnDefine.Type.Int.name())); - addColumn(new H2ColumnDefine(ServiceEntryTable.COLUMN_ENTRY_SERVICE_ID, H2ColumnDefine.Type.Int.name())); - addColumn(new H2ColumnDefine(ServiceEntryTable.COLUMN_ENTRY_SERVICE_NAME, H2ColumnDefine.Type.Varchar.name())); - addColumn(new H2ColumnDefine(ServiceEntryTable.COLUMN_REGISTER_TIME, H2ColumnDefine.Type.Bigint.name())); - addColumn(new H2ColumnDefine(ServiceEntryTable.COLUMN_NEWEST_TIME, H2ColumnDefine.Type.Bigint.name())); - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/serviceref/ServiceReferenceAggregationWorker.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/serviceref/ServiceReferenceAggregationWorker.java deleted file mode 100644 index d5e5d3eb6c..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/serviceref/ServiceReferenceAggregationWorker.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.worker.serviceref; - -import org.skywalking.apm.collector.storage.base.define.DataDefine; -import org.skywalking.apm.collector.storage.base.define.serviceref.ServiceReferenceDataDefine; -import org.skywalking.apm.collector.stream.worker.AbstractLocalAsyncWorkerProvider; -import org.skywalking.apm.collector.stream.worker.ClusterWorkerContext; -import org.skywalking.apm.collector.stream.worker.ProviderNotFoundException; -import org.skywalking.apm.collector.stream.worker.Role; -import org.skywalking.apm.collector.stream.worker.WorkerNotFoundException; -import org.skywalking.apm.collector.stream.worker.WorkerRefs; -import org.skywalking.apm.collector.stream.worker.impl.AggregationWorker; -import org.skywalking.apm.collector.stream.worker.selector.HashCodeSelector; -import org.skywalking.apm.collector.stream.worker.selector.WorkerSelector; - -/** - * @author peng-yongsheng - */ -public class ServiceReferenceAggregationWorker extends AggregationWorker { - - public ServiceReferenceAggregationWorker(Role role, ClusterWorkerContext clusterContext) { - super(role, clusterContext); - } - - @Override public void preStart() throws ProviderNotFoundException { - super.preStart(); - } - - @Override protected WorkerRefs nextWorkRef(String id) throws WorkerNotFoundException { - return getClusterContext().lookup(ServiceReferenceRemoteWorker.WorkerRole.INSTANCE); - } - - public static class Factory extends AbstractLocalAsyncWorkerProvider { - @Override - public Role role() { - return WorkerRole.INSTANCE; - } - - @Override - public ServiceReferenceAggregationWorker workerInstance(ClusterWorkerContext clusterContext) { - return new ServiceReferenceAggregationWorker(role(), clusterContext); - } - - @Override - public int queueSize() { - return 1024; - } - } - - public enum WorkerRole implements Role { - INSTANCE; - - @Override - public String roleName() { - return ServiceReferenceAggregationWorker.class.getSimpleName(); - } - - @Override - public WorkerSelector workerSelector() { - return new HashCodeSelector(); - } - - @Override public DataDefine dataDefine() { - return new ServiceReferenceDataDefine(); - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/serviceref/ServiceReferencePersistenceWorker.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/serviceref/ServiceReferencePersistenceWorker.java deleted file mode 100644 index 8bd2ab9e72..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/serviceref/ServiceReferencePersistenceWorker.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.worker.serviceref; - -import org.skywalking.apm.collector.agentstream.worker.serviceref.dao.IServiceReferenceDAO; -import org.skywalking.apm.collector.storage.base.dao.DAOContainer; -import org.skywalking.apm.collector.storage.base.define.DataDefine; -import org.skywalking.apm.collector.storage.base.define.serviceref.ServiceReferenceDataDefine; -import org.skywalking.apm.collector.stream.worker.AbstractLocalAsyncWorkerProvider; -import org.skywalking.apm.collector.stream.worker.ClusterWorkerContext; -import org.skywalking.apm.collector.stream.worker.ProviderNotFoundException; -import org.skywalking.apm.collector.stream.worker.Role; -import org.skywalking.apm.collector.stream.worker.impl.PersistenceWorker; -import org.skywalking.apm.collector.stream.worker.impl.dao.IPersistenceDAO; -import org.skywalking.apm.collector.stream.worker.selector.HashCodeSelector; -import org.skywalking.apm.collector.stream.worker.selector.WorkerSelector; - -/** - * @author peng-yongsheng - */ -public class ServiceReferencePersistenceWorker extends PersistenceWorker { - - public ServiceReferencePersistenceWorker(Role role, ClusterWorkerContext clusterContext) { - super(role, clusterContext); - } - - @Override public void preStart() throws ProviderNotFoundException { - super.preStart(); - } - - @Override protected boolean needMergeDBData() { - return true; - } - - @Override protected IPersistenceDAO persistenceDAO() { - return (IPersistenceDAO)DAOContainer.INSTANCE.get(IServiceReferenceDAO.class.getName()); - } - - public static class Factory extends AbstractLocalAsyncWorkerProvider { - @Override - public Role role() { - return WorkerRole.INSTANCE; - } - - @Override - public ServiceReferencePersistenceWorker workerInstance(ClusterWorkerContext clusterContext) { - return new ServiceReferencePersistenceWorker(role(), clusterContext); - } - - @Override - public int queueSize() { - return 1024; - } - } - - public enum WorkerRole implements Role { - INSTANCE; - - @Override - public String roleName() { - return ServiceReferencePersistenceWorker.class.getSimpleName(); - } - - @Override - public WorkerSelector workerSelector() { - return new HashCodeSelector(); - } - - @Override public DataDefine dataDefine() { - return new ServiceReferenceDataDefine(); - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/serviceref/ServiceReferenceRemoteWorker.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/serviceref/ServiceReferenceRemoteWorker.java deleted file mode 100644 index 7aa6e97f7f..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/serviceref/ServiceReferenceRemoteWorker.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.worker.serviceref; - -import org.skywalking.apm.collector.storage.base.define.DataDefine; -import org.skywalking.apm.collector.storage.base.define.serviceref.ServiceReferenceDataDefine; -import org.skywalking.apm.collector.stream.worker.AbstractRemoteWorker; -import org.skywalking.apm.collector.stream.worker.AbstractRemoteWorkerProvider; -import org.skywalking.apm.collector.stream.worker.ClusterWorkerContext; -import org.skywalking.apm.collector.stream.worker.ProviderNotFoundException; -import org.skywalking.apm.collector.stream.worker.Role; -import org.skywalking.apm.collector.stream.worker.WorkerException; -import org.skywalking.apm.collector.stream.worker.selector.HashCodeSelector; -import org.skywalking.apm.collector.stream.worker.selector.WorkerSelector; - -/** - * @author peng-yongsheng - */ -public class ServiceReferenceRemoteWorker extends AbstractRemoteWorker { - - protected ServiceReferenceRemoteWorker(Role role, ClusterWorkerContext clusterContext) { - super(role, clusterContext); - } - - @Override public void preStart() throws ProviderNotFoundException { - - } - - @Override protected void onWork(Object message) throws WorkerException { - getClusterContext().lookup(ServiceReferencePersistenceWorker.WorkerRole.INSTANCE).tell(message); - } - - public static class Factory extends AbstractRemoteWorkerProvider { - @Override - public Role role() { - return WorkerRole.INSTANCE; - } - - @Override - public ServiceReferenceRemoteWorker workerInstance(ClusterWorkerContext clusterContext) { - return new ServiceReferenceRemoteWorker(role(), clusterContext); - } - } - - public enum WorkerRole implements Role { - INSTANCE; - - @Override - public String roleName() { - return ServiceReferenceRemoteWorker.class.getSimpleName(); - } - - @Override - public WorkerSelector workerSelector() { - return new HashCodeSelector(); - } - - @Override public DataDefine dataDefine() { - return new ServiceReferenceDataDefine(); - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/serviceref/ServiceReferenceSpanListener.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/serviceref/ServiceReferenceSpanListener.java deleted file mode 100644 index 0115fc58e5..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/serviceref/ServiceReferenceSpanListener.java +++ /dev/null @@ -1,149 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.worker.serviceref; - -import java.util.LinkedList; -import java.util.List; -import org.skywalking.apm.collector.agentstream.worker.segment.EntrySpanListener; -import org.skywalking.apm.collector.agentstream.worker.segment.FirstSpanListener; -import org.skywalking.apm.collector.agentstream.worker.segment.RefsListener; -import org.skywalking.apm.collector.agentstream.worker.segment.standardization.ReferenceDecorator; -import org.skywalking.apm.collector.agentstream.worker.segment.standardization.SpanDecorator; -import org.skywalking.apm.collector.core.framework.CollectorContextHelper; -import org.skywalking.apm.collector.core.util.Const; -import org.skywalking.apm.collector.core.util.TimeBucketUtils; -import org.skywalking.apm.collector.storage.base.define.serviceref.ServiceReferenceDataDefine; -import org.skywalking.apm.collector.stream.StreamModuleContext; -import org.skywalking.apm.collector.stream.StreamModuleGroupDefine; -import org.skywalking.apm.collector.stream.worker.WorkerInvokeException; -import org.skywalking.apm.collector.stream.worker.WorkerNotFoundException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class ServiceReferenceSpanListener implements FirstSpanListener, EntrySpanListener, RefsListener { - - private final Logger logger = LoggerFactory.getLogger(ServiceReferenceSpanListener.class); - - private List referenceServices = new LinkedList<>(); - private int serviceId = 0; - private long startTime = 0; - private long endTime = 0; - private boolean isError = false; - private long timeBucket; - private boolean hasEntry = false; - - @Override - public void parseFirst(SpanDecorator spanDecorator, int applicationId, int applicationInstanceId, - String segmentId) { - timeBucket = TimeBucketUtils.INSTANCE.getMinuteTimeBucket(spanDecorator.getStartTime()); - } - - @Override public void parseRef(ReferenceDecorator referenceDecorator, int applicationId, int applicationInstanceId, - String segmentId) { - referenceServices.add(referenceDecorator); - } - - @Override - public void parseEntry(SpanDecorator spanDecorator, int applicationId, int applicationInstanceId, - String segmentId) { - serviceId = spanDecorator.getOperationNameId(); - startTime = spanDecorator.getStartTime(); - endTime = spanDecorator.getEndTime(); - isError = spanDecorator.getIsError(); - this.hasEntry = true; - } - - private void calculateCost(ServiceReferenceDataDefine.ServiceReference serviceReference, long startTime, - long endTime, - boolean isError) { - long cost = endTime - startTime; - if (cost <= 1000 && !isError) { - serviceReference.setS1Lte(1); - } else if (1000 < cost && cost <= 3000 && !isError) { - serviceReference.setS3Lte(1); - } else if (3000 < cost && cost <= 5000 && !isError) { - serviceReference.setS5Lte(1); - } else if (5000 < cost && !isError) { - serviceReference.setS5Gt(1); - } else { - serviceReference.setError(1); - } - serviceReference.setSummary(1); - serviceReference.setCostSummary(cost); - } - - @Override public void build() { - logger.debug("service reference listener build"); - if (hasEntry) { - StreamModuleContext context = (StreamModuleContext)CollectorContextHelper.INSTANCE.getContext(StreamModuleGroupDefine.GROUP_NAME); - - if (referenceServices.size() > 0) { - referenceServices.forEach(reference -> { - ServiceReferenceDataDefine.ServiceReference serviceReference = new ServiceReferenceDataDefine.ServiceReference(); - int entryServiceId = reference.getEntryServiceId(); - int frontServiceId = reference.getParentServiceId(); - int behindServiceId = serviceId; - calculateCost(serviceReference, startTime, endTime, isError); - - logger.debug("has reference, entryServiceId: {}", entryServiceId); - sendToAggregationWorker(context, serviceReference, entryServiceId, frontServiceId, behindServiceId); - }); - } else { - ServiceReferenceDataDefine.ServiceReference serviceReference = new ServiceReferenceDataDefine.ServiceReference(); - int entryServiceId = serviceId; - int frontServiceId = Const.NONE_SERVICE_ID; - int behindServiceId = serviceId; - - calculateCost(serviceReference, startTime, endTime, isError); - sendToAggregationWorker(context, serviceReference, entryServiceId, frontServiceId, behindServiceId); - } - } - } - - private void sendToAggregationWorker(StreamModuleContext context, - ServiceReferenceDataDefine.ServiceReference serviceReference, int entryServiceId, int frontServiceId, - int behindServiceId) { - StringBuilder idBuilder = new StringBuilder(); - idBuilder.append(timeBucket).append(Const.ID_SPLIT); - - idBuilder.append(entryServiceId).append(Const.ID_SPLIT); - serviceReference.setEntryServiceId(entryServiceId); - serviceReference.setEntryServiceName(Const.EMPTY_STRING); - - idBuilder.append(frontServiceId).append(Const.ID_SPLIT); - serviceReference.setFrontServiceId(frontServiceId); - serviceReference.setFrontServiceName(Const.EMPTY_STRING); - - idBuilder.append(behindServiceId); - serviceReference.setBehindServiceId(behindServiceId); - serviceReference.setBehindServiceName(Const.EMPTY_STRING); - - serviceReference.setId(idBuilder.toString()); - serviceReference.setTimeBucket(timeBucket); - try { - logger.debug("send to service reference aggregation worker, id: {}", serviceReference.getId()); - context.getClusterWorkerContext().lookup(ServiceReferenceAggregationWorker.WorkerRole.INSTANCE).tell(serviceReference.toData()); - } catch (WorkerInvokeException | WorkerNotFoundException e) { - logger.error(e.getMessage(), e); - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/serviceref/dao/IServiceReferenceDAO.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/serviceref/dao/IServiceReferenceDAO.java deleted file mode 100644 index 15c9e4a4a0..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/serviceref/dao/IServiceReferenceDAO.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.worker.serviceref.dao; - -/** - * @author peng-yongsheng - */ -public interface IServiceReferenceDAO { -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/serviceref/dao/ServiceReferenceEsDAO.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/serviceref/dao/ServiceReferenceEsDAO.java deleted file mode 100644 index e60d1eed94..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/serviceref/dao/ServiceReferenceEsDAO.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.worker.serviceref.dao; - -import java.util.HashMap; -import java.util.Map; -import org.elasticsearch.action.get.GetResponse; -import org.elasticsearch.action.index.IndexRequestBuilder; -import org.elasticsearch.action.update.UpdateRequestBuilder; -import org.skywalking.apm.collector.core.stream.Data; -import org.skywalking.apm.collector.storage.base.define.DataDefine; -import org.skywalking.apm.collector.storage.base.define.serviceref.ServiceReferenceTable; -import org.skywalking.apm.collector.storage.elasticsearch.dao.EsDAO; -import org.skywalking.apm.collector.stream.worker.impl.dao.IPersistenceDAO; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class ServiceReferenceEsDAO extends EsDAO implements IServiceReferenceDAO, IPersistenceDAO { - - private final Logger logger = LoggerFactory.getLogger(ServiceReferenceEsDAO.class); - - @Override public Data get(String id, DataDefine dataDefine) { - GetResponse getResponse = getClient().prepareGet(ServiceReferenceTable.TABLE, id).get(); - if (getResponse.isExists()) { - Data data = dataDefine.build(id); - Map source = getResponse.getSource(); - data.setDataInteger(0, ((Number)source.get(ServiceReferenceTable.COLUMN_ENTRY_SERVICE_ID)).intValue()); - data.setDataString(1, (String)source.get(ServiceReferenceTable.COLUMN_ENTRY_SERVICE_NAME)); - data.setDataInteger(1, ((Number)source.get(ServiceReferenceTable.COLUMN_FRONT_SERVICE_ID)).intValue()); - data.setDataString(2, (String)source.get(ServiceReferenceTable.COLUMN_FRONT_SERVICE_NAME)); - data.setDataInteger(2, ((Number)source.get(ServiceReferenceTable.COLUMN_BEHIND_SERVICE_ID)).intValue()); - data.setDataString(3, (String)source.get(ServiceReferenceTable.COLUMN_BEHIND_SERVICE_NAME)); - data.setDataLong(0, ((Number)source.get(ServiceReferenceTable.COLUMN_S1_LTE)).longValue()); - data.setDataLong(1, ((Number)source.get(ServiceReferenceTable.COLUMN_S3_LTE)).longValue()); - data.setDataLong(2, ((Number)source.get(ServiceReferenceTable.COLUMN_S5_LTE)).longValue()); - data.setDataLong(3, ((Number)source.get(ServiceReferenceTable.COLUMN_S5_GT)).longValue()); - data.setDataLong(4, ((Number)source.get(ServiceReferenceTable.COLUMN_SUMMARY)).longValue()); - data.setDataLong(5, ((Number)source.get(ServiceReferenceTable.COLUMN_ERROR)).longValue()); - data.setDataLong(6, ((Number)source.get(ServiceReferenceTable.COLUMN_COST_SUMMARY)).longValue()); - data.setDataLong(7, ((Number)source.get(ServiceReferenceTable.COLUMN_TIME_BUCKET)).longValue()); - return data; - } else { - return null; - } - } - - @Override public IndexRequestBuilder prepareBatchInsert(Data data) { - Map source = new HashMap<>(); - source.put(ServiceReferenceTable.COLUMN_ENTRY_SERVICE_ID, data.getDataInteger(0)); - source.put(ServiceReferenceTable.COLUMN_ENTRY_SERVICE_NAME, data.getDataString(1)); - source.put(ServiceReferenceTable.COLUMN_FRONT_SERVICE_ID, data.getDataInteger(1)); - source.put(ServiceReferenceTable.COLUMN_FRONT_SERVICE_NAME, data.getDataString(2)); - source.put(ServiceReferenceTable.COLUMN_BEHIND_SERVICE_ID, data.getDataInteger(2)); - source.put(ServiceReferenceTable.COLUMN_BEHIND_SERVICE_NAME, data.getDataString(3)); - source.put(ServiceReferenceTable.COLUMN_S1_LTE, data.getDataLong(0)); - source.put(ServiceReferenceTable.COLUMN_S3_LTE, data.getDataLong(1)); - source.put(ServiceReferenceTable.COLUMN_S5_LTE, data.getDataLong(2)); - source.put(ServiceReferenceTable.COLUMN_S5_GT, data.getDataLong(3)); - source.put(ServiceReferenceTable.COLUMN_SUMMARY, data.getDataLong(4)); - source.put(ServiceReferenceTable.COLUMN_ERROR, data.getDataLong(5)); - source.put(ServiceReferenceTable.COLUMN_COST_SUMMARY, data.getDataLong(6)); - source.put(ServiceReferenceTable.COLUMN_TIME_BUCKET, data.getDataLong(7)); - - return getClient().prepareIndex(ServiceReferenceTable.TABLE, data.getDataString(0)).setSource(source); - } - - @Override public UpdateRequestBuilder prepareBatchUpdate(Data data) { - Map source = new HashMap<>(); - source.put(ServiceReferenceTable.COLUMN_ENTRY_SERVICE_ID, data.getDataInteger(0)); - source.put(ServiceReferenceTable.COLUMN_ENTRY_SERVICE_NAME, data.getDataString(1)); - source.put(ServiceReferenceTable.COLUMN_FRONT_SERVICE_ID, data.getDataInteger(1)); - source.put(ServiceReferenceTable.COLUMN_FRONT_SERVICE_NAME, data.getDataString(2)); - source.put(ServiceReferenceTable.COLUMN_BEHIND_SERVICE_ID, data.getDataInteger(2)); - source.put(ServiceReferenceTable.COLUMN_BEHIND_SERVICE_NAME, data.getDataString(3)); - source.put(ServiceReferenceTable.COLUMN_S1_LTE, data.getDataLong(0)); - source.put(ServiceReferenceTable.COLUMN_S3_LTE, data.getDataLong(1)); - source.put(ServiceReferenceTable.COLUMN_S5_LTE, data.getDataLong(2)); - source.put(ServiceReferenceTable.COLUMN_S5_GT, data.getDataLong(3)); - source.put(ServiceReferenceTable.COLUMN_SUMMARY, data.getDataLong(4)); - source.put(ServiceReferenceTable.COLUMN_ERROR, data.getDataLong(5)); - source.put(ServiceReferenceTable.COLUMN_COST_SUMMARY, data.getDataLong(6)); - source.put(ServiceReferenceTable.COLUMN_TIME_BUCKET, data.getDataLong(7)); - - return getClient().prepareUpdate(ServiceReferenceTable.TABLE, data.getDataString(0)).setDoc(source); - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/serviceref/dao/ServiceReferenceH2DAO.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/serviceref/dao/ServiceReferenceH2DAO.java deleted file mode 100644 index 2095f4958d..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/serviceref/dao/ServiceReferenceH2DAO.java +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.worker.serviceref.dao; - -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import org.skywalking.apm.collector.client.h2.H2Client; -import org.skywalking.apm.collector.client.h2.H2ClientException; -import org.skywalking.apm.collector.core.stream.Data; -import org.skywalking.apm.collector.storage.base.define.DataDefine; -import org.skywalking.apm.collector.storage.base.define.serviceref.ServiceReferenceTable; -import org.skywalking.apm.collector.storage.h2.SqlBuilder; -import org.skywalking.apm.collector.storage.h2.base.dao.H2DAO; -import org.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; -import org.skywalking.apm.collector.stream.worker.impl.dao.IPersistenceDAO; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng, clevertension - */ -public class ServiceReferenceH2DAO extends H2DAO implements IServiceReferenceDAO, IPersistenceDAO { - private final Logger logger = LoggerFactory.getLogger(ServiceReferenceH2DAO.class); - private static final String GET_SQL = "select * from {0} where {1} = ?"; - - @Override - public Data get(String id, DataDefine dataDefine) { - H2Client client = getClient(); - String sql = SqlBuilder.buildSql(GET_SQL, ServiceReferenceTable.TABLE, ServiceReferenceTable.COLUMN_ID); - Object[] params = new Object[] {id}; - try (ResultSet rs = client.executeQuery(sql, params)) { - if (rs.next()) { - Data data = dataDefine.build(id); - data.setDataInteger(0, rs.getInt(ServiceReferenceTable.COLUMN_ENTRY_SERVICE_ID)); - data.setDataString(1, rs.getString(ServiceReferenceTable.COLUMN_ENTRY_SERVICE_NAME)); - data.setDataInteger(1, rs.getInt(ServiceReferenceTable.COLUMN_FRONT_SERVICE_ID)); - data.setDataString(2, rs.getString(ServiceReferenceTable.COLUMN_FRONT_SERVICE_NAME)); - data.setDataInteger(2, rs.getInt(ServiceReferenceTable.COLUMN_BEHIND_SERVICE_ID)); - data.setDataString(3, rs.getString(ServiceReferenceTable.COLUMN_BEHIND_SERVICE_NAME)); - data.setDataLong(0, rs.getLong(ServiceReferenceTable.COLUMN_S1_LTE)); - data.setDataLong(1, rs.getLong(ServiceReferenceTable.COLUMN_S3_LTE)); - data.setDataLong(2, rs.getLong(ServiceReferenceTable.COLUMN_S5_LTE)); - data.setDataLong(3, rs.getLong(ServiceReferenceTable.COLUMN_S5_GT)); - data.setDataLong(4, rs.getLong(ServiceReferenceTable.COLUMN_SUMMARY)); - data.setDataLong(5, rs.getLong(ServiceReferenceTable.COLUMN_ERROR)); - data.setDataLong(6, rs.getLong(ServiceReferenceTable.COLUMN_COST_SUMMARY)); - data.setDataLong(7, rs.getLong(ServiceReferenceTable.COLUMN_TIME_BUCKET)); - return data; - } - } catch (SQLException | H2ClientException e) { - logger.error(e.getMessage(), e); - } - return null; - } - - @Override - public H2SqlEntity prepareBatchInsert(Data data) { - H2SqlEntity entity = new H2SqlEntity(); - Map source = new HashMap<>(); - source.put(ServiceReferenceTable.COLUMN_ID, data.getDataString(0)); - source.put(ServiceReferenceTable.COLUMN_ENTRY_SERVICE_ID, data.getDataInteger(0)); - source.put(ServiceReferenceTable.COLUMN_ENTRY_SERVICE_NAME, data.getDataString(1)); - source.put(ServiceReferenceTable.COLUMN_FRONT_SERVICE_ID, data.getDataInteger(1)); - source.put(ServiceReferenceTable.COLUMN_FRONT_SERVICE_NAME, data.getDataString(2)); - source.put(ServiceReferenceTable.COLUMN_BEHIND_SERVICE_ID, data.getDataInteger(2)); - source.put(ServiceReferenceTable.COLUMN_BEHIND_SERVICE_NAME, data.getDataString(3)); - source.put(ServiceReferenceTable.COLUMN_S1_LTE, data.getDataLong(0)); - source.put(ServiceReferenceTable.COLUMN_S3_LTE, data.getDataLong(1)); - source.put(ServiceReferenceTable.COLUMN_S5_LTE, data.getDataLong(2)); - source.put(ServiceReferenceTable.COLUMN_S5_GT, data.getDataLong(3)); - source.put(ServiceReferenceTable.COLUMN_SUMMARY, data.getDataLong(4)); - source.put(ServiceReferenceTable.COLUMN_ERROR, data.getDataLong(5)); - source.put(ServiceReferenceTable.COLUMN_COST_SUMMARY, data.getDataLong(6)); - source.put(ServiceReferenceTable.COLUMN_TIME_BUCKET, data.getDataLong(7)); - - String sql = SqlBuilder.buildBatchInsertSql(ServiceReferenceTable.TABLE, source.keySet()); - entity.setSql(sql); - entity.setParams(source.values().toArray(new Object[0])); - return entity; - } - - @Override - public H2SqlEntity prepareBatchUpdate(Data data) { - H2SqlEntity entity = new H2SqlEntity(); - Map source = new HashMap<>(); - source.put(ServiceReferenceTable.COLUMN_ENTRY_SERVICE_ID, data.getDataInteger(0)); - source.put(ServiceReferenceTable.COLUMN_ENTRY_SERVICE_NAME, data.getDataString(1)); - source.put(ServiceReferenceTable.COLUMN_FRONT_SERVICE_ID, data.getDataInteger(1)); - source.put(ServiceReferenceTable.COLUMN_FRONT_SERVICE_NAME, data.getDataString(2)); - source.put(ServiceReferenceTable.COLUMN_BEHIND_SERVICE_ID, data.getDataInteger(2)); - source.put(ServiceReferenceTable.COLUMN_BEHIND_SERVICE_NAME, data.getDataString(3)); - source.put(ServiceReferenceTable.COLUMN_S1_LTE, data.getDataLong(0)); - source.put(ServiceReferenceTable.COLUMN_S3_LTE, data.getDataLong(1)); - source.put(ServiceReferenceTable.COLUMN_S5_LTE, data.getDataLong(2)); - source.put(ServiceReferenceTable.COLUMN_S5_GT, data.getDataLong(3)); - source.put(ServiceReferenceTable.COLUMN_SUMMARY, data.getDataLong(4)); - source.put(ServiceReferenceTable.COLUMN_ERROR, data.getDataLong(5)); - source.put(ServiceReferenceTable.COLUMN_COST_SUMMARY, data.getDataLong(6)); - source.put(ServiceReferenceTable.COLUMN_TIME_BUCKET, data.getDataLong(7)); - - String id = data.getDataString(0); - String sql = SqlBuilder.buildBatchUpdateSql(ServiceReferenceTable.TABLE, source.keySet(), ServiceReferenceTable.COLUMN_ID); - entity.setSql(sql); - List values = new ArrayList<>(source.values()); - values.add(id); - entity.setParams(values.toArray(new Object[0])); - return entity; - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/serviceref/define/ServiceReferenceEsTableDefine.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/serviceref/define/ServiceReferenceEsTableDefine.java deleted file mode 100644 index bcd04c2d2f..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/serviceref/define/ServiceReferenceEsTableDefine.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.worker.serviceref.define; - -import org.skywalking.apm.collector.storage.base.define.serviceref.ServiceReferenceTable; -import org.skywalking.apm.collector.storage.elasticsearch.define.ElasticSearchColumnDefine; -import org.skywalking.apm.collector.storage.elasticsearch.define.ElasticSearchTableDefine; - -/** - * @author peng-yongsheng - */ -public class ServiceReferenceEsTableDefine extends ElasticSearchTableDefine { - - public ServiceReferenceEsTableDefine() { - super(ServiceReferenceTable.TABLE); - } - - @Override public int refreshInterval() { - return 2; - } - - @Override public void initialize() { - addColumn(new ElasticSearchColumnDefine(ServiceReferenceTable.COLUMN_AGG, ElasticSearchColumnDefine.Type.Keyword.name())); - addColumn(new ElasticSearchColumnDefine(ServiceReferenceTable.COLUMN_ENTRY_SERVICE_ID, ElasticSearchColumnDefine.Type.Integer.name())); - addColumn(new ElasticSearchColumnDefine(ServiceReferenceTable.COLUMN_ENTRY_SERVICE_NAME, ElasticSearchColumnDefine.Type.Keyword.name())); - addColumn(new ElasticSearchColumnDefine(ServiceReferenceTable.COLUMN_FRONT_SERVICE_ID, ElasticSearchColumnDefine.Type.Integer.name())); - addColumn(new ElasticSearchColumnDefine(ServiceReferenceTable.COLUMN_FRONT_SERVICE_NAME, ElasticSearchColumnDefine.Type.Keyword.name())); - addColumn(new ElasticSearchColumnDefine(ServiceReferenceTable.COLUMN_BEHIND_SERVICE_ID, ElasticSearchColumnDefine.Type.Integer.name())); - addColumn(new ElasticSearchColumnDefine(ServiceReferenceTable.COLUMN_BEHIND_SERVICE_NAME, ElasticSearchColumnDefine.Type.Keyword.name())); - addColumn(new ElasticSearchColumnDefine(ServiceReferenceTable.COLUMN_S1_LTE, ElasticSearchColumnDefine.Type.Long.name())); - addColumn(new ElasticSearchColumnDefine(ServiceReferenceTable.COLUMN_S3_LTE, ElasticSearchColumnDefine.Type.Long.name())); - addColumn(new ElasticSearchColumnDefine(ServiceReferenceTable.COLUMN_S5_LTE, ElasticSearchColumnDefine.Type.Long.name())); - addColumn(new ElasticSearchColumnDefine(ServiceReferenceTable.COLUMN_S5_GT, ElasticSearchColumnDefine.Type.Long.name())); - addColumn(new ElasticSearchColumnDefine(ServiceReferenceTable.COLUMN_SUMMARY, ElasticSearchColumnDefine.Type.Long.name())); - addColumn(new ElasticSearchColumnDefine(ServiceReferenceTable.COLUMN_ERROR, ElasticSearchColumnDefine.Type.Long.name())); - addColumn(new ElasticSearchColumnDefine(ServiceReferenceTable.COLUMN_COST_SUMMARY, ElasticSearchColumnDefine.Type.Long.name())); - addColumn(new ElasticSearchColumnDefine(ServiceReferenceTable.COLUMN_TIME_BUCKET, ElasticSearchColumnDefine.Type.Long.name())); - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/serviceref/define/ServiceReferenceH2TableDefine.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/serviceref/define/ServiceReferenceH2TableDefine.java deleted file mode 100644 index fc344793fe..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/serviceref/define/ServiceReferenceH2TableDefine.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.worker.serviceref.define; - -import org.skywalking.apm.collector.storage.base.define.serviceref.ServiceReferenceTable; -import org.skywalking.apm.collector.storage.h2.base.define.H2ColumnDefine; -import org.skywalking.apm.collector.storage.h2.base.define.H2TableDefine; - -/** - * @author peng-yongsheng - */ -public class ServiceReferenceH2TableDefine extends H2TableDefine { - - public ServiceReferenceH2TableDefine() { - super(ServiceReferenceTable.TABLE); - } - - @Override public void initialize() { - addColumn(new H2ColumnDefine(ServiceReferenceTable.COLUMN_ID, H2ColumnDefine.Type.Varchar.name())); - addColumn(new H2ColumnDefine(ServiceReferenceTable.COLUMN_ENTRY_SERVICE_ID, H2ColumnDefine.Type.Int.name())); - addColumn(new H2ColumnDefine(ServiceReferenceTable.COLUMN_ENTRY_SERVICE_NAME, H2ColumnDefine.Type.Varchar.name())); - addColumn(new H2ColumnDefine(ServiceReferenceTable.COLUMN_FRONT_SERVICE_ID, H2ColumnDefine.Type.Int.name())); - addColumn(new H2ColumnDefine(ServiceReferenceTable.COLUMN_FRONT_SERVICE_NAME, H2ColumnDefine.Type.Varchar.name())); - addColumn(new H2ColumnDefine(ServiceReferenceTable.COLUMN_BEHIND_SERVICE_ID, H2ColumnDefine.Type.Int.name())); - addColumn(new H2ColumnDefine(ServiceReferenceTable.COLUMN_BEHIND_SERVICE_NAME, H2ColumnDefine.Type.Varchar.name())); - addColumn(new H2ColumnDefine(ServiceReferenceTable.COLUMN_S1_LTE, H2ColumnDefine.Type.Bigint.name())); - addColumn(new H2ColumnDefine(ServiceReferenceTable.COLUMN_S3_LTE, H2ColumnDefine.Type.Bigint.name())); - addColumn(new H2ColumnDefine(ServiceReferenceTable.COLUMN_S5_LTE, H2ColumnDefine.Type.Bigint.name())); - addColumn(new H2ColumnDefine(ServiceReferenceTable.COLUMN_S5_GT, H2ColumnDefine.Type.Bigint.name())); - addColumn(new H2ColumnDefine(ServiceReferenceTable.COLUMN_SUMMARY, H2ColumnDefine.Type.Bigint.name())); - addColumn(new H2ColumnDefine(ServiceReferenceTable.COLUMN_ERROR, H2ColumnDefine.Type.Bigint.name())); - addColumn(new H2ColumnDefine(ServiceReferenceTable.COLUMN_COST_SUMMARY, H2ColumnDefine.Type.Bigint.name())); - addColumn(new H2ColumnDefine(ServiceReferenceTable.COLUMN_TIME_BUCKET, H2ColumnDefine.Type.Bigint.name())); - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/storage/PersistenceTimer.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/storage/PersistenceTimer.java deleted file mode 100644 index 475a339619..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/storage/PersistenceTimer.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.worker.storage; - -import java.util.ArrayList; -import java.util.List; -import java.util.concurrent.Executors; -import java.util.concurrent.TimeUnit; -import org.skywalking.apm.collector.core.framework.Starter; -import org.skywalking.apm.collector.storage.base.dao.DAOContainer; -import org.skywalking.apm.collector.storage.base.dao.IBatchDAO; -import org.skywalking.apm.collector.stream.worker.WorkerException; -import org.skywalking.apm.collector.stream.worker.impl.FlushAndSwitch; -import org.skywalking.apm.collector.stream.worker.impl.PersistenceWorker; -import org.skywalking.apm.collector.stream.worker.impl.PersistenceWorkerContainer; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class PersistenceTimer implements Starter { - - private final Logger logger = LoggerFactory.getLogger(PersistenceTimer.class); - - public void start() { - logger.info("persistence timer start"); - //TODO timer value config -// final long timeInterval = EsConfig.Es.Persistence.Timer.VALUE * 1000; - final long timeInterval = 3; - Executors.newSingleThreadScheduledExecutor().scheduleAtFixedRate(() -> extractDataAndSave(), 1, timeInterval, TimeUnit.SECONDS); - } - - private void extractDataAndSave() { - try { - List workers = PersistenceWorkerContainer.INSTANCE.getPersistenceWorkers(); - List batchAllCollection = new ArrayList<>(); - workers.forEach((PersistenceWorker worker) -> { - logger.debug("extract {} worker data and save", worker.getRole().roleName()); - try { - worker.allocateJob(new FlushAndSwitch()); - List batchCollection = worker.buildBatchCollection(); - logger.debug("extract {} worker data size: {}", worker.getRole().roleName(), batchCollection.size()); - batchAllCollection.addAll(batchCollection); - } catch (WorkerException e) { - logger.error(e.getMessage(), e); - } - }); - - IBatchDAO dao = (IBatchDAO)DAOContainer.INSTANCE.get(IBatchDAO.class.getName()); - dao.batchPersistence(batchAllCollection); - } catch (Throwable e) { - logger.error(e.getMessage(), e); - } finally { - logger.debug("persistence data save finish"); - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/util/FileUtils.java b/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/util/FileUtils.java deleted file mode 100644 index 08e79cb6d4..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/java/org/skywalking/apm/collector/agentstream/worker/util/FileUtils.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.worker.util; - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.RandomAccessFile; -import org.skywalking.apm.collector.core.util.Const; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public enum FileUtils { - INSTANCE; - - private final Logger logger = LoggerFactory.getLogger(FileUtils.class); - - public String readLastLine(File file) { - RandomAccessFile randomAccessFile = null; - try { - randomAccessFile = new RandomAccessFile(file, "r"); - long length = randomAccessFile.length(); - if (length == 0) { - return Const.EMPTY_STRING; - } else { - long position = length - 1; - randomAccessFile.seek(position); - while (position >= 0) { - if (randomAccessFile.read() == '\n') { - return randomAccessFile.readLine(); - } - randomAccessFile.seek(position); - if (position == 0) { - return randomAccessFile.readLine(); - } - position--; - } - } - } catch (IOException e) { - logger.error(e.getMessage(), e); - } finally { - if (randomAccessFile != null) { - try { - randomAccessFile.close(); - } catch (IOException e) { - logger.error(e.getMessage(), e); - } - } - } - return Const.EMPTY_STRING; - } - - public void writeAppendToLast(File file, RandomAccessFile randomAccessFile, String value) { - if (randomAccessFile == null) { - try { - randomAccessFile = new RandomAccessFile(file, "rwd"); - } catch (FileNotFoundException e) { - logger.error(e.getMessage(), e); - } - } - try { - long length = randomAccessFile.length(); - randomAccessFile.seek(length); - randomAccessFile.writeBytes(System.lineSeparator()); - randomAccessFile.writeBytes(value); - } catch (IOException e) { - logger.error(e.getMessage(), e); - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/resources/META-INF/defines/es_dao.define b/apm-collector-3.2.3/apm-collector-agentstream/src/main/resources/META-INF/defines/es_dao.define deleted file mode 100644 index 5f55512c33..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/resources/META-INF/defines/es_dao.define +++ /dev/null @@ -1,9 +0,0 @@ -org.skywalking.apm.collector.agentstream.worker.node.component.dao.NodeComponentEsDAO -org.skywalking.apm.collector.agentstream.worker.node.mapping.dao.NodeMappingEsDAO -org.skywalking.apm.collector.agentstream.worker.noderef.dao.NodeReferenceEsDAO -org.skywalking.apm.collector.agentstream.worker.segment.origin.dao.SegmentEsDAO -org.skywalking.apm.collector.agentstream.worker.segment.cost.dao.SegmentCostEsDAO -org.skywalking.apm.collector.agentstream.worker.global.dao.GlobalTraceEsDAO -org.skywalking.apm.collector.agentstream.worker.service.entry.dao.ServiceEntryEsDAO -org.skywalking.apm.collector.agentstream.worker.serviceref.dao.ServiceReferenceEsDAO -org.skywalking.apm.collector.agentstream.worker.instance.performance.dao.InstPerformanceEsDAO \ No newline at end of file diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/resources/META-INF/defines/group.define b/apm-collector-3.2.3/apm-collector-agentstream/src/main/resources/META-INF/defines/group.define deleted file mode 100644 index 2c200d4845..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/resources/META-INF/defines/group.define +++ /dev/null @@ -1 +0,0 @@ -org.skywalking.apm.collector.agentstream.AgentStreamModuleGroupDefine \ No newline at end of file diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/resources/META-INF/defines/h2_dao.define b/apm-collector-3.2.3/apm-collector-agentstream/src/main/resources/META-INF/defines/h2_dao.define deleted file mode 100644 index b1064d603c..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/resources/META-INF/defines/h2_dao.define +++ /dev/null @@ -1,9 +0,0 @@ -org.skywalking.apm.collector.agentstream.worker.node.component.dao.NodeComponentH2DAO -org.skywalking.apm.collector.agentstream.worker.node.mapping.dao.NodeMappingH2DAO -org.skywalking.apm.collector.agentstream.worker.noderef.dao.NodeReferenceH2DAO -org.skywalking.apm.collector.agentstream.worker.segment.origin.dao.SegmentH2DAO -org.skywalking.apm.collector.agentstream.worker.segment.cost.dao.SegmentCostH2DAO -org.skywalking.apm.collector.agentstream.worker.global.dao.GlobalTraceH2DAO -org.skywalking.apm.collector.agentstream.worker.service.entry.dao.ServiceEntryH2DAO -org.skywalking.apm.collector.agentstream.worker.serviceref.dao.ServiceReferenceH2DAO -org.skywalking.apm.collector.agentstream.worker.instance.performance.dao.InstPerformanceH2DAO \ No newline at end of file diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/resources/META-INF/defines/local_worker_provider.define b/apm-collector-3.2.3/apm-collector-agentstream/src/main/resources/META-INF/defines/local_worker_provider.define deleted file mode 100644 index 465adeac25..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/resources/META-INF/defines/local_worker_provider.define +++ /dev/null @@ -1,22 +0,0 @@ -org.skywalking.apm.collector.agentstream.worker.node.component.NodeComponentAggregationWorker$Factory -org.skywalking.apm.collector.agentstream.worker.node.component.NodeComponentPersistenceWorker$Factory - -org.skywalking.apm.collector.agentstream.worker.node.mapping.NodeMappingAggregationWorker$Factory -org.skywalking.apm.collector.agentstream.worker.node.mapping.NodeMappingPersistenceWorker$Factory - -org.skywalking.apm.collector.agentstream.worker.noderef.NodeReferenceAggregationWorker$Factory -org.skywalking.apm.collector.agentstream.worker.noderef.NodeReferencePersistenceWorker$Factory - -org.skywalking.apm.collector.agentstream.worker.service.entry.ServiceEntryAggregationWorker$Factory -org.skywalking.apm.collector.agentstream.worker.service.entry.ServiceEntryPersistenceWorker$Factory - -org.skywalking.apm.collector.agentstream.worker.serviceref.ServiceReferenceAggregationWorker$Factory -org.skywalking.apm.collector.agentstream.worker.serviceref.ServiceReferencePersistenceWorker$Factory - -org.skywalking.apm.collector.agentstream.worker.segment.origin.SegmentPersistenceWorker$Factory -org.skywalking.apm.collector.agentstream.worker.segment.cost.SegmentCostPersistenceWorker$Factory -org.skywalking.apm.collector.agentstream.worker.segment.standardization.SegmentStandardizationWorker$Factory - -org.skywalking.apm.collector.agentstream.worker.global.GlobalTracePersistenceWorker$Factory - -org.skywalking.apm.collector.agentstream.worker.instance.performance.InstPerformancePersistenceWorker$Factory \ No newline at end of file diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/resources/META-INF/defines/module.define b/apm-collector-3.2.3/apm-collector-agentstream/src/main/resources/META-INF/defines/module.define deleted file mode 100644 index 7103f42191..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/resources/META-INF/defines/module.define +++ /dev/null @@ -1,2 +0,0 @@ -org.skywalking.apm.collector.agentstream.grpc.AgentStreamGRPCModuleDefine -org.skywalking.apm.collector.agentstream.jetty.AgentStreamJettyModuleDefine \ No newline at end of file diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/resources/META-INF/defines/remote_worker_provider.define b/apm-collector-3.2.3/apm-collector-agentstream/src/main/resources/META-INF/defines/remote_worker_provider.define deleted file mode 100644 index 17a6ae7b5e..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/resources/META-INF/defines/remote_worker_provider.define +++ /dev/null @@ -1,6 +0,0 @@ -org.skywalking.apm.collector.agentstream.worker.node.component.NodeComponentRemoteWorker$Factory -org.skywalking.apm.collector.agentstream.worker.node.mapping.NodeMappingRemoteWorker$Factory -org.skywalking.apm.collector.agentstream.worker.noderef.NodeReferenceRemoteWorker$Factory - -org.skywalking.apm.collector.agentstream.worker.service.entry.ServiceEntryRemoteWorker$Factory -org.skywalking.apm.collector.agentstream.worker.serviceref.ServiceReferenceRemoteWorker$Factory \ No newline at end of file diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/main/resources/META-INF/defines/storage.define b/apm-collector-3.2.3/apm-collector-agentstream/src/main/resources/META-INF/defines/storage.define deleted file mode 100644 index 098e51e7a2..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/main/resources/META-INF/defines/storage.define +++ /dev/null @@ -1,26 +0,0 @@ -org.skywalking.apm.collector.agentstream.worker.node.component.define.NodeComponentEsTableDefine -org.skywalking.apm.collector.agentstream.worker.node.component.define.NodeComponentH2TableDefine - -org.skywalking.apm.collector.agentstream.worker.node.mapping.define.NodeMappingEsTableDefine -org.skywalking.apm.collector.agentstream.worker.node.mapping.define.NodeMappingH2TableDefine - -org.skywalking.apm.collector.agentstream.worker.noderef.define.NodeReferenceEsTableDefine -org.skywalking.apm.collector.agentstream.worker.noderef.define.NodeReferenceH2TableDefine - -org.skywalking.apm.collector.agentstream.worker.segment.origin.define.SegmentEsTableDefine -org.skywalking.apm.collector.agentstream.worker.segment.origin.define.SegmentH2TableDefine - -org.skywalking.apm.collector.agentstream.worker.segment.cost.define.SegmentCostEsTableDefine -org.skywalking.apm.collector.agentstream.worker.segment.cost.define.SegmentCostH2TableDefine - -org.skywalking.apm.collector.agentstream.worker.global.define.GlobalTraceEsTableDefine -org.skywalking.apm.collector.agentstream.worker.global.define.GlobalTraceH2TableDefine - -org.skywalking.apm.collector.agentstream.worker.service.entry.define.ServiceEntryEsTableDefine -org.skywalking.apm.collector.agentstream.worker.service.entry.define.ServiceEntryH2TableDefine - -org.skywalking.apm.collector.agentstream.worker.serviceref.define.ServiceReferenceEsTableDefine -org.skywalking.apm.collector.agentstream.worker.serviceref.define.ServiceReferenceH2TableDefine - -org.skywalking.apm.collector.agentstream.worker.instance.performance.define.InstPerformanceEsTableDefine -org.skywalking.apm.collector.agentstream.worker.instance.performance.define.InstPerformanceH2TableDefine \ No newline at end of file diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/test/java/org/skywalking/apm/collector/agentstream/HttpClientTools.java b/apm-collector-3.2.3/apm-collector-agentstream/src/test/java/org/skywalking/apm/collector/agentstream/HttpClientTools.java deleted file mode 100644 index d90269babc..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/test/java/org/skywalking/apm/collector/agentstream/HttpClientTools.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream; - -import java.io.IOException; -import java.net.URI; -import java.util.List; -import org.apache.http.Consts; -import org.apache.http.HttpEntity; -import org.apache.http.NameValuePair; -import org.apache.http.client.entity.UrlEncodedFormEntity; -import org.apache.http.client.methods.CloseableHttpResponse; -import org.apache.http.client.methods.HttpGet; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.entity.StringEntity; -import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.http.impl.client.HttpClients; -import org.apache.http.util.EntityUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public enum HttpClientTools { - INSTANCE; - - private final Logger logger = LoggerFactory.getLogger(HttpClientTools.class); - - public String get(String url, List params) throws IOException { - CloseableHttpClient httpClient = HttpClients.createDefault(); - try { - HttpGet httpget = new HttpGet(url); - String paramStr = EntityUtils.toString(new UrlEncodedFormEntity(params)); - httpget.setURI(new URI(httpget.getURI().toString() + "?" + paramStr)); - logger.debug("executing get request {}", httpget.getURI()); - - try (CloseableHttpResponse response = httpClient.execute(httpget)) { - HttpEntity entity = response.getEntity(); - if (entity != null) { - return EntityUtils.toString(entity); - } - } - } catch (Exception e) { - logger.error(e.getMessage(), e); - } finally { - try { - httpClient.close(); - } catch (IOException e) { - logger.error(e.getMessage(), e); - } - } - return null; - } - - public String post(String url, String data) throws IOException { - CloseableHttpClient httpClient = HttpClients.createDefault(); - try { - HttpPost httppost = new HttpPost(url); - httppost.setEntity(new StringEntity(data, Consts.UTF_8)); - logger.debug("executing post request {}", httppost.getURI()); - try (CloseableHttpResponse response = httpClient.execute(httppost)) { - HttpEntity entity = response.getEntity(); - if (entity != null) { - return EntityUtils.toString(entity); - } - } - } catch (Exception e) { - logger.error(e.getMessage(), e); - } finally { - try { - httpClient.close(); - } catch (Exception e) { - logger.error(e.getMessage(), e); - } - } - return null; - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/test/java/org/skywalking/apm/collector/agentstream/grpc/handler/TraceSegmentServiceHandlerTestCase.java b/apm-collector-3.2.3/apm-collector-agentstream/src/test/java/org/skywalking/apm/collector/agentstream/grpc/handler/TraceSegmentServiceHandlerTestCase.java deleted file mode 100644 index 9ae169960e..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/test/java/org/skywalking/apm/collector/agentstream/grpc/handler/TraceSegmentServiceHandlerTestCase.java +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.grpc.handler; - -import io.grpc.ManagedChannel; -import io.grpc.ManagedChannelBuilder; -import io.grpc.stub.StreamObserver; -import org.junit.Test; -import org.skywalking.apm.network.proto.Downstream; -import org.skywalking.apm.network.proto.KeyWithStringValue; -import org.skywalking.apm.network.proto.LogMessage; -import org.skywalking.apm.network.proto.SpanLayer; -import org.skywalking.apm.network.proto.SpanObject; -import org.skywalking.apm.network.proto.SpanType; -import org.skywalking.apm.network.proto.TraceSegmentObject; -import org.skywalking.apm.network.proto.TraceSegmentReference; -import org.skywalking.apm.network.proto.TraceSegmentServiceGrpc; -import org.skywalking.apm.network.proto.UniqueId; -import org.skywalking.apm.network.proto.UpstreamSegment; -import org.skywalking.apm.network.trace.component.ComponentsDefine; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class TraceSegmentServiceHandlerTestCase { - - private final Logger logger = LoggerFactory.getLogger(TraceSegmentServiceHandlerTestCase.class); - - private TraceSegmentServiceGrpc.TraceSegmentServiceStub stub; - - @Test - public void testCollect() { - ManagedChannel channel = ManagedChannelBuilder.forAddress("localhost", 11800).usePlaintext(true).build(); - stub = TraceSegmentServiceGrpc.newStub(channel); - - StreamObserver streamObserver = stub.collect(new StreamObserver() { - @Override public void onNext(Downstream downstream) { - } - - @Override public void onError(Throwable throwable) { - logger.error(throwable.getMessage(), throwable); - } - - @Override public void onCompleted() { - - } - }); - - UpstreamSegment.Builder builder = UpstreamSegment.newBuilder(); - buildGlobalTraceIds(builder); - buildSegment(builder); - - streamObserver.onNext(builder.build()); - streamObserver.onCompleted(); - - try { - Thread.sleep(10000); - } catch (InterruptedException e) { - } - } - - private void buildGlobalTraceIds(UpstreamSegment.Builder builder) { - UniqueId.Builder builder1 = UniqueId.newBuilder(); - builder1.addIdParts(100); - builder1.addIdParts(100); - builder1.addIdParts(100); - builder.addGlobalTraceIds(builder1.build()); - } - - private void buildSegment(UpstreamSegment.Builder builder) { - long now = System.currentTimeMillis(); - - TraceSegmentObject.Builder segmentBuilder = TraceSegmentObject.newBuilder(); - segmentBuilder.setApplicationId(2); - segmentBuilder.setApplicationInstanceId(2); - segmentBuilder.setTraceSegmentId(UniqueId.newBuilder().addIdParts(200).addIdParts(200).addIdParts(200).build()); - - SpanObject.Builder span0 = SpanObject.newBuilder(); - span0.setSpanId(0); - span0.setOperationName("/dubbox-case/case/dubbox-rest"); - span0.setOperationNameId(0); - span0.setParentSpanId(-1); - span0.setSpanLayer(SpanLayer.Http); - span0.setStartTime(now); - span0.setEndTime(now + 100000); - span0.setComponentId(ComponentsDefine.TOMCAT.getId()); - span0.setIsError(false); - span0.setSpanType(SpanType.Entry); - span0.setPeerId(2); - span0.setPeer("localhost:8082"); - - LogMessage.Builder log0 = LogMessage.newBuilder(); - log0.setTime(now); - log0.addData(KeyWithStringValue.newBuilder().setKey("log1").setValue("value1")); - log0.addData(KeyWithStringValue.newBuilder().setKey("log2").setValue("value2")); - log0.addData(KeyWithStringValue.newBuilder().setKey("log3").setValue("value3")); - span0.addLogs(log0.build()); - - span0.addTags(KeyWithStringValue.newBuilder().setKey("tag1").setValue("value1")); - span0.addTags(KeyWithStringValue.newBuilder().setKey("tag2").setValue("value2")); - span0.addTags(KeyWithStringValue.newBuilder().setKey("tag3").setValue("value3")); - segmentBuilder.addSpans(span0); - - TraceSegmentReference.Builder ref0 = TraceSegmentReference.newBuilder(); - ref0.setEntryServiceId(1); - ref0.setEntryServiceName("ServiceName"); - ref0.setNetworkAddress("localhost:8081"); - ref0.setNetworkAddressId(1); - ref0.setParentApplicationInstanceId(1); - ref0.setParentServiceId(1); - ref0.setParentServiceName(""); - ref0.setParentSpanId(2); - ref0.setParentTraceSegmentId(UniqueId.newBuilder().addIdParts(100).addIdParts(100).addIdParts(100).build()); -// segmentBuilder.addRefs(ref_0); - - builder.setSegment(segmentBuilder.build().toByteString()); - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/test/java/org/skywalking/apm/collector/agentstream/jetty/handler/reader/TraceSegmentJsonReaderTestCase.java b/apm-collector-3.2.3/apm-collector-agentstream/src/test/java/org/skywalking/apm/collector/agentstream/jetty/handler/reader/TraceSegmentJsonReaderTestCase.java deleted file mode 100644 index 65ec356f85..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/test/java/org/skywalking/apm/collector/agentstream/jetty/handler/reader/TraceSegmentJsonReaderTestCase.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.jetty.handler.reader; - -import com.google.gson.JsonElement; -import com.google.gson.stream.JsonReader; -import java.io.IOException; -import java.io.StringReader; -import org.junit.Test; -import org.skywalking.apm.collector.agentstream.mock.JsonFileReader; - -/** - * @author peng-yongsheng - */ -public class TraceSegmentJsonReaderTestCase { - - @Test - public void testRead() throws IOException { - TraceSegmentJsonReader reader = new TraceSegmentJsonReader(); - JsonElement jsonElement = JsonFileReader.INSTANCE.read("json/segment/normal/dubbox-consumer.json"); - - JsonReader jsonReader = new JsonReader(new StringReader(jsonElement.toString())); - jsonReader.beginArray(); - while (jsonReader.hasNext()) { - reader.read(jsonReader); - } - jsonReader.endArray(); - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/test/java/org/skywalking/apm/collector/agentstream/mock/JsonFileReader.java b/apm-collector-3.2.3/apm-collector-agentstream/src/test/java/org/skywalking/apm/collector/agentstream/mock/JsonFileReader.java deleted file mode 100644 index a5b171af99..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/test/java/org/skywalking/apm/collector/agentstream/mock/JsonFileReader.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.mock; - -import com.google.gson.JsonElement; -import com.google.gson.JsonParser; -import java.io.FileNotFoundException; -import java.io.FileReader; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public enum JsonFileReader { - INSTANCE; - - private final Logger logger = LoggerFactory.getLogger(JsonFileReader.class); - - public JsonElement read(String fileName) throws FileNotFoundException { - String path = this.getClass().getClassLoader().getResource(fileName).getFile(); - logger.debug("path: {}", path); - JsonParser jsonParser = new JsonParser(); - return jsonParser.parse(new FileReader(path)); - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/test/java/org/skywalking/apm/collector/agentstream/mock/SegmentPost.java b/apm-collector-3.2.3/apm-collector-agentstream/src/test/java/org/skywalking/apm/collector/agentstream/mock/SegmentPost.java deleted file mode 100644 index 0dd19e4ccb..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/test/java/org/skywalking/apm/collector/agentstream/mock/SegmentPost.java +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.mock; - -import com.google.gson.JsonArray; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import java.io.IOException; -import org.skywalking.apm.collector.agentregister.worker.application.dao.IApplicationDAO; -import org.skywalking.apm.collector.agentregister.worker.instance.dao.IInstanceDAO; -import org.skywalking.apm.collector.agentregister.worker.servicename.dao.IServiceNameDAO; -import org.skywalking.apm.collector.agentstream.HttpClientTools; -import org.skywalking.apm.collector.client.elasticsearch.ElasticSearchClient; -import org.skywalking.apm.collector.client.h2.H2Client; -import org.skywalking.apm.collector.core.CollectorException; -import org.skywalking.apm.collector.core.config.SystemConfig; -import org.skywalking.apm.collector.core.util.TimeBucketUtils; -import org.skywalking.apm.collector.storage.base.dao.DAOContainer; -import org.skywalking.apm.collector.storage.base.define.register.ApplicationDataDefine; -import org.skywalking.apm.collector.storage.base.define.register.InstanceDataDefine; -import org.skywalking.apm.collector.storage.base.define.register.ServiceNameDataDefine; -import org.skywalking.apm.collector.storage.elasticsearch.StorageElasticSearchModuleDefine; -import org.skywalking.apm.collector.storage.h2.StorageH2ModuleDefine; - -/** - * @author peng-yongsheng - */ -public class SegmentPost { - - public static void main(String[] args) throws IOException, InterruptedException, CollectorException { - SystemConfig.DATA_PATH = "/Users/pengys5/code/sky-walking/sky-walking/apm-collector-3.2.3/data"; - - ElasticSearchClient elasticSearchClient = new ElasticSearchClient("CollectorDBCluster", true, "127.0.0.1:9300"); - elasticSearchClient.initialize(); - StorageElasticSearchModuleDefine storageElasticSearchModuleDefine = new StorageElasticSearchModuleDefine(); - storageElasticSearchModuleDefine.injectClientIntoDAO(elasticSearchClient); - - H2Client h2Client = new H2Client("jdbc:h2:tcp://localhost/~/test", "sa", ""); - h2Client.initialize(); - StorageH2ModuleDefine storageH2ModuleDefine = new StorageH2ModuleDefine(); - storageH2ModuleDefine.injectClientIntoDAO(h2Client); - - long now = TimeBucketUtils.INSTANCE.getSecondTimeBucket(System.currentTimeMillis()); - - IInstanceDAO instanceDAO = (IInstanceDAO)DAOContainer.INSTANCE.get(IInstanceDAO.class.getName()); - InstanceDataDefine.Instance consumerInstance = new InstanceDataDefine.Instance("2", 2, "dubbox-consumer", now, 2, now, osInfo("consumer").toString()); - instanceDAO.save(consumerInstance); - InstanceDataDefine.Instance providerInstance = new InstanceDataDefine.Instance("3", 3, "dubbox-provider", now, 3, now, osInfo("provider").toString()); - instanceDAO.save(providerInstance); - - IApplicationDAO applicationDAO = (IApplicationDAO)DAOContainer.INSTANCE.get(IApplicationDAO.class.getName()); - - ApplicationDataDefine.Application userApplication = new ApplicationDataDefine.Application("1", "User", 1); - applicationDAO.save(userApplication); - ApplicationDataDefine.Application consumerApplication = new ApplicationDataDefine.Application("2", "dubbox-consumer", 2); - applicationDAO.save(consumerApplication); - ApplicationDataDefine.Application providerApplication = new ApplicationDataDefine.Application("3", "dubbox-provider", 3); - applicationDAO.save(providerApplication); - ApplicationDataDefine.Application peer = new ApplicationDataDefine.Application("4", "172.25.0.4:20880", 4); - applicationDAO.save(peer); - - IServiceNameDAO serviceNameDAO = (IServiceNameDAO)DAOContainer.INSTANCE.get(IServiceNameDAO.class.getName()); - - ServiceNameDataDefine.ServiceName serviceName1 = new ServiceNameDataDefine.ServiceName("1", "", 0, 1); - serviceNameDAO.save(serviceName1); - ServiceNameDataDefine.ServiceName serviceName2 = new ServiceNameDataDefine.ServiceName("2", "org.skywaking.apm.testcase.dubbo.services.GreetService.doBusiness()", 2, 2); - serviceNameDAO.save(serviceName2); - ServiceNameDataDefine.ServiceName serviceName3 = new ServiceNameDataDefine.ServiceName("3", "/dubbox-case/case/dubbox-rest", 2, 3); - serviceNameDAO.save(serviceName3); - ServiceNameDataDefine.ServiceName serviceName4 = new ServiceNameDataDefine.ServiceName("4", "org.skywaking.apm.testcase.dubbo.services.GreetService.doBusiness()", 3, 4); - serviceNameDAO.save(serviceName4); - - while (true) { - JsonElement consumer = JsonFileReader.INSTANCE.read("json/segment/normal/dubbox-consumer.json"); - modifyTime(consumer); - HttpClientTools.INSTANCE.post("http://localhost:12800/segments", consumer.toString()); - - JsonElement provider = JsonFileReader.INSTANCE.read("json/segment/normal/dubbox-provider.json"); - modifyTime(provider); - HttpClientTools.INSTANCE.post("http://localhost:12800/segments", provider.toString()); - - DIFF = 0; - Thread.sleep(1000); - break; - } - } - - private static long DIFF = 0; - - private static void modifyTime(JsonElement jsonElement) { - JsonArray segmentArray = jsonElement.getAsJsonArray(); - for (JsonElement element : segmentArray) { - JsonObject segmentObj = element.getAsJsonObject(); - JsonArray spans = segmentObj.get("sg").getAsJsonObject().get("ss").getAsJsonArray(); - for (JsonElement span : spans) { - long startTime = span.getAsJsonObject().get("st").getAsLong(); - long endTime = span.getAsJsonObject().get("et").getAsLong(); - - if (DIFF == 0) { - DIFF = System.currentTimeMillis() - startTime; - } - - span.getAsJsonObject().addProperty("st", startTime + DIFF); - span.getAsJsonObject().addProperty("et", endTime + DIFF); - } - } - } - - private static JsonObject osInfo(String hostName) { - JsonObject osInfoJson = new JsonObject(); - osInfoJson.addProperty("osName", "Linux"); - osInfoJson.addProperty("hostName", hostName); - osInfoJson.addProperty("processId", 1); - - JsonArray ipv4Array = new JsonArray(); - ipv4Array.add("123.123.123.123"); - ipv4Array.add("124.124.124.124"); - osInfoJson.add("ipv4s", ipv4Array); - - return osInfoJson; - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/test/java/org/skywalking/apm/collector/agentstream/mock/grpc/ApplicationRegister.java b/apm-collector-3.2.3/apm-collector-agentstream/src/test/java/org/skywalking/apm/collector/agentstream/mock/grpc/ApplicationRegister.java deleted file mode 100644 index 3a5a2788d0..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/test/java/org/skywalking/apm/collector/agentstream/mock/grpc/ApplicationRegister.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.mock.grpc; - -import io.grpc.ManagedChannel; -import org.skywalking.apm.network.proto.Application; -import org.skywalking.apm.network.proto.ApplicationMapping; -import org.skywalking.apm.network.proto.ApplicationRegisterServiceGrpc; - -/** - * @author peng-yongsheng - */ -public class ApplicationRegister { - - public static int register(ManagedChannel channel, String applicationCode) { - ApplicationRegisterServiceGrpc.ApplicationRegisterServiceBlockingStub stub = ApplicationRegisterServiceGrpc.newBlockingStub(channel); - Application application = Application.newBuilder().addApplicationCode(applicationCode).build(); - ApplicationMapping mapping = stub.register(application); - int applicationId = mapping.getApplication(0).getValue(); - - try { - Thread.sleep(10); - } catch (InterruptedException e) { - } - return applicationId; - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/test/java/org/skywalking/apm/collector/agentstream/mock/grpc/GrpcSegmentPost.java b/apm-collector-3.2.3/apm-collector-agentstream/src/test/java/org/skywalking/apm/collector/agentstream/mock/grpc/GrpcSegmentPost.java deleted file mode 100644 index 6c38d44b9c..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/test/java/org/skywalking/apm/collector/agentstream/mock/grpc/GrpcSegmentPost.java +++ /dev/null @@ -1,422 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.mock.grpc; - -import io.grpc.ManagedChannel; -import io.grpc.ManagedChannelBuilder; -import io.grpc.stub.StreamObserver; -import java.util.concurrent.Executors; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicLong; -import org.junit.Test; -import org.skywalking.apm.collector.core.util.TimeBucketUtils; -import org.skywalking.apm.network.proto.Downstream; -import org.skywalking.apm.network.proto.KeyWithStringValue; -import org.skywalking.apm.network.proto.LogMessage; -import org.skywalking.apm.network.proto.RefType; -import org.skywalking.apm.network.proto.SpanLayer; -import org.skywalking.apm.network.proto.SpanObject; -import org.skywalking.apm.network.proto.SpanType; -import org.skywalking.apm.network.proto.TraceSegmentObject; -import org.skywalking.apm.network.proto.TraceSegmentReference; -import org.skywalking.apm.network.proto.TraceSegmentServiceGrpc; -import org.skywalking.apm.network.proto.UniqueId; -import org.skywalking.apm.network.proto.UpstreamSegment; -import org.skywalking.apm.network.trace.component.ComponentsDefine; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class GrpcSegmentPost { - - private final Logger logger = LoggerFactory.getLogger(GrpcSegmentPost.class); - - private AtomicLong sequence = new AtomicLong(1); - - @Test - public void init() { - ManagedChannel channel = ManagedChannelBuilder.forAddress("localhost", 11800).maxInboundMessageSize(1024 * 1024 * 50).usePlaintext(true).build(); - - int consumerApplicationId = 0; - int providerApplicationId = 0; - int consumerInstanceId = 0; - int providerInstanceId = 0; - int consumerEntryServiceId = 0; - int consumerExitServiceId = 0; - int consumerExitApplicationId = 0; - int providerEntryServiceId = 0; - - while (consumerApplicationId == 0) { - consumerApplicationId = ApplicationRegister.register(channel, "consumer"); - } - while (consumerExitApplicationId == 0) { - consumerExitApplicationId = ApplicationRegister.register(channel, "172.25.0.4:20880"); - } - while (providerApplicationId == 0) { - providerApplicationId = ApplicationRegister.register(channel, "provider"); - } - while (consumerInstanceId == 0) { - consumerInstanceId = InstanceRegister.register(channel, "ConsumerUUID", consumerApplicationId, "consumer_host_name", 1); - } - while (providerInstanceId == 0) { - providerInstanceId = InstanceRegister.register(channel, "ProviderUUID", providerApplicationId, "provider_host_name", 2); - } - while (consumerEntryServiceId == 0) { - consumerEntryServiceId = ServiceRegister.register(channel, consumerApplicationId, "/dubbox-case/case/dubbox-rest"); - } - while (consumerExitServiceId == 0) { - consumerExitServiceId = ServiceRegister.register(channel, consumerApplicationId, "org.skywaking.apm.testcase.dubbo.services.GreetService.doBusiness()"); - } - while (providerEntryServiceId == 0) { - providerEntryServiceId = ServiceRegister.register(channel, providerApplicationId, "org.skywaking.apm.testcase.dubbo.services.GreetService.doBusiness()"); - } - - Ids ids = new Ids(); - ids.setConsumerApplicationId(consumerApplicationId); - ids.setProviderApplicationId(providerApplicationId); - ids.setConsumerInstanceId(consumerInstanceId); - ids.setProviderInstanceId(providerInstanceId); - ids.setConsumerEntryServiceId(consumerEntryServiceId); - ids.setConsumerExitServiceId(consumerExitServiceId); - ids.setConsumerExitApplicationId(consumerExitApplicationId); - - long startTime = TimeBucketUtils.INSTANCE.getSecondTimeBucket(System.currentTimeMillis()); - logger.info("start time: {}", startTime); - - int count = 10; - ThreadCount threadCount = new ThreadCount(count); - for (int i = 0; i < count; i++) { - Status status = new Status(); - BuildNewSegment buildNewSegment = new BuildNewSegment(channel, ids, threadCount, i, status); - Executors.newSingleThreadExecutor().execute(buildNewSegment); - } - - while (threadCount.getCount() != 0) { - try { - Thread.sleep(100); - } catch (InterruptedException e) { - } - } - long endTime = TimeBucketUtils.INSTANCE.getSecondTimeBucket(System.currentTimeMillis()); - logger.info("end time: {}", endTime); - - channel.shutdownNow(); - while (!channel.isTerminated()) { - try { - channel.awaitTermination(100, TimeUnit.SECONDS); - } catch (InterruptedException e) { - logger.error(e.getMessage(), e); - } - } - } - - class BuildNewSegment implements Runnable { - private final ManagedChannel segmentChannel; - private final Ids ids; - private final ThreadCount threadCount; - private final int procNo; - private final Status status; - private StreamObserver streamObserver; - - public BuildNewSegment(ManagedChannel segmentChannel, - Ids ids, ThreadCount threadCount, int procNo, - Status status) { - this.segmentChannel = segmentChannel; - this.ids = ids; - this.threadCount = threadCount; - this.procNo = procNo; - this.status = status; - } - - @Override public void run() { - statusChange(); - int i = 0; - while (i < 50000) { - send(streamObserver, ids); - - i++; - if (i % 10000 == 0) { - logger.info("process no: {}, send segment count: {}", procNo, i); - streamObserver.onCompleted(); - while (!status.isFinish) { - try { - Thread.sleep(10); - } catch (InterruptedException e) { - } - } - status.setFinish(false); - statusChange(); - } - } - this.threadCount.finishOne(); - } - - private void statusChange() { - TraceSegmentServiceGrpc.TraceSegmentServiceStub stub = TraceSegmentServiceGrpc.newStub(segmentChannel); - streamObserver = stub.collect(new StreamObserver() { - @Override public void onNext(Downstream downstream) { - } - - @Override public void onError(Throwable throwable) { - logger.error(throwable.getMessage(), throwable); - } - - @Override public void onCompleted() { - status.setFinish(true); - logger.info("process no: {}, server completed", procNo); - } - }); - } - } - - public void send(StreamObserver streamObserver, Ids ids) { - long now = System.currentTimeMillis(); - UniqueId consumerSegmentId = createSegmentId(); - UniqueId providerSegmentId = createSegmentId(); - - streamObserver.onNext(createConsumerSegment(consumerSegmentId, ids, now)); - streamObserver.onNext(createProviderSegment(consumerSegmentId, providerSegmentId, ids, now)); - } - - private UpstreamSegment createConsumerSegment(UniqueId segmentId, Ids ids, long timestamp) { - UpstreamSegment.Builder upstream = UpstreamSegment.newBuilder(); - upstream.addGlobalTraceIds(segmentId); - - TraceSegmentObject.Builder segmentBuilder = TraceSegmentObject.newBuilder(); - segmentBuilder.setApplicationId(ids.consumerApplicationId); - segmentBuilder.setApplicationInstanceId(ids.consumerInstanceId); - segmentBuilder.setTraceSegmentId(segmentId); - - SpanObject.Builder entrySpan = SpanObject.newBuilder(); - entrySpan.setSpanId(0); - entrySpan.setSpanType(SpanType.Entry); - entrySpan.setSpanLayer(SpanLayer.Http); - entrySpan.setParentSpanId(-1); - entrySpan.setStartTime(timestamp); - entrySpan.setEndTime(timestamp + 3000); - entrySpan.setComponentId(ComponentsDefine.TOMCAT.getId()); - entrySpan.setOperationNameId(ids.getConsumerEntryServiceId()); - entrySpan.setIsError(false); - - LogMessage.Builder entryLogMessage = LogMessage.newBuilder(); - entryLogMessage.setTime(timestamp); - - KeyWithStringValue.Builder data1 = KeyWithStringValue.newBuilder(); - data1.setKey("url"); - data1.setValue("http://localhost:18080/dubbox-case/case/dubbox-rest"); - entryLogMessage.addData(data1); - - KeyWithStringValue.Builder data2 = KeyWithStringValue.newBuilder(); - data2.setKey("http.method"); - data2.setValue("GET"); - entryLogMessage.addData(data2); - entrySpan.addLogs(entryLogMessage); - segmentBuilder.addSpans(entrySpan); - - SpanObject.Builder exitSpan = SpanObject.newBuilder(); - exitSpan.setSpanId(1); - exitSpan.setSpanType(SpanType.Exit); - exitSpan.setSpanLayer(SpanLayer.RPCFramework); - exitSpan.setParentSpanId(0); - exitSpan.setStartTime(timestamp + 500); - exitSpan.setEndTime(timestamp + 2500); - exitSpan.setComponentId(ComponentsDefine.TOMCAT.getId()); - exitSpan.setOperationNameId(ids.getConsumerExitServiceId()); - exitSpan.setPeerId(ids.consumerExitApplicationId); - exitSpan.setIsError(false); - - LogMessage.Builder exitLogMessage = LogMessage.newBuilder(); - exitLogMessage.setTime(timestamp); - - KeyWithStringValue.Builder data = KeyWithStringValue.newBuilder(); - data.setKey("url"); - data.setValue("rest://172.25.0.4:20880/org.skywaking.apm.testcase.dubbo.services.GreetService.doBusiness()"); - exitLogMessage.addData(data); - exitSpan.addLogs(exitLogMessage); - segmentBuilder.addSpans(exitSpan); - - upstream.setSegment(segmentBuilder.build().toByteString()); - return upstream.build(); - } - - private UpstreamSegment createProviderSegment(UniqueId consumerSegmentId, UniqueId providerSegmentId, Ids ids, - long timestamp) { - UpstreamSegment.Builder upstream = UpstreamSegment.newBuilder(); - upstream.addGlobalTraceIds(consumerSegmentId); - - TraceSegmentObject.Builder segmentBuilder = TraceSegmentObject.newBuilder(); - segmentBuilder.setApplicationId(ids.providerApplicationId); - segmentBuilder.setApplicationInstanceId(ids.providerInstanceId); - segmentBuilder.setTraceSegmentId(providerSegmentId); - - TraceSegmentReference.Builder referenceBuilder = TraceSegmentReference.newBuilder(); - referenceBuilder.setParentTraceSegmentId(consumerSegmentId); - referenceBuilder.setParentApplicationInstanceId(ids.getConsumerInstanceId()); - referenceBuilder.setParentSpanId(1); - referenceBuilder.setParentServiceId(ids.getConsumerExitServiceId()); - referenceBuilder.setEntryApplicationInstanceId(ids.getConsumerInstanceId()); - referenceBuilder.setEntryServiceId(ids.getConsumerEntryServiceId()); - referenceBuilder.setNetworkAddressId(ids.consumerExitApplicationId); - referenceBuilder.setRefType(RefType.CrossProcess); - segmentBuilder.addRefs(referenceBuilder); - - SpanObject.Builder entrySpan = SpanObject.newBuilder(); - entrySpan.setSpanId(0); - entrySpan.setSpanType(SpanType.Entry); - entrySpan.setSpanLayer(SpanLayer.RPCFramework); - entrySpan.setParentSpanId(-1); - entrySpan.setStartTime(timestamp + 1000); - entrySpan.setEndTime(timestamp + 2000); - entrySpan.setComponentId(ComponentsDefine.TOMCAT.getId()); - entrySpan.setOperationNameId(ids.getProviderEntryServiceId()); - entrySpan.setIsError(false); - - LogMessage.Builder entryLogMessage = LogMessage.newBuilder(); - entryLogMessage.setTime(timestamp); - - KeyWithStringValue.Builder data1 = KeyWithStringValue.newBuilder(); - data1.setKey("url"); - data1.setValue("rest://172.25.0.4:20880/org.skywaking.apm.testcase.dubbo.services.GreetService.doBusiness()"); - entryLogMessage.addData(data1); - - KeyWithStringValue.Builder data2 = KeyWithStringValue.newBuilder(); - data2.setKey("http.method"); - data2.setValue("GET"); - entryLogMessage.addData(data2); - entrySpan.addLogs(entryLogMessage); - segmentBuilder.addSpans(entrySpan); - - upstream.setSegment(segmentBuilder.build().toByteString()); - return upstream.build(); - } - - private UniqueId createSegmentId() { - long id = sequence.getAndIncrement(); - UniqueId.Builder builder = UniqueId.newBuilder(); - builder.addIdParts(id); - builder.addIdParts(id); - builder.addIdParts(id); - return builder.build(); - } - - class Ids { - private int consumerApplicationId = 0; - private int providerApplicationId = 0; - private int consumerInstanceId = 0; - private int providerInstanceId = 0; - private int consumerEntryServiceId = 0; - private int consumerExitServiceId = 0; - private int consumerExitApplicationId = 0; - private int providerEntryServiceId = 0; - - public int getConsumerApplicationId() { - return consumerApplicationId; - } - - public void setConsumerApplicationId(int consumerApplicationId) { - this.consumerApplicationId = consumerApplicationId; - } - - public int getProviderApplicationId() { - return providerApplicationId; - } - - public void setProviderApplicationId(int providerApplicationId) { - this.providerApplicationId = providerApplicationId; - } - - public int getConsumerInstanceId() { - return consumerInstanceId; - } - - public void setConsumerInstanceId(int consumerInstanceId) { - this.consumerInstanceId = consumerInstanceId; - } - - public int getProviderInstanceId() { - return providerInstanceId; - } - - public void setProviderInstanceId(int providerInstanceId) { - this.providerInstanceId = providerInstanceId; - } - - public int getConsumerEntryServiceId() { - return consumerEntryServiceId; - } - - public void setConsumerEntryServiceId(int consumerEntryServiceId) { - this.consumerEntryServiceId = consumerEntryServiceId; - } - - public int getConsumerExitServiceId() { - return consumerExitServiceId; - } - - public void setConsumerExitServiceId(int consumerExitServiceId) { - this.consumerExitServiceId = consumerExitServiceId; - } - - public int getConsumerExitApplicationId() { - return consumerExitApplicationId; - } - - public void setConsumerExitApplicationId(int consumerExitApplicationId) { - this.consumerExitApplicationId = consumerExitApplicationId; - } - - public int getProviderEntryServiceId() { - return providerEntryServiceId; - } - - public void setProviderEntryServiceId(int providerEntryServiceId) { - this.providerEntryServiceId = providerEntryServiceId; - } - } - - class ThreadCount { - private int count; - - public ThreadCount(int count) { - this.count = count; - } - - public void finishOne() { - count--; - } - - public int getCount() { - return count; - } - } - - class Status { - private boolean isFinish = false; - - public boolean isFinish() { - return isFinish; - } - - public void setFinish(boolean finish) { - isFinish = finish; - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/test/java/org/skywalking/apm/collector/agentstream/mock/grpc/InstanceRegister.java b/apm-collector-3.2.3/apm-collector-agentstream/src/test/java/org/skywalking/apm/collector/agentstream/mock/grpc/InstanceRegister.java deleted file mode 100644 index 6602d9d4f5..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/test/java/org/skywalking/apm/collector/agentstream/mock/grpc/InstanceRegister.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.mock.grpc; - -import io.grpc.ManagedChannel; -import org.skywalking.apm.network.proto.ApplicationInstance; -import org.skywalking.apm.network.proto.ApplicationInstanceMapping; -import org.skywalking.apm.network.proto.InstanceDiscoveryServiceGrpc; -import org.skywalking.apm.network.proto.OSInfo; - -/** - * @author peng-yongsheng - */ -public class InstanceRegister { - - public static int register(ManagedChannel channel, String agentUUId, Integer applicationId, - String hostName, int processNo) { - InstanceDiscoveryServiceGrpc.InstanceDiscoveryServiceBlockingStub stub = InstanceDiscoveryServiceGrpc.newBlockingStub(channel); - ApplicationInstance.Builder instance = ApplicationInstance.newBuilder(); - instance.setApplicationId(applicationId); - instance.setRegisterTime(System.currentTimeMillis()); - instance.setAgentUUID(agentUUId); - - OSInfo.Builder osInfo = OSInfo.newBuilder(); - osInfo.setHostname(hostName); - osInfo.setOsName("Linux"); - osInfo.setProcessNo(processNo); - osInfo.addIpv4S("10.0.0.1"); - osInfo.addIpv4S("10.0.0.2"); - instance.setOsinfo(osInfo.build()); - - ApplicationInstanceMapping mapping = stub.register(instance.build()); - int instanceId = mapping.getApplicationInstanceId(); - - try { - Thread.sleep(10); - } catch (InterruptedException e) { - } - return instanceId; - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/test/java/org/skywalking/apm/collector/agentstream/mock/grpc/ServiceRegister.java b/apm-collector-3.2.3/apm-collector-agentstream/src/test/java/org/skywalking/apm/collector/agentstream/mock/grpc/ServiceRegister.java deleted file mode 100644 index 6666eea65c..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/test/java/org/skywalking/apm/collector/agentstream/mock/grpc/ServiceRegister.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.mock.grpc; - -import io.grpc.ManagedChannel; -import org.skywalking.apm.network.proto.ServiceNameCollection; -import org.skywalking.apm.network.proto.ServiceNameDiscoveryServiceGrpc; -import org.skywalking.apm.network.proto.ServiceNameElement; -import org.skywalking.apm.network.proto.ServiceNameMappingCollection; - -/** - * @author peng-yongsheng - */ -public class ServiceRegister { - - public static int register(ManagedChannel channel, int applicationId, String serviceName) { - ServiceNameDiscoveryServiceGrpc.ServiceNameDiscoveryServiceBlockingStub stub = ServiceNameDiscoveryServiceGrpc.newBlockingStub(channel); - ServiceNameCollection.Builder collection = ServiceNameCollection.newBuilder(); - - ServiceNameElement.Builder element = ServiceNameElement.newBuilder(); - element.setApplicationId(applicationId); - element.setServiceName(serviceName); - collection.addElements(element); - - ServiceNameMappingCollection mappingCollection = stub.discovery(collection.build()); - int serviceId = mappingCollection.getElements(0).getServiceId(); - - try { - Thread.sleep(10); - } catch (InterruptedException e) { - } - return serviceId; - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/test/java/org/skywalking/apm/collector/agentstream/mock/grpc/SingleHasEntryHasExitNoRefSpan.java b/apm-collector-3.2.3/apm-collector-agentstream/src/test/java/org/skywalking/apm/collector/agentstream/mock/grpc/SingleHasEntryHasExitNoRefSpan.java deleted file mode 100644 index ee1917d4fe..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/test/java/org/skywalking/apm/collector/agentstream/mock/grpc/SingleHasEntryHasExitNoRefSpan.java +++ /dev/null @@ -1,133 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.mock.grpc; - -import io.grpc.ManagedChannel; -import io.grpc.ManagedChannelBuilder; -import io.grpc.stub.StreamObserver; -import org.skywalking.apm.network.proto.Downstream; -import org.skywalking.apm.network.proto.SpanLayer; -import org.skywalking.apm.network.proto.SpanObject; -import org.skywalking.apm.network.proto.SpanType; -import org.skywalking.apm.network.proto.TraceSegmentObject; -import org.skywalking.apm.network.proto.TraceSegmentServiceGrpc; -import org.skywalking.apm.network.proto.UniqueId; -import org.skywalking.apm.network.proto.UpstreamSegment; -import org.skywalking.apm.network.trace.component.ComponentsDefine; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class SingleHasEntryHasExitNoRefSpan { - - public static void main(String[] args) { - Post post = new Post(); - post.send(); - - try { - Thread.sleep(2000); - } catch (InterruptedException e) { - } - } - - static class Post { - private final Logger logger = LoggerFactory.getLogger(Post.class); - - public void send() { - ManagedChannel channel = ManagedChannelBuilder.forAddress("localhost", 11800).maxInboundMessageSize(1024 * 1024 * 50).usePlaintext(true).build(); - - int applicationId = 0; - int instanceId = 0; - int entryServiceId = 0; - while (applicationId == 0) { - applicationId = ApplicationRegister.register(channel, "consumer"); - } - - while (instanceId == 0) { - instanceId = InstanceRegister.register(channel, "ConsumerUUID", applicationId, "consumer_host_name", 1); - } - - while (entryServiceId == 0) { - entryServiceId = ServiceRegister.register(channel, applicationId, "/dubbox-case/case/dubbox-rest"); - } - - TraceSegmentServiceGrpc.TraceSegmentServiceStub stub = TraceSegmentServiceGrpc.newStub(channel); - StreamObserver streamObserver = stub.collect(new StreamObserver() { - @Override public void onNext(Downstream downstream) { - } - - @Override public void onError(Throwable throwable) { - logger.error(throwable.getMessage(), throwable); - } - - @Override public void onCompleted() { - } - }); - - long now = System.currentTimeMillis(); - - int id = 1; - UniqueId.Builder builder = UniqueId.newBuilder(); - builder.addIdParts(id); - builder.addIdParts(id); - builder.addIdParts(id); - UniqueId segmentId = builder.build(); - - UpstreamSegment.Builder upstream = UpstreamSegment.newBuilder(); - upstream.addGlobalTraceIds(segmentId); - - TraceSegmentObject.Builder segmentBuilder = TraceSegmentObject.newBuilder(); - segmentBuilder.setApplicationId(applicationId); - segmentBuilder.setApplicationInstanceId(instanceId); - segmentBuilder.setTraceSegmentId(segmentId); - - SpanObject.Builder entrySpan = SpanObject.newBuilder(); - entrySpan.setSpanId(0); - entrySpan.setSpanType(SpanType.Entry); - entrySpan.setSpanLayer(SpanLayer.Http); - entrySpan.setParentSpanId(-1); - entrySpan.setStartTime(now); - entrySpan.setEndTime(now + 3000); - entrySpan.setComponentId(ComponentsDefine.TOMCAT.getId()); - entrySpan.setOperationNameId(entryServiceId); - entrySpan.setIsError(false); - segmentBuilder.addSpans(entrySpan); - - SpanObject.Builder exitSpan = SpanObject.newBuilder(); - exitSpan.setSpanId(1); - exitSpan.setSpanType(SpanType.Exit); - exitSpan.setSpanLayer(SpanLayer.Database); - exitSpan.setParentSpanId(0); - exitSpan.setStartTime(now); - exitSpan.setEndTime(now + 3000); - exitSpan.setComponentId(ComponentsDefine.MONGODB.getId()); - exitSpan.setOperationNameId(entryServiceId); - exitSpan.setIsError(false); - exitSpan.setPeer("localhost:8888"); - segmentBuilder.addSpans(exitSpan); - - upstream.setSegment(segmentBuilder.build().toByteString()); - - streamObserver.onNext(upstream.build()); - streamObserver.onCompleted(); - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/test/java/org/skywalking/apm/collector/agentstream/mock/grpc/SingleHasEntryNoExitHasRefSpan.java b/apm-collector-3.2.3/apm-collector-agentstream/src/test/java/org/skywalking/apm/collector/agentstream/mock/grpc/SingleHasEntryNoExitHasRefSpan.java deleted file mode 100644 index 048dd9c135..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/test/java/org/skywalking/apm/collector/agentstream/mock/grpc/SingleHasEntryNoExitHasRefSpan.java +++ /dev/null @@ -1,150 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.mock.grpc; - -import io.grpc.ManagedChannel; -import io.grpc.ManagedChannelBuilder; -import io.grpc.stub.StreamObserver; -import org.skywalking.apm.network.proto.Downstream; -import org.skywalking.apm.network.proto.RefType; -import org.skywalking.apm.network.proto.SpanLayer; -import org.skywalking.apm.network.proto.SpanObject; -import org.skywalking.apm.network.proto.SpanType; -import org.skywalking.apm.network.proto.TraceSegmentObject; -import org.skywalking.apm.network.proto.TraceSegmentReference; -import org.skywalking.apm.network.proto.TraceSegmentServiceGrpc; -import org.skywalking.apm.network.proto.UniqueId; -import org.skywalking.apm.network.proto.UpstreamSegment; -import org.skywalking.apm.network.trace.component.ComponentsDefine; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class SingleHasEntryNoExitHasRefSpan { - - public static void main(String[] args) { - Post post = new Post(); - post.send(); - - try { - Thread.sleep(2000); - } catch (InterruptedException e) { - } - } - - static class Post { - private final Logger logger = LoggerFactory.getLogger(Post.class); - - public void send() { - ManagedChannel channel = ManagedChannelBuilder.forAddress("localhost", 11800).maxInboundMessageSize(1024 * 1024 * 50).usePlaintext(true).build(); - - int consumerApplicationId = 0; - int providerApplicationId = 0; - int consumerInstanceId = 0; - int providerInstanceId = 0; - int consumerEntryServiceId = 0; - int consumerExitServiceId = 0; - int consumerExitApplicationId = 0; - int providerEntryServiceId = 0; - - while (consumerApplicationId == 0) { - consumerApplicationId = ApplicationRegister.register(channel, "consumer"); - } - while (consumerExitApplicationId == 0) { - consumerExitApplicationId = ApplicationRegister.register(channel, "172.25.0.4:20880"); - } - while (providerApplicationId == 0) { - providerApplicationId = ApplicationRegister.register(channel, "provider"); - } - while (consumerInstanceId == 0) { - consumerInstanceId = InstanceRegister.register(channel, "ConsumerUUID", consumerApplicationId, "consumer_host_name", 1); - } - while (providerInstanceId == 0) { - providerInstanceId = InstanceRegister.register(channel, "ProviderUUID", providerApplicationId, "provider_host_name", 2); - } - while (consumerEntryServiceId == 0) { - consumerEntryServiceId = ServiceRegister.register(channel, consumerApplicationId, "/dubbox-case/case/dubbox-rest"); - } - while (consumerExitServiceId == 0) { - consumerExitServiceId = ServiceRegister.register(channel, consumerApplicationId, "org.skywaking.apm.testcase.dubbo.services.GreetService.doBusiness()"); - } - while (providerEntryServiceId == 0) { - providerEntryServiceId = ServiceRegister.register(channel, providerApplicationId, "org.skywaking.apm.testcase.dubbo.services.GreetService.doBusiness()"); - } - - TraceSegmentServiceGrpc.TraceSegmentServiceStub stub = TraceSegmentServiceGrpc.newStub(channel); - StreamObserver streamObserver = stub.collect(new StreamObserver() { - @Override public void onNext(Downstream downstream) { - } - - @Override public void onError(Throwable throwable) { - logger.error(throwable.getMessage(), throwable); - } - - @Override public void onCompleted() { - } - }); - - long now = System.currentTimeMillis(); - - int id = 1; - UniqueId.Builder builder = UniqueId.newBuilder(); - builder.addIdParts(id); - builder.addIdParts(id); - builder.addIdParts(id); - UniqueId segmentId = builder.build(); - - UpstreamSegment.Builder upstream = UpstreamSegment.newBuilder(); - upstream.addGlobalTraceIds(segmentId); - - TraceSegmentObject.Builder segmentBuilder = TraceSegmentObject.newBuilder(); - segmentBuilder.setApplicationId(consumerApplicationId); - segmentBuilder.setApplicationInstanceId(consumerInstanceId); - segmentBuilder.setTraceSegmentId(segmentId); - - TraceSegmentReference.Builder referenceBuilder = TraceSegmentReference.newBuilder(); - referenceBuilder.setEntryApplicationInstanceId(providerInstanceId); - referenceBuilder.setEntryServiceName("/rest/test"); - referenceBuilder.setParentApplicationInstanceId(providerInstanceId); - referenceBuilder.setParentServiceName("/rest/test"); - referenceBuilder.setRefType(RefType.CrossProcess); - referenceBuilder.setNetworkAddress("localhost:8080"); - segmentBuilder.addRefs(referenceBuilder); - - SpanObject.Builder entrySpan = SpanObject.newBuilder(); - entrySpan.setSpanId(0); - entrySpan.setSpanType(SpanType.Entry); - entrySpan.setSpanLayer(SpanLayer.Http); - entrySpan.setParentSpanId(-1); - entrySpan.setStartTime(now); - entrySpan.setEndTime(now + 3000); - entrySpan.setComponentId(ComponentsDefine.TOMCAT.getId()); - entrySpan.setOperationNameId(consumerEntryServiceId); - entrySpan.setIsError(false); - segmentBuilder.addSpans(entrySpan); - - upstream.setSegment(segmentBuilder.build().toByteString()); - - streamObserver.onNext(upstream.build()); - streamObserver.onCompleted(); - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/test/java/org/skywalking/apm/collector/agentstream/mock/grpc/SingleHasEntryNoExitNoRefSpan.java b/apm-collector-3.2.3/apm-collector-agentstream/src/test/java/org/skywalking/apm/collector/agentstream/mock/grpc/SingleHasEntryNoExitNoRefSpan.java deleted file mode 100644 index 0d2db0b0ae..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/test/java/org/skywalking/apm/collector/agentstream/mock/grpc/SingleHasEntryNoExitNoRefSpan.java +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.mock.grpc; - -import io.grpc.ManagedChannel; -import io.grpc.ManagedChannelBuilder; -import io.grpc.stub.StreamObserver; -import org.skywalking.apm.network.proto.Downstream; -import org.skywalking.apm.network.proto.SpanLayer; -import org.skywalking.apm.network.proto.SpanObject; -import org.skywalking.apm.network.proto.SpanType; -import org.skywalking.apm.network.proto.TraceSegmentObject; -import org.skywalking.apm.network.proto.TraceSegmentServiceGrpc; -import org.skywalking.apm.network.proto.UniqueId; -import org.skywalking.apm.network.proto.UpstreamSegment; -import org.skywalking.apm.network.trace.component.ComponentsDefine; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class SingleHasEntryNoExitNoRefSpan { - - public static void main(String[] args) { - Post post = new Post(); - post.send(); - - try { - Thread.sleep(2000); - } catch (InterruptedException e) { - } - } - - static class Post { - private final Logger logger = LoggerFactory.getLogger(Post.class); - - public void send() { - ManagedChannel channel = ManagedChannelBuilder.forAddress("localhost", 11800).maxInboundMessageSize(1024 * 1024 * 50).usePlaintext(true).build(); - - int applicationId = 0; - int instanceId = 0; - int entryServiceId = 0; - while (applicationId == 0) { - applicationId = ApplicationRegister.register(channel, "consumer"); - } - - while (instanceId == 0) { - instanceId = InstanceRegister.register(channel, "ConsumerUUID", applicationId, "consumer_host_name", 1); - } - - while (entryServiceId == 0) { - entryServiceId = ServiceRegister.register(channel, applicationId, "/dubbox-case/case/dubbox-rest"); - } - - TraceSegmentServiceGrpc.TraceSegmentServiceStub stub = TraceSegmentServiceGrpc.newStub(channel); - StreamObserver streamObserver = stub.collect(new StreamObserver() { - @Override public void onNext(Downstream downstream) { - } - - @Override public void onError(Throwable throwable) { - logger.error(throwable.getMessage(), throwable); - } - - @Override public void onCompleted() { - } - }); - - long now = System.currentTimeMillis(); - - int id = 1; - UniqueId.Builder builder = UniqueId.newBuilder(); - builder.addIdParts(id); - builder.addIdParts(id); - builder.addIdParts(id); - UniqueId segmentId = builder.build(); - - UpstreamSegment.Builder upstream = UpstreamSegment.newBuilder(); - upstream.addGlobalTraceIds(segmentId); - - TraceSegmentObject.Builder segmentBuilder = TraceSegmentObject.newBuilder(); - segmentBuilder.setApplicationId(applicationId); - segmentBuilder.setApplicationInstanceId(instanceId); - segmentBuilder.setTraceSegmentId(segmentId); - - SpanObject.Builder entrySpan = SpanObject.newBuilder(); - entrySpan.setSpanId(0); - entrySpan.setSpanType(SpanType.Entry); - entrySpan.setSpanLayer(SpanLayer.Http); - entrySpan.setParentSpanId(-1); - entrySpan.setStartTime(now); - entrySpan.setEndTime(now + 3000); - entrySpan.setComponentId(ComponentsDefine.TOMCAT.getId()); - entrySpan.setOperationNameId(entryServiceId); - entrySpan.setIsError(false); - segmentBuilder.addSpans(entrySpan); - - upstream.setSegment(segmentBuilder.build().toByteString()); - - streamObserver.onNext(upstream.build()); - streamObserver.onCompleted(); - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/test/java/org/skywalking/apm/collector/agentstream/mock/grpc/SingleNoEntryHasExitNoRefSpan.java b/apm-collector-3.2.3/apm-collector-agentstream/src/test/java/org/skywalking/apm/collector/agentstream/mock/grpc/SingleNoEntryHasExitNoRefSpan.java deleted file mode 100644 index cad21030af..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/test/java/org/skywalking/apm/collector/agentstream/mock/grpc/SingleNoEntryHasExitNoRefSpan.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.mock.grpc; - -import io.grpc.ManagedChannel; -import io.grpc.ManagedChannelBuilder; -import io.grpc.stub.StreamObserver; -import org.skywalking.apm.network.proto.Downstream; -import org.skywalking.apm.network.proto.SpanLayer; -import org.skywalking.apm.network.proto.SpanObject; -import org.skywalking.apm.network.proto.SpanType; -import org.skywalking.apm.network.proto.TraceSegmentObject; -import org.skywalking.apm.network.proto.TraceSegmentServiceGrpc; -import org.skywalking.apm.network.proto.UniqueId; -import org.skywalking.apm.network.proto.UpstreamSegment; -import org.skywalking.apm.network.trace.component.ComponentsDefine; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class SingleNoEntryHasExitNoRefSpan { - - public static void main(String[] args) { - Post post = new Post(); - post.send(); - - try { - Thread.sleep(2000); - } catch (InterruptedException e) { - } - } - - static class Post { - private final Logger logger = LoggerFactory.getLogger(Post.class); - - public void send() { - ManagedChannel channel = ManagedChannelBuilder.forAddress("localhost", 11800).maxInboundMessageSize(1024 * 1024 * 50).usePlaintext(true).build(); - - int applicationId = 0; - int instanceId = 0; - int entryServiceId = 0; - while (applicationId == 0) { - applicationId = ApplicationRegister.register(channel, "consumer"); - } - - while (instanceId == 0) { - instanceId = InstanceRegister.register(channel, "ConsumerUUID", applicationId, "consumer_host_name", 1); - } - - while (entryServiceId == 0) { - entryServiceId = ServiceRegister.register(channel, applicationId, "/dubbox-case/case/dubbox-rest"); - } - - TraceSegmentServiceGrpc.TraceSegmentServiceStub stub = TraceSegmentServiceGrpc.newStub(channel); - StreamObserver streamObserver = stub.collect(new StreamObserver() { - @Override public void onNext(Downstream downstream) { - } - - @Override public void onError(Throwable throwable) { - logger.error(throwable.getMessage(), throwable); - } - - @Override public void onCompleted() { - } - }); - - long now = System.currentTimeMillis(); - - int id = 1; - UniqueId.Builder builder = UniqueId.newBuilder(); - builder.addIdParts(id); - builder.addIdParts(id); - builder.addIdParts(id); - UniqueId segmentId = builder.build(); - - UpstreamSegment.Builder upstream = UpstreamSegment.newBuilder(); - upstream.addGlobalTraceIds(segmentId); - - TraceSegmentObject.Builder segmentBuilder = TraceSegmentObject.newBuilder(); - segmentBuilder.setApplicationId(applicationId); - segmentBuilder.setApplicationInstanceId(instanceId); - segmentBuilder.setTraceSegmentId(segmentId); - - SpanObject.Builder exitSpan = SpanObject.newBuilder(); - exitSpan.setSpanId(0); - exitSpan.setSpanType(SpanType.Exit); - exitSpan.setSpanLayer(SpanLayer.Database); - exitSpan.setParentSpanId(-1); - exitSpan.setStartTime(now); - exitSpan.setEndTime(now + 3000); - exitSpan.setComponentId(ComponentsDefine.MONGODB.getId()); - exitSpan.setOperationNameId(entryServiceId); - exitSpan.setIsError(false); - exitSpan.setPeer("localhost:8888"); - segmentBuilder.addSpans(exitSpan); - - upstream.setSegment(segmentBuilder.build().toByteString()); - - streamObserver.onNext(upstream.build()); - streamObserver.onCompleted(); - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/test/java/org/skywalking/apm/collector/agentstream/worker/segment/buffer/SegmentBufferWriteWorkerTestCase.java b/apm-collector-3.2.3/apm-collector-agentstream/src/test/java/org/skywalking/apm/collector/agentstream/worker/segment/buffer/SegmentBufferWriteWorkerTestCase.java deleted file mode 100644 index 79b2309a78..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/test/java/org/skywalking/apm/collector/agentstream/worker/segment/buffer/SegmentBufferWriteWorkerTestCase.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.agentstream.worker.segment.buffer; - -import org.skywalking.apm.collector.agentstream.worker.segment.standardization.SegmentStandardizationWorker; -import org.skywalking.apm.collector.stream.worker.ProviderNotFoundException; -import org.skywalking.apm.collector.stream.worker.WorkerException; -import org.skywalking.apm.network.proto.SpanLayer; -import org.skywalking.apm.network.proto.SpanObject; -import org.skywalking.apm.network.proto.SpanType; -import org.skywalking.apm.network.proto.TraceSegmentObject; -import org.skywalking.apm.network.proto.UniqueId; -import org.skywalking.apm.network.proto.UpstreamSegment; -import org.skywalking.apm.network.trace.component.ComponentsDefine; - -/** - * @author peng-yongsheng - */ -public class SegmentBufferWriteWorkerTestCase { - - public static void main(String[] args) throws WorkerException, ProviderNotFoundException { - - SegmentBufferConfig.BUFFER_PATH = "/Users/peng-yongsheng/code/sky-walking/sky-walking/apm-collector/buffer/"; - SegmentStandardizationWorker worker = new SegmentStandardizationWorker(null, null); - worker.preStart(); - worker.allocateJob(buildSegment()); - worker.allocateJob(buildSegment()); - worker.allocateJob(buildSegment()); - worker.allocateJob(buildSegment()); - worker.allocateJob(buildSegment()); - } - - private static UpstreamSegment buildSegment() { - long now = System.currentTimeMillis(); - - int id = 1; - UniqueId.Builder builder = UniqueId.newBuilder(); - builder.addIdParts(id); - builder.addIdParts(id); - builder.addIdParts(id); - UniqueId segmentId = builder.build(); - - UpstreamSegment.Builder upstream = UpstreamSegment.newBuilder(); - upstream.addGlobalTraceIds(segmentId); - - TraceSegmentObject.Builder segmentBuilder = TraceSegmentObject.newBuilder(); - segmentBuilder.setApplicationId(1); - segmentBuilder.setApplicationInstanceId(1); - segmentBuilder.setTraceSegmentId(segmentId); - - SpanObject.Builder entrySpan = SpanObject.newBuilder(); - entrySpan.setSpanId(0); - entrySpan.setSpanType(SpanType.Entry); - entrySpan.setSpanLayer(SpanLayer.Http); - entrySpan.setParentSpanId(-1); - entrySpan.setStartTime(now); - entrySpan.setEndTime(now + 3000); - entrySpan.setComponentId(ComponentsDefine.TOMCAT.getId()); - entrySpan.setOperationNameId(1); - entrySpan.setIsError(false); - segmentBuilder.addSpans(entrySpan); - - SpanObject.Builder exitSpan = SpanObject.newBuilder(); - exitSpan.setSpanId(1); - exitSpan.setSpanType(SpanType.Exit); - exitSpan.setSpanLayer(SpanLayer.Database); - exitSpan.setParentSpanId(0); - exitSpan.setStartTime(now); - exitSpan.setEndTime(now + 3000); - exitSpan.setComponentId(ComponentsDefine.MONGODB.getId()); - exitSpan.setOperationNameId(2); - exitSpan.setIsError(false); - exitSpan.setPeer("localhost:8888"); - segmentBuilder.addSpans(exitSpan); - - upstream.setSegment(segmentBuilder.build().toByteString()); - return upstream.build(); - } -} diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/test/resources/json/segment/normal/application-register.json b/apm-collector-3.2.3/apm-collector-agentstream/src/test/resources/json/segment/normal/application-register.json deleted file mode 100644 index eb829c2cb4..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/test/resources/json/segment/normal/application-register.json +++ /dev/null @@ -1,4 +0,0 @@ -[ - "dubbox-consumer", - "dubbox-provider" -] \ No newline at end of file diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/test/resources/json/segment/normal/dubbox-consumer.json b/apm-collector-3.2.3/apm-collector-agentstream/src/test/resources/json/segment/normal/dubbox-consumer.json deleted file mode 100644 index 57c79c9c31..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/test/resources/json/segment/normal/dubbox-consumer.json +++ /dev/null @@ -1,71 +0,0 @@ -[ - { - "gt": [ - [ - 230150, - 185809, - 24040000 - ] - ], - "sg": { - "ts": [ - 230150, - 185809, - 24040000 - ], - "ai": 2, - "ii": 2, - "rs": [], - "ss": [ - { - "si": 1, - "tv": 1, - "lv": 1, - "ps": 0, - "st": 1501858094526, - "et": 1501858097004, - "ci": 3, - "cn": "", - "oi": 0, - "on": "org.skywaking.apm.testcase.dubbo.services.GreetService.doBusiness()", - "pi": 0, - "pn": "172.25.0.4:20880", - "ie": false, - "to": [ - { - "k": "url", - "v": "rest://172.25.0.4:20880/org.skywaking.apm.testcase.dubbo.services.GreetService.doBusiness()" - } - ], - "lo": [] - }, - { - "si": 0, - "tv": 0, - "lv": 2, - "ps": -1, - "st": 1501858092409, - "et": 1501858097033, - "ci": 1, - "cn": "", - "oi": 0, - "on": "/dubbox-case/case/dubbox-rest", - "pi": 0, - "pn": "", - "ie": false, - "to": [ - { - "k": "url", - "v": "http://localhost:18080/dubbox-case/case/dubbox-rest" - }, - { - "k": "http.method", - "v": "GET" - } - ], - "lo": [] - } - ] - } - } -] \ No newline at end of file diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/test/resources/json/segment/normal/dubbox-provider.json b/apm-collector-3.2.3/apm-collector-agentstream/src/test/resources/json/segment/normal/dubbox-provider.json deleted file mode 100644 index 28a61aee08..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/test/resources/json/segment/normal/dubbox-provider.json +++ /dev/null @@ -1,67 +0,0 @@ -[ - { - "gt": [ - [ - 230150, - 185809, - 24040000 - ] - ], - "sg": { - "ts": [ - 137150, - 185809, - 48780000 - ], - "ai": 3, - "ii": 3, - "rs": [ - { - "ts": [ - 230150, - 185809, - 24040000 - ], - "ai": 2, - "si": 1, - "vi": 0, - "vn": "/dubbox-case/case/dubbox-rest", - "ni": 0, - "nn": "172.25.0.4:20880", - "ea": 2, - "ei": 0, - "en": "/dubbox-case/case/dubbox-rest", - "rn": 0 - } - ], - "ss": [ - { - "si": 0, - "tv": 0, - "lv": 2, - "ps": -1, - "st": 1501858094726, - "et": 1501858096804, - "ci": 3, - "cn": "", - "oi": 0, - "on": "org.skywaking.apm.testcase.dubbo.services.GreetService.doBusiness()", - "pi": 0, - "pn": "", - "ie": false, - "to": [ - { - "k": "url", - "v": "rest://172.25.0.4:20880/org.skywaking.apm.testcase.dubbo.services.GreetService.doBusiness()" - }, - { - "k": "http.method", - "v": "GET" - } - ], - "lo": [] - } - ] - } - } -] \ No newline at end of file diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/test/resources/json/segment/normal/instance-register.json b/apm-collector-3.2.3/apm-collector-agentstream/src/test/resources/json/segment/normal/instance-register.json deleted file mode 100644 index f29ab121d7..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/test/resources/json/segment/normal/instance-register.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "ai": 0, - "au": "dubbox-consumer", - "rt": 1501858094526 -} \ No newline at end of file diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/test/resources/log4j2.xml b/apm-collector-3.2.3/apm-collector-agentstream/src/test/resources/log4j2.xml deleted file mode 100644 index d36a4408f4..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/test/resources/log4j2.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/apm-collector-3.2.3/apm-collector-agentstream/src/test/resources/logback.xml b/apm-collector-3.2.3/apm-collector-agentstream/src/test/resources/logback.xml deleted file mode 100644 index 9fc407992b..0000000000 --- a/apm-collector-3.2.3/apm-collector-agentstream/src/test/resources/logback.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n - - - - - - - - - - - \ No newline at end of file diff --git a/apm-collector-3.2.3/apm-collector-boot/bin/collector-service.bat b/apm-collector-3.2.3/apm-collector-boot/bin/collector-service.bat deleted file mode 100644 index eb58f7ebcc..0000000000 --- a/apm-collector-3.2.3/apm-collector-boot/bin/collector-service.bat +++ /dev/null @@ -1,23 +0,0 @@ -@echo off - -setlocal -set COLLECOTR_PROCESS_TITLE=Skywalking-Collector -set COLLECTOR_BASE_PATH=%~dp0%.. -set COLLECTOR_RUNTIME_OPTIONS="-Xms256M -Xmx512M -Dcollector.logDir=%COLLECTOR_BASE_PATH%\logs" - -set CLASSPATH=%COLLECTOR_BASE_PATH%\config; -SET CLASSPATH=%COLLECTOR_BASE_PATH%\libs\*;%CLASSPATH% - -if defined JAVA_HOME ( - set _EXECJAVA="%JAVA_HOME:"=%"\bin\java -) - -if not defined JAVA_HOME ( - echo "JAVA_HOME not set." - set _EXECJAVA=java -) - -start /MIN "%COLLECOTR_PROCESS_TITLE%" %_EXECJAVA% "%COLLECTOR_RUNTIME_OPTIONS%" -cp "%CLASSPATH%" org.skywalking.apm.collector.boot.CollectorBootStartUp & -echo Collector started successfully! - -endlocal diff --git a/apm-collector-3.2.3/apm-collector-boot/bin/collector-service.sh b/apm-collector-3.2.3/apm-collector-boot/bin/collector-service.sh deleted file mode 100644 index 993fa0217c..0000000000 --- a/apm-collector-3.2.3/apm-collector-boot/bin/collector-service.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/usr/bin/env bash - -PRG="$0" -PRGDIR=`dirname "$PRG"` -[ -z "$COLLECTOR_HOME" ] && COLLECTOR_HOME=`cd "$PRGDIR/.." >/dev/null; pwd` - -COLLECTOR_LOGS_DIR="${COLLECTOR_HOME}/logs" -JAVA_OPTS=" -Xms256M -Xmx512M" - -if [ ! -d "${COLLECTOR_HOME}/logs" ]; then - mkdir -p "${COLLECTOR_LOGS_DIR}" -fi - -_RUNJAVA=${JAVA_HOME}/bin/java -[ -z "$JAVA_HOME" ] && _RUNJAVA=java - -CLASSPATH="$COLLECTOR_HOME/config:$CLASSPATH" -for i in "$COLLECTOR_HOME"/libs/*.jar -do - CLASSPATH="$i:$CLASSPATH" -done -COLLECTOR_OPTIONS=" -Dcollector.logDir=$COLLECTOR_LOGS_DIR" -echo "Starting collector...." - -eval exec "\"$_RUNJAVA\" ${JAVA_OPTS} ${COLLECTOR_OPTIONS} -classpath $CLASSPATH org.skywalking.apm.collector.boot.CollectorBootStartUp \ - 2>${COLLECTOR_LOGS_DIR}/collector.log 1> /dev/null &" - -retval=$? -pid=$! -FAIL_MSG="Collector started failure!" -SUCCESS_MSG="Collector started successfully!" -[ ${retval} -eq 0 ] || (echo ${FAIL_MSG}; exit ${retval}) -sleep 1 -if ! ps -p ${pid} > /dev/null ; then - echo ${FAIL_MSG} - exit 1 -fi -echo ${SUCCESS_MSG} diff --git a/apm-collector-3.2.3/apm-collector-boot/bin/startup.bat b/apm-collector-3.2.3/apm-collector-boot/bin/startup.bat deleted file mode 100644 index 22023060de..0000000000 --- a/apm-collector-3.2.3/apm-collector-boot/bin/startup.bat +++ /dev/null @@ -1,5 +0,0 @@ -@echo off - -setlocal -call "%~dp0"\collector-service.bat start -endlocal \ No newline at end of file diff --git a/apm-collector-3.2.3/apm-collector-boot/bin/startup.sh b/apm-collector-3.2.3/apm-collector-boot/bin/startup.sh deleted file mode 100644 index 7f9c0d3abe..0000000000 --- a/apm-collector-3.2.3/apm-collector-boot/bin/startup.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env bash - -PRG="$0" -PRGDIR=`dirname "$PRG"` -EXECUTABLE=collector-service.sh - -exec "$PRGDIR"/"$EXECUTABLE" start \ No newline at end of file diff --git a/apm-collector-3.2.3/apm-collector-boot/docker/Dockerfile b/apm-collector-3.2.3/apm-collector-boot/docker/Dockerfile deleted file mode 100644 index 8e5539028f..0000000000 --- a/apm-collector-3.2.3/apm-collector-boot/docker/Dockerfile +++ /dev/null @@ -1,28 +0,0 @@ -FROM openjdk:8u111-jdk - -ENV ZK_ADDRESSES=127.0.0.1:2181 \ - ES_CLUSTER_NAME=CollectorDBCluster \ - ES_ADDRESSES=localhost:9300 \ - BIND_HOST=localhost \ - CLUSTER_BIND_HOST=localhost \ - CLUSTER_BIND_PORT=11800 \ - UI_BIND_HOST=localhost \ - UI_BIND_PORT=12800 \ - GRPC_BIND_PORT=11800 \ - AGENT_SERVER_BIND_PORT=10800 \ - AGENT_STREAM_JETTY_BIND_PORT=12800 - -ADD skywalking-collector.tar.gz /usr/local -COPY collector-service.sh /usr/local/skywalking-collector/bin -COPY log4j2.xml /usr/local/skywalking-collector/config -COPY application.yml /usr/local/skywalking-collector/config -COPY docker-entrypoint.sh / - -RUN chmod +x /usr/local/skywalking-collector/bin/collector-service.sh && chmod +x /docker-entrypoint.sh - -EXPOSE 10800 -EXPOSE 11800 -EXPOSE 12800 - -ENTRYPOINT ["/docker-entrypoint.sh"] -CMD ["/usr/local/skywalking-collector/bin/collector-service.sh"] diff --git a/apm-collector-3.2.3/apm-collector-boot/docker/application.yml b/apm-collector-3.2.3/apm-collector-boot/docker/application.yml deleted file mode 100644 index a8ab6e69a2..0000000000 --- a/apm-collector-3.2.3/apm-collector-boot/docker/application.yml +++ /dev/null @@ -1,33 +0,0 @@ -cluster: - zookeeper: - hostPort: {ZK_ADDRESSES} - sessionTimeout: 100000 -agent_server: - jetty: - host: {BIND_HOST} - port: {AGENT_SERVER_BIND_PORT} - context_path: / -agent_stream: - grpc: - host: {BIND_HOST} - port: {GRPC_BIND_PORT} - jetty: - host: {UI_BIND_HOST} - port: {UI_BIND_PORT} - context_path: / -ui: - jetty: - host: {UI_BIND_HOST} - port: {UI_BIND_PORT} - context_path: / -collector_inside: - grpc: - host: {CLUSTER_BIND_HOST} - port: {CLUSTER_BIND_PORT} -storage: - elasticsearch: - cluster_name: {ES_CLUSTER_NAME} - cluster_transport_sniffer: true - cluster_nodes: {ES_ADDRESSES} - index_shards_number: 2 - index_replicas_number: 0 diff --git a/apm-collector-3.2.3/apm-collector-boot/docker/collector-service.sh b/apm-collector-3.2.3/apm-collector-boot/docker/collector-service.sh deleted file mode 100644 index 67baa12a75..0000000000 --- a/apm-collector-3.2.3/apm-collector-boot/docker/collector-service.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env bash - -PRG="$0" -PRGDIR=`dirname "$PRG"` -[ -z "$COLLECTOR_HOME" ] && COLLECTOR_HOME=`cd "$PRGDIR/.." >/dev/null; pwd` - -CLASSPATH="$COLLECTOR_HOME/config:$CLASSPATH" -for i in "$COLLECTOR_HOME"/libs/*.jar -do - CLASSPATH="$i:$CLASSPATH" -done - -java ${JAVA_OPTS} ${COLLECTOR_OPTIONS} -classpath $CLASSPATH org.skywalking.apm.collector.boot.CollectorBootStartUp diff --git a/apm-collector-3.2.3/apm-collector-boot/docker/docker-entrypoint.sh b/apm-collector-3.2.3/apm-collector-boot/docker/docker-entrypoint.sh deleted file mode 100644 index 222d2feda4..0000000000 --- a/apm-collector-3.2.3/apm-collector-boot/docker/docker-entrypoint.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/sh - -echo "replace {ZK_ADDRESSES} to ${ZK_ADDRESSES}" -eval sed -i -e 's/\{ZK_ADDRESSES\}/${ZK_ADDRESSES}/' /usr/local/skywalking-collector/config/application.yml - -echo "replace {ES_CLUSTER_NAME} to ${ES_CLUSTER_NAME}" -eval sed -i -e 's/\{ES_CLUSTER_NAME\}/${ES_CLUSTER_NAME}/' /usr/local/skywalking-collector/config/application.yml - -echo "replace {ES_ADDRESSES} to ${ES_ADDRESSES}" -eval sed -i -e 's/\{ES_ADDRESSES\}/${ES_ADDRESSES}/' /usr/local/skywalking-collector/config/application.yml - -echo "replace {BIND_HOST} to ${BIND_HOST}" -eval sed -i -e 's/\{BIND_HOST\}/${BIND_HOST}/' /usr/local/skywalking-collector/config/application.yml - -echo "replace {GRPC_BIND_PORT} to ${GRPC_BIND_PORT}" -eval sed -i -e 's/\{GRPC_BIND_PORT\}/${GRPC_BIND_PORT}/' /usr/local/skywalking-collector/config/application.yml - -echo "replace {AGENT_SERVER_BIND_PORT} to ${AGENT_SERVER_BIND_PORT}" -eval sed -i -e 's/\{AGENT_SERVER_BIND_PORT\}/${AGENT_SERVER_BIND_PORT}/' /usr/local/skywalking-collector/config/application.yml - -echo "replace {AGENT_STREAM_JETTY_BIND_PORT} to ${AGENT_STREAM_JETTY_BIND_PORT}" -eval sed -i -e 's/\{AGENT_STREAM_JETTY_BIND_PORT\}/${AGENT_STREAM_JETTY_BIND_PORT}/' /usr/local/skywalking-collector/config/application.yml - -echo "replace {UI_BIND_HOST} to ${UI_BIND_HOST}" -eval sed -i -e 's/\{UI_BIND_HOST\}/${UI_BIND_HOST}/' /usr/local/skywalking-collector/config/application.yml - -echo "replace {UI_BIND_PORT} to ${UI_BIND_PORT}" -eval sed -i -e 's/\{UI_BIND_PORT\}/${UI_BIND_PORT}/' /usr/local/skywalking-collector/config/application.yml - -echo "replace {CLUSTER_BIND_HOST} to ${CLUSTER_BIND_HOST}" -eval sed -i -e 's/\{CLUSTER_BIND_HOST\}/${CLUSTER_BIND_HOST}/' /usr/local/skywalking-collector/config/application.yml - -echo "replace {CLUSTER_BIND_PORT} to ${CLUSTER_BIND_PORT}" -eval sed -i -e 's/\{CLUSTER_BIND_PORT\}/${CLUSTER_BIND_PORT}/' /usr/local/skywalking-collector/config/application.yml - - -exec "$@" diff --git a/apm-collector-3.2.3/apm-collector-boot/docker/log4j2.xml b/apm-collector-3.2.3/apm-collector-boot/docker/log4j2.xml deleted file mode 100644 index 44e2c384f4..0000000000 --- a/apm-collector-3.2.3/apm-collector-boot/docker/log4j2.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/apm-collector-3.2.3/apm-collector-boot/pom.xml b/apm-collector-3.2.3/apm-collector-boot/pom.xml deleted file mode 100644 index ae19d6fffd..0000000000 --- a/apm-collector-3.2.3/apm-collector-boot/pom.xml +++ /dev/null @@ -1,152 +0,0 @@ - - - - - - apm-collector-3.2.3 - org.skywalking - 3.2.4-2017 - - 4.0.0 - - apm-collector-boot - jar - - - org.skywalking.apm.collector.boot.CollectorBootStartUp - UTF-8 - skywalking/skywalking-collector - ${version} - - - - - org.skywalking - apm-collector-3.2.3-cluster - ${project.version} - - - org.skywalking - apm-collector-3.2.3-queue - ${project.version} - - - org.skywalking - apm-collector-storage - ${project.version} - - - org.skywalking - apm-collector-3.2.3-ui - ${project.version} - - - org.skywalking - apm-collector-3.2.3-agentserver - ${project.version} - - - org.skywalking - apm-collector-3.2.3-agentstream - ${project.version} - - - org.skywalking - apm-collector-3.2.3-agentregister - ${project.version} - - - org.skywalking - apm-collector-3.2.3-agentjvm - ${project.version} - - - - - skywalking-collector - - - org.apache.maven.plugins - maven-jar-plugin - 2.3.2 - - - *.xml - *.config - *.yml - - - - ${main.class} - - - - - - org.apache.maven.plugins - maven-assembly-plugin - - - assembly - package - - single - - - - src/main/assembly/assembly.xml - - ${project.basedir}/../../packages - - - - - - com.spotify - docker-maven-plugin - ${docker.plugin.version} - - false - ${docker.image.name} - - ${docker.image.version} - - ${project.basedir}/docker - - - / - ${project.basedir}/../../packages - ${build.finalName}.tar.gz - - - - - - org.apache.maven.plugins - maven-resources-plugin - 2.4.3 - - ${project.build.sourceEncoding} - - - - - diff --git a/apm-collector-3.2.3/apm-collector-boot/src/main/assembly/assembly.xml b/apm-collector-3.2.3/apm-collector-boot/src/main/assembly/assembly.xml deleted file mode 100644 index b1e6e3ec11..0000000000 --- a/apm-collector-3.2.3/apm-collector-boot/src/main/assembly/assembly.xml +++ /dev/null @@ -1,60 +0,0 @@ - - - - - - tar.gz - zip - - - - /libs - runtime - - - - - ${project.basedir}/bin - /bin - - *.sh - *.bat - - 0755 - - - src/main/resources - - application.yml - - - /config - - - src/main/assembly - - log4j2.xml - - /config - - - diff --git a/apm-collector-3.2.3/apm-collector-boot/src/main/assembly/log4j2.xml b/apm-collector-3.2.3/apm-collector-boot/src/main/assembly/log4j2.xml deleted file mode 100644 index 265dd33583..0000000000 --- a/apm-collector-3.2.3/apm-collector-boot/src/main/assembly/log4j2.xml +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - ${sys:collector.logDir} - - - - - %d - %c -%-4r [%t] %-5p %x - %m%n - - - - - - - - - - - - - - - - diff --git a/apm-collector-3.2.3/apm-collector-boot/src/main/java/org/skywalking/apm/collector/boot/CollectorBootStartUp.java b/apm-collector-3.2.3/apm-collector-boot/src/main/java/org/skywalking/apm/collector/boot/CollectorBootStartUp.java deleted file mode 100644 index f4746bf2f5..0000000000 --- a/apm-collector-3.2.3/apm-collector-boot/src/main/java/org/skywalking/apm/collector/boot/CollectorBootStartUp.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.boot; - -import org.skywalking.apm.collector.core.CollectorException; -import org.skywalking.apm.collector.core.config.SystemConfigParser; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class CollectorBootStartUp { - - private static final Logger logger = LoggerFactory.getLogger(CollectorBootStartUp.class); - - public static void main(String[] args) throws CollectorException { - logger.info("collector starting..."); - SystemConfigParser.INSTANCE.parse(); - CollectorStarter starter = new CollectorStarter(); - starter.start(); - logger.info("collector start successful."); - } -} diff --git a/apm-collector-3.2.3/apm-collector-boot/src/main/java/org/skywalking/apm/collector/boot/CollectorStarter.java b/apm-collector-3.2.3/apm-collector-boot/src/main/java/org/skywalking/apm/collector/boot/CollectorStarter.java deleted file mode 100644 index b8902cc81f..0000000000 --- a/apm-collector-3.2.3/apm-collector-boot/src/main/java/org/skywalking/apm/collector/boot/CollectorStarter.java +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.boot; - -import java.util.Map; -import org.skywalking.apm.collector.cluster.ClusterModuleGroupDefine; -import org.skywalking.apm.collector.core.CollectorException; -import org.skywalking.apm.collector.core.framework.Starter; -import org.skywalking.apm.collector.core.module.ModuleConfigLoader; -import org.skywalking.apm.collector.core.module.ModuleDefine; -import org.skywalking.apm.collector.core.module.ModuleDefineLoader; -import org.skywalking.apm.collector.core.module.ModuleGroupDefine; -import org.skywalking.apm.collector.core.module.ModuleGroupDefineLoader; -import org.skywalking.apm.collector.core.server.ServerException; -import org.skywalking.apm.collector.core.server.ServerHolder; -import org.skywalking.apm.collector.core.util.CollectionUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class CollectorStarter implements Starter { - - private final Logger logger = LoggerFactory.getLogger(CollectorStarter.class); - private Map moduleGroupDefineMap; - - @Override public void start() throws CollectorException { - ModuleConfigLoader configLoader = new ModuleConfigLoader(); - Map configuration = configLoader.load(); - - ModuleGroupDefineLoader groupDefineLoader = new ModuleGroupDefineLoader(); - moduleGroupDefineMap = groupDefineLoader.load(); - - ModuleDefineLoader defineLoader = new ModuleDefineLoader(); - Map> moduleDefineMap = defineLoader.load(); - - ServerHolder serverHolder = new ServerHolder(); - for (ModuleGroupDefine moduleGroupDefine : moduleGroupDefineMap.values()) { - if (moduleGroupDefine.groupConfigParser() != null) { - moduleGroupDefine.groupConfigParser().parse(configuration.get(moduleGroupDefine.name())); - } - moduleGroupDefine.moduleInstaller().injectConfiguration(configuration.get(moduleGroupDefine.name()), moduleDefineMap.get(moduleGroupDefine.name())); - moduleGroupDefine.moduleInstaller().injectServerHolder(serverHolder); - moduleGroupDefine.moduleInstaller().preInstall(); - } - - moduleGroupDefineMap.get(ClusterModuleGroupDefine.GROUP_NAME).moduleInstaller().install(); - - for (ModuleGroupDefine moduleGroupDefine : moduleGroupDefineMap.values()) { - if (!(moduleGroupDefine instanceof ClusterModuleGroupDefine)) { - moduleGroupDefine.moduleInstaller().install(); - } - } - - serverHolder.getServers().forEach(server -> { - try { - server.start(); - } catch (ServerException e) { - logger.error(e.getMessage(), e); - } - }); - - dependenceAfterInstall(); - } - - private void dependenceAfterInstall() throws CollectorException { - for (ModuleGroupDefine moduleGroupDefine : moduleGroupDefineMap.values()) { - moduleInstall(moduleGroupDefine); - } - } - - private void moduleInstall(ModuleGroupDefine moduleGroupDefine) throws CollectorException { - if (CollectionUtils.isNotEmpty(moduleGroupDefine.moduleInstaller().dependenceModules())) { - for (String groupName : moduleGroupDefine.moduleInstaller().dependenceModules()) { - moduleInstall(moduleGroupDefineMap.get(groupName)); - } - logger.info("after install module group: {}", moduleGroupDefine.name()); - moduleGroupDefine.moduleInstaller().afterInstall(); - } else { - logger.info("after install module group: {}", moduleGroupDefine.name()); - moduleGroupDefine.moduleInstaller().afterInstall(); - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-boot/src/main/resources/application.yml b/apm-collector-3.2.3/apm-collector-boot/src/main/resources/application.yml deleted file mode 100644 index 8a4f7b3b6f..0000000000 --- a/apm-collector-3.2.3/apm-collector-boot/src/main/resources/application.yml +++ /dev/null @@ -1,40 +0,0 @@ -#cluster: -# zookeeper: -# hostPort: localhost:2181 -# sessionTimeout: 100000 -agent_server: - jetty: - host: localhost - port: 10800 - context_path: / -agent_stream: - grpc: - host: localhost - port: 11800 - jetty: - host: localhost - port: 12800 - context_path: / - config: - buffer_offset_max_file_size: 10M - buffer_segment_max_file_size: 500M -ui: - jetty: - host: localhost - port: 12800 - context_path: / -collector_inside: - grpc: - host: localhost - port: 11800 -#storage: -# elasticsearch: -# cluster_name: CollectorDBCluster -# cluster_transport_sniffer: true -# cluster_nodes: localhost:9300 -# index_shards_number: 2 -# index_replicas_number: 0 -#storage: -# h2: -# url: jdbc:h2:tcp://localhost/~/test -# user_name: sa \ No newline at end of file diff --git a/apm-collector-3.2.3/apm-collector-boot/src/main/resources/log4j2.xml b/apm-collector-3.2.3/apm-collector-boot/src/main/resources/log4j2.xml deleted file mode 100644 index a76ab8c130..0000000000 --- a/apm-collector-3.2.3/apm-collector-boot/src/main/resources/log4j2.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/apm-collector-3.2.3/apm-collector-cache/pom.xml b/apm-collector-3.2.3/apm-collector-cache/pom.xml deleted file mode 100644 index 0b1dfbb0af..0000000000 --- a/apm-collector-3.2.3/apm-collector-cache/pom.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - apm-collector-3.2.3 - org.skywalking - 3.2.4-2017 - - 4.0.0 - - apm-collector-3.2.3-cache - jar - - - - org.skywalking - apm-collector-3.2.3-core - ${project.version} - - - org.skywalking - apm-collector-3.2.3-storage - ${project.version} - - - diff --git a/apm-collector-3.2.3/apm-collector-cache/src/main/java/org/skywalking/apm/collector/cache/ApplicationCache.java b/apm-collector-3.2.3/apm-collector-cache/src/main/java/org/skywalking/apm/collector/cache/ApplicationCache.java deleted file mode 100644 index 1c1498a432..0000000000 --- a/apm-collector-3.2.3/apm-collector-cache/src/main/java/org/skywalking/apm/collector/cache/ApplicationCache.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.cache; - -import com.google.common.cache.Cache; -import com.google.common.cache.CacheBuilder; -import org.skywalking.apm.collector.cache.dao.IApplicationCacheDAO; -import org.skywalking.apm.collector.core.util.Const; -import org.skywalking.apm.collector.core.util.StringUtils; -import org.skywalking.apm.collector.storage.base.dao.DAOContainer; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class ApplicationCache { - - private static final Logger logger = LoggerFactory.getLogger(ApplicationCache.class); - - private static Cache CODE_CACHE = CacheBuilder.newBuilder().initialCapacity(100).maximumSize(1000).build(); - - public static int get(String applicationCode) { - IApplicationCacheDAO dao = (IApplicationCacheDAO)DAOContainer.INSTANCE.get(IApplicationCacheDAO.class.getName()); - - int applicationId = 0; - try { - applicationId = CODE_CACHE.get(applicationCode, () -> dao.getApplicationId(applicationCode)); - } catch (Throwable e) { - logger.error(e.getMessage(), e); - } - - if (applicationId == 0) { - applicationId = dao.getApplicationId(applicationCode); - if (applicationId != 0) { - CODE_CACHE.put(applicationCode, applicationId); - } - } - return applicationId; - } - - private static Cache ID_CACHE = CacheBuilder.newBuilder().maximumSize(1000).build(); - - public static String get(int applicationId) { - IApplicationCacheDAO dao = (IApplicationCacheDAO)DAOContainer.INSTANCE.get(IApplicationCacheDAO.class.getName()); - - String applicationCode = Const.EMPTY_STRING; - try { - applicationCode = ID_CACHE.get(applicationId, () -> dao.getApplicationCode(applicationId)); - } catch (Throwable e) { - logger.error(e.getMessage(), e); - } - - if (StringUtils.isEmpty(applicationCode)) { - applicationCode = dao.getApplicationCode(applicationId); - if (StringUtils.isNotEmpty(applicationCode)) { - CODE_CACHE.put(applicationCode, applicationId); - } - } - return applicationCode; - } -} diff --git a/apm-collector-3.2.3/apm-collector-cache/src/main/java/org/skywalking/apm/collector/cache/InstanceCache.java b/apm-collector-3.2.3/apm-collector-cache/src/main/java/org/skywalking/apm/collector/cache/InstanceCache.java deleted file mode 100644 index 245f0db087..0000000000 --- a/apm-collector-3.2.3/apm-collector-cache/src/main/java/org/skywalking/apm/collector/cache/InstanceCache.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.cache; - -import com.google.common.cache.Cache; -import com.google.common.cache.CacheBuilder; -import org.skywalking.apm.collector.cache.dao.IInstanceCacheDAO; -import org.skywalking.apm.collector.storage.base.dao.DAOContainer; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class InstanceCache { - - private static final Logger logger = LoggerFactory.getLogger(InstanceCache.class); - - private static Cache INSTANCE_CACHE = CacheBuilder.newBuilder().initialCapacity(100).maximumSize(5000).build(); - - public static int get(int applicationInstanceId) { - IInstanceCacheDAO dao = (IInstanceCacheDAO)DAOContainer.INSTANCE.get(IInstanceCacheDAO.class.getName()); - - int applicationId = 0; - try { - applicationId = INSTANCE_CACHE.get(applicationInstanceId, () -> dao.getApplicationId(applicationInstanceId)); - } catch (Throwable e) { - logger.error(e.getMessage(), e); - } - - if (applicationId == 0) { - applicationId = dao.getApplicationId(applicationInstanceId); - if (applicationId != 0) { - INSTANCE_CACHE.put(applicationInstanceId, applicationId); - } - } - return applicationId; - } -} diff --git a/apm-collector-3.2.3/apm-collector-cache/src/main/java/org/skywalking/apm/collector/cache/ServiceIdCache.java b/apm-collector-3.2.3/apm-collector-cache/src/main/java/org/skywalking/apm/collector/cache/ServiceIdCache.java deleted file mode 100644 index 171182782b..0000000000 --- a/apm-collector-3.2.3/apm-collector-cache/src/main/java/org/skywalking/apm/collector/cache/ServiceIdCache.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.cache; - -import com.google.common.cache.Cache; -import com.google.common.cache.CacheBuilder; -import org.skywalking.apm.collector.cache.dao.IServiceNameCacheDAO; -import org.skywalking.apm.collector.core.util.Const; -import org.skywalking.apm.collector.storage.base.dao.DAOContainer; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class ServiceIdCache { - - private static final Logger logger = LoggerFactory.getLogger(ServiceIdCache.class); - - //TODO size configuration - private static Cache SERVICE_CACHE = CacheBuilder.newBuilder().maximumSize(1000).build(); - - public static int get(int applicationId, String serviceName) { - IServiceNameCacheDAO dao = (IServiceNameCacheDAO)DAOContainer.INSTANCE.get(IServiceNameCacheDAO.class.getName()); - - int serviceId = 0; - try { - serviceId = SERVICE_CACHE.get(applicationId + Const.ID_SPLIT + serviceName, () -> dao.getServiceId(applicationId, serviceName)); - } catch (Throwable e) { - logger.error(e.getMessage(), e); - } - - if (serviceId == 0) { - serviceId = dao.getServiceId(applicationId, serviceName); - if (serviceId != 0) { - SERVICE_CACHE.put(applicationId + Const.ID_SPLIT + serviceName, serviceId); - } - } - return serviceId; - } -} diff --git a/apm-collector-3.2.3/apm-collector-cache/src/main/java/org/skywalking/apm/collector/cache/ServiceNameCache.java b/apm-collector-3.2.3/apm-collector-cache/src/main/java/org/skywalking/apm/collector/cache/ServiceNameCache.java deleted file mode 100644 index 5197486d14..0000000000 --- a/apm-collector-3.2.3/apm-collector-cache/src/main/java/org/skywalking/apm/collector/cache/ServiceNameCache.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.cache; - -import com.google.common.cache.Cache; -import com.google.common.cache.CacheBuilder; -import org.skywalking.apm.collector.cache.dao.IServiceNameCacheDAO; -import org.skywalking.apm.collector.core.util.Const; -import org.skywalking.apm.collector.core.util.StringUtils; -import org.skywalking.apm.collector.storage.base.dao.DAOContainer; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class ServiceNameCache { - - private static final Logger logger = LoggerFactory.getLogger(ServiceNameCache.class); - - //TODO size configuration - private static Cache CACHE = CacheBuilder.newBuilder().maximumSize(10000).build(); - - public static String get(int serviceId) { - IServiceNameCacheDAO dao = (IServiceNameCacheDAO)DAOContainer.INSTANCE.get(IServiceNameCacheDAO.class.getName()); - - String serviceName = Const.EMPTY_STRING; - try { - serviceName = CACHE.get(serviceId, () -> dao.getServiceName(serviceId)); - } catch (Throwable e) { - logger.error(e.getMessage(), e); - } - - if (StringUtils.isEmpty(serviceName)) { - serviceName = dao.getServiceName(serviceId); - if (StringUtils.isNotEmpty(serviceName)) { - CACHE.put(serviceId, serviceName); - } - } - - return serviceName; - } - - public static String getSplitServiceName(String serviceName) { - if (StringUtils.isNotEmpty(serviceName)) { - String[] serviceNames = serviceName.split(Const.ID_SPLIT); - if (serviceNames.length == 2) { - return serviceNames[1]; - } else { - return Const.EMPTY_STRING; - } - } else { - return Const.EMPTY_STRING; - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-cache/src/main/java/org/skywalking/apm/collector/cache/dao/ApplicationEsCacheDAO.java b/apm-collector-3.2.3/apm-collector-cache/src/main/java/org/skywalking/apm/collector/cache/dao/ApplicationEsCacheDAO.java deleted file mode 100644 index 1a7939eb3d..0000000000 --- a/apm-collector-3.2.3/apm-collector-cache/src/main/java/org/skywalking/apm/collector/cache/dao/ApplicationEsCacheDAO.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.cache.dao; - -import org.elasticsearch.action.get.GetRequestBuilder; -import org.elasticsearch.action.get.GetResponse; -import org.elasticsearch.action.search.SearchRequestBuilder; -import org.elasticsearch.action.search.SearchResponse; -import org.elasticsearch.action.search.SearchType; -import org.elasticsearch.index.query.QueryBuilders; -import org.elasticsearch.search.SearchHit; -import org.skywalking.apm.collector.client.elasticsearch.ElasticSearchClient; -import org.skywalking.apm.collector.core.util.Const; -import org.skywalking.apm.collector.storage.base.define.register.ApplicationTable; -import org.skywalking.apm.collector.storage.elasticsearch.dao.EsDAO; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class ApplicationEsCacheDAO extends EsDAO implements IApplicationCacheDAO { - - private final Logger logger = LoggerFactory.getLogger(ApplicationEsCacheDAO.class); - - @Override public int getApplicationId(String applicationCode) { - ElasticSearchClient client = getClient(); - - SearchRequestBuilder searchRequestBuilder = client.prepareSearch(ApplicationTable.TABLE); - searchRequestBuilder.setTypes("type"); - searchRequestBuilder.setSearchType(SearchType.QUERY_THEN_FETCH); - searchRequestBuilder.setQuery(QueryBuilders.termQuery(ApplicationTable.COLUMN_APPLICATION_CODE, applicationCode)); - searchRequestBuilder.setSize(1); - - SearchResponse searchResponse = searchRequestBuilder.execute().actionGet(); - if (searchResponse.getHits().totalHits > 0) { - SearchHit searchHit = searchResponse.getHits().iterator().next(); - return (int)searchHit.getSource().get(ApplicationTable.COLUMN_APPLICATION_ID); - } - return 0; - } - - @Override public String getApplicationCode(int applicationId) { - logger.debug("get application code, applicationId: {}", applicationId); - ElasticSearchClient client = getClient(); - GetRequestBuilder getRequestBuilder = client.prepareGet(ApplicationTable.TABLE, String.valueOf(applicationId)); - - GetResponse getResponse = getRequestBuilder.get(); - if (getResponse.isExists()) { - return (String)getResponse.getSource().get(ApplicationTable.COLUMN_APPLICATION_CODE); - } - return Const.EMPTY_STRING; - } -} diff --git a/apm-collector-3.2.3/apm-collector-cache/src/main/java/org/skywalking/apm/collector/cache/dao/ApplicationH2CacheDAO.java b/apm-collector-3.2.3/apm-collector-cache/src/main/java/org/skywalking/apm/collector/cache/dao/ApplicationH2CacheDAO.java deleted file mode 100644 index 20f66dda5a..0000000000 --- a/apm-collector-3.2.3/apm-collector-cache/src/main/java/org/skywalking/apm/collector/cache/dao/ApplicationH2CacheDAO.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.cache.dao; - -import java.sql.ResultSet; -import java.sql.SQLException; -import org.skywalking.apm.collector.client.h2.H2Client; -import org.skywalking.apm.collector.client.h2.H2ClientException; -import org.skywalking.apm.collector.core.util.Const; -import org.skywalking.apm.collector.storage.base.define.register.ApplicationTable; -import org.skywalking.apm.collector.storage.h2.SqlBuilder; -import org.skywalking.apm.collector.storage.h2.base.dao.H2DAO; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng, clevertension - */ -public class ApplicationH2CacheDAO extends H2DAO implements IApplicationCacheDAO { - - private final Logger logger = LoggerFactory.getLogger(ApplicationH2CacheDAO.class); - private static final String GET_APPLICATION_ID_OR_CODE_SQL = "select {0} from {1} where {2} = ?"; - - @Override - public int getApplicationId(String applicationCode) { - logger.info("get the application id with application code = {}", applicationCode); - H2Client client = getClient(); - String sql = SqlBuilder.buildSql(GET_APPLICATION_ID_OR_CODE_SQL, ApplicationTable.COLUMN_APPLICATION_ID, ApplicationTable.TABLE, ApplicationTable.COLUMN_APPLICATION_CODE); - - Object[] params = new Object[] {applicationCode}; - try (ResultSet rs = client.executeQuery(sql, params)) { - if (rs.next()) { - return rs.getInt(1); - } - } catch (SQLException | H2ClientException e) { - logger.error(e.getMessage(), e); - } - return 0; - } - - @Override public String getApplicationCode(int applicationId) { - logger.debug("get application code, applicationId: {}", applicationId); - H2Client client = getClient(); - String sql = SqlBuilder.buildSql(GET_APPLICATION_ID_OR_CODE_SQL, ApplicationTable.COLUMN_APPLICATION_CODE, ApplicationTable.TABLE, ApplicationTable.COLUMN_APPLICATION_ID); - Object[] params = new Object[] {applicationId}; - try (ResultSet rs = client.executeQuery(sql, params)) { - if (rs.next()) { - return rs.getString(1); - } - } catch (SQLException | H2ClientException e) { - logger.error(e.getMessage(), e); - } - return Const.EMPTY_STRING; - } -} diff --git a/apm-collector-3.2.3/apm-collector-cache/src/main/java/org/skywalking/apm/collector/cache/dao/IApplicationCacheDAO.java b/apm-collector-3.2.3/apm-collector-cache/src/main/java/org/skywalking/apm/collector/cache/dao/IApplicationCacheDAO.java deleted file mode 100644 index 65449fd937..0000000000 --- a/apm-collector-3.2.3/apm-collector-cache/src/main/java/org/skywalking/apm/collector/cache/dao/IApplicationCacheDAO.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.cache.dao; - -/** - * @author peng-yongsheng - */ -public interface IApplicationCacheDAO { - int getApplicationId(String applicationCode); - - String getApplicationCode(int applicationId); -} diff --git a/apm-collector-3.2.3/apm-collector-cache/src/main/java/org/skywalking/apm/collector/cache/dao/IInstanceCacheDAO.java b/apm-collector-3.2.3/apm-collector-cache/src/main/java/org/skywalking/apm/collector/cache/dao/IInstanceCacheDAO.java deleted file mode 100644 index 97e3985024..0000000000 --- a/apm-collector-3.2.3/apm-collector-cache/src/main/java/org/skywalking/apm/collector/cache/dao/IInstanceCacheDAO.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.cache.dao; - -/** - * @author peng-yongsheng - */ -public interface IInstanceCacheDAO { - int getApplicationId(int applicationInstanceId); -} diff --git a/apm-collector-3.2.3/apm-collector-cache/src/main/java/org/skywalking/apm/collector/cache/dao/IServiceNameCacheDAO.java b/apm-collector-3.2.3/apm-collector-cache/src/main/java/org/skywalking/apm/collector/cache/dao/IServiceNameCacheDAO.java deleted file mode 100644 index 13aa620108..0000000000 --- a/apm-collector-3.2.3/apm-collector-cache/src/main/java/org/skywalking/apm/collector/cache/dao/IServiceNameCacheDAO.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.cache.dao; - -/** - * @author peng-yongsheng - */ -public interface IServiceNameCacheDAO { - String getServiceName(int serviceId); - - int getServiceId(int applicationId, String serviceName); -} diff --git a/apm-collector-3.2.3/apm-collector-cache/src/main/java/org/skywalking/apm/collector/cache/dao/InstanceEsCacheDAO.java b/apm-collector-3.2.3/apm-collector-cache/src/main/java/org/skywalking/apm/collector/cache/dao/InstanceEsCacheDAO.java deleted file mode 100644 index e47ab8340d..0000000000 --- a/apm-collector-3.2.3/apm-collector-cache/src/main/java/org/skywalking/apm/collector/cache/dao/InstanceEsCacheDAO.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.cache.dao; - -import org.elasticsearch.action.get.GetResponse; -import org.skywalking.apm.collector.storage.base.define.register.InstanceTable; -import org.skywalking.apm.collector.storage.elasticsearch.dao.EsDAO; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class InstanceEsCacheDAO extends EsDAO implements IInstanceCacheDAO { - - private final Logger logger = LoggerFactory.getLogger(InstanceEsCacheDAO.class); - - @Override public int getApplicationId(int applicationInstanceId) { - GetResponse response = getClient().prepareGet(InstanceTable.TABLE, String.valueOf(applicationInstanceId)).get(); - if (response.isExists()) { - return (int)response.getSource().get(InstanceTable.COLUMN_APPLICATION_ID); - } else { - return 0; - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-cache/src/main/java/org/skywalking/apm/collector/cache/dao/InstanceH2CacheDAO.java b/apm-collector-3.2.3/apm-collector-cache/src/main/java/org/skywalking/apm/collector/cache/dao/InstanceH2CacheDAO.java deleted file mode 100644 index 88b76705b4..0000000000 --- a/apm-collector-3.2.3/apm-collector-cache/src/main/java/org/skywalking/apm/collector/cache/dao/InstanceH2CacheDAO.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.cache.dao; - -import java.sql.ResultSet; -import java.sql.SQLException; -import org.skywalking.apm.collector.client.h2.H2Client; -import org.skywalking.apm.collector.client.h2.H2ClientException; -import org.skywalking.apm.collector.storage.base.define.register.InstanceTable; -import org.skywalking.apm.collector.storage.h2.SqlBuilder; -import org.skywalking.apm.collector.storage.h2.base.dao.H2DAO; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class InstanceH2CacheDAO extends H2DAO implements IInstanceCacheDAO { - - private final Logger logger = LoggerFactory.getLogger(InstanceH2CacheDAO.class); - - private static final String GET_APPLICATION_ID_SQL = "select {0} from {1} where {2} = ?"; - - @Override public int getApplicationId(int applicationInstanceId) { - logger.info("get the application id with application id = {}", applicationInstanceId); - H2Client client = getClient(); - String sql = SqlBuilder.buildSql(GET_APPLICATION_ID_SQL, InstanceTable.COLUMN_APPLICATION_ID, InstanceTable.TABLE, InstanceTable.COLUMN_INSTANCE_ID); - Object[] params = new Object[] {applicationInstanceId}; - try (ResultSet rs = client.executeQuery(sql, params)) { - if (rs.next()) { - return rs.getInt(InstanceTable.COLUMN_APPLICATION_ID); - } - } catch (SQLException | H2ClientException e) { - logger.error(e.getMessage(), e); - } - return 0; - } -} diff --git a/apm-collector-3.2.3/apm-collector-cache/src/main/java/org/skywalking/apm/collector/cache/dao/ServiceNameEsCacheDAO.java b/apm-collector-3.2.3/apm-collector-cache/src/main/java/org/skywalking/apm/collector/cache/dao/ServiceNameEsCacheDAO.java deleted file mode 100644 index 3b9367f4cd..0000000000 --- a/apm-collector-3.2.3/apm-collector-cache/src/main/java/org/skywalking/apm/collector/cache/dao/ServiceNameEsCacheDAO.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.cache.dao; - -import org.elasticsearch.action.get.GetRequestBuilder; -import org.elasticsearch.action.get.GetResponse; -import org.elasticsearch.action.search.SearchRequestBuilder; -import org.elasticsearch.action.search.SearchResponse; -import org.elasticsearch.action.search.SearchType; -import org.elasticsearch.index.query.BoolQueryBuilder; -import org.elasticsearch.index.query.QueryBuilders; -import org.elasticsearch.search.SearchHit; -import org.skywalking.apm.collector.core.util.Const; -import org.skywalking.apm.collector.storage.base.define.register.ServiceNameTable; -import org.skywalking.apm.collector.storage.elasticsearch.dao.EsDAO; - -/** - * @author peng-yongsheng - */ -public class ServiceNameEsCacheDAO extends EsDAO implements IServiceNameCacheDAO { - - @Override public String getServiceName(int serviceId) { - GetRequestBuilder getRequestBuilder = getClient().prepareGet(ServiceNameTable.TABLE, String.valueOf(serviceId)); - - GetResponse getResponse = getRequestBuilder.get(); - if (getResponse.isExists()) { - String serviceName = (String)getResponse.getSource().get(ServiceNameTable.COLUMN_SERVICE_NAME); - int applicationId = ((Number)getResponse.getSource().get(ServiceNameTable.COLUMN_APPLICATION_ID)).intValue(); - return applicationId + Const.ID_SPLIT + serviceName; - } - return Const.EMPTY_STRING; - } - - @Override public int getServiceId(int applicationId, String serviceName) { - SearchRequestBuilder searchRequestBuilder = getClient().prepareSearch(ServiceNameTable.TABLE); - searchRequestBuilder.setTypes(ServiceNameTable.TABLE_TYPE); - searchRequestBuilder.setSearchType(SearchType.DFS_QUERY_THEN_FETCH); - - BoolQueryBuilder boolQuery = QueryBuilders.boolQuery(); - boolQuery.must().add(QueryBuilders.matchQuery(ServiceNameTable.COLUMN_APPLICATION_ID, applicationId)); - boolQuery.must().add(QueryBuilders.matchQuery(ServiceNameTable.COLUMN_SERVICE_NAME, serviceName)); - searchRequestBuilder.setQuery(boolQuery); - searchRequestBuilder.setSize(1); - - SearchResponse searchResponse = searchRequestBuilder.get(); - if (searchResponse.getHits().totalHits > 0) { - SearchHit searchHit = searchResponse.getHits().iterator().next(); - return (int)searchHit.getSource().get(ServiceNameTable.COLUMN_SERVICE_ID); - } - return 0; - } -} diff --git a/apm-collector-3.2.3/apm-collector-cache/src/main/java/org/skywalking/apm/collector/cache/dao/ServiceNameH2CacheDAO.java b/apm-collector-3.2.3/apm-collector-cache/src/main/java/org/skywalking/apm/collector/cache/dao/ServiceNameH2CacheDAO.java deleted file mode 100644 index 3be6d47261..0000000000 --- a/apm-collector-3.2.3/apm-collector-cache/src/main/java/org/skywalking/apm/collector/cache/dao/ServiceNameH2CacheDAO.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.cache.dao; - -import java.sql.ResultSet; -import java.sql.SQLException; -import org.skywalking.apm.collector.client.h2.H2Client; -import org.skywalking.apm.collector.client.h2.H2ClientException; -import org.skywalking.apm.collector.core.util.Const; -import org.skywalking.apm.collector.storage.base.define.register.ServiceNameTable; -import org.skywalking.apm.collector.storage.h2.SqlBuilder; -import org.skywalking.apm.collector.storage.h2.base.dao.H2DAO; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng, clevertension - */ -public class ServiceNameH2CacheDAO extends H2DAO implements IServiceNameCacheDAO { - - private final Logger logger = LoggerFactory.getLogger(ServiceNameH2CacheDAO.class); - - private static final String GET_SERVICE_NAME_SQL = "select {0},{1} from {2} where {3} = ?"; - private static final String GET_SERVICE_ID_SQL = "select {0} from {1} where {2} = ? and {3} = ? limit 1"; - - @Override public String getServiceName(int serviceId) { - H2Client client = getClient(); - String sql = SqlBuilder.buildSql(GET_SERVICE_NAME_SQL, ServiceNameTable.COLUMN_APPLICATION_ID, ServiceNameTable.COLUMN_SERVICE_NAME, - ServiceNameTable.TABLE, ServiceNameTable.COLUMN_SERVICE_ID); - Object[] params = new Object[] {serviceId}; - try (ResultSet rs = client.executeQuery(sql, params)) { - if (rs.next()) { - String serviceName = rs.getString(ServiceNameTable.COLUMN_SERVICE_NAME); - int applicationId = rs.getInt(ServiceNameTable.COLUMN_APPLICATION_ID); - return applicationId + Const.ID_SPLIT + serviceName; - } - } catch (SQLException | H2ClientException e) { - logger.error(e.getMessage(), e); - } - return Const.EMPTY_STRING; - } - - @Override public int getServiceId(int applicationId, String serviceName) { - H2Client client = getClient(); - String sql = SqlBuilder.buildSql(GET_SERVICE_ID_SQL, ServiceNameTable.COLUMN_SERVICE_ID, - ServiceNameTable.TABLE, ServiceNameTable.COLUMN_APPLICATION_ID, ServiceNameTable.COLUMN_SERVICE_NAME); - Object[] params = new Object[] {applicationId, serviceName}; - try (ResultSet rs = client.executeQuery(sql, params)) { - if (rs.next()) { - return rs.getInt(ServiceNameTable.COLUMN_SERVICE_ID); - } - } catch (SQLException | H2ClientException e) { - logger.error(e.getMessage(), e); - } - return 0; - } -} diff --git a/apm-collector-3.2.3/apm-collector-cache/src/main/resources/META-INF/defines/es_dao.define b/apm-collector-3.2.3/apm-collector-cache/src/main/resources/META-INF/defines/es_dao.define deleted file mode 100644 index e2c7caea36..0000000000 --- a/apm-collector-3.2.3/apm-collector-cache/src/main/resources/META-INF/defines/es_dao.define +++ /dev/null @@ -1,3 +0,0 @@ -org.skywalking.apm.collector.cache.dao.ApplicationEsCacheDAO -org.skywalking.apm.collector.cache.dao.InstanceEsCacheDAO -org.skywalking.apm.collector.cache.dao.ServiceNameEsCacheDAO diff --git a/apm-collector-3.2.3/apm-collector-cache/src/main/resources/META-INF/defines/h2_dao.define b/apm-collector-3.2.3/apm-collector-cache/src/main/resources/META-INF/defines/h2_dao.define deleted file mode 100644 index 7e0ec1b7d6..0000000000 --- a/apm-collector-3.2.3/apm-collector-cache/src/main/resources/META-INF/defines/h2_dao.define +++ /dev/null @@ -1,3 +0,0 @@ -org.skywalking.apm.collector.cache.dao.ApplicationH2CacheDAO -org.skywalking.apm.collector.cache.dao.InstanceH2CacheDAO -org.skywalking.apm.collector.cache.dao.ServiceNameH2CacheDAO \ No newline at end of file diff --git a/apm-collector-3.2.3/apm-collector-client/pom.xml b/apm-collector-3.2.3/apm-collector-client/pom.xml deleted file mode 100644 index d6ea5c4f37..0000000000 --- a/apm-collector-3.2.3/apm-collector-client/pom.xml +++ /dev/null @@ -1,81 +0,0 @@ - - - - - - apm-collector-3.2.3 - org.skywalking - 3.2.4-2017 - - 4.0.0 - - apm-collector-3.2.3-client - jar - - - - org.skywalking - apm-collector-3.2.3-core - ${project.version} - - - com.h2database - h2 - 1.4.196 - - - redis.clients - jedis - 2.9.0 - - - org.elasticsearch.client - transport - 5.5.0 - - - snakeyaml - org.yaml - - - - - org.apache.zookeeper - zookeeper - 3.4.10 - - - slf4j-api - org.slf4j - - - slf4j-log4j12 - org.slf4j - - - - - io.grpc - grpc-core - 1.4.0 - - - diff --git a/apm-collector-3.2.3/apm-collector-client/src/main/java/org/skywalking/apm/collector/client/elasticsearch/ElasticSearchClient.java b/apm-collector-3.2.3/apm-collector-client/src/main/java/org/skywalking/apm/collector/client/elasticsearch/ElasticSearchClient.java deleted file mode 100644 index 791199a172..0000000000 --- a/apm-collector-3.2.3/apm-collector-client/src/main/java/org/skywalking/apm/collector/client/elasticsearch/ElasticSearchClient.java +++ /dev/null @@ -1,164 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.client.elasticsearch; - -import java.net.InetAddress; -import java.net.UnknownHostException; -import java.util.LinkedList; -import java.util.List; -import java.util.concurrent.ExecutionException; -import org.elasticsearch.action.admin.indices.create.CreateIndexResponse; -import org.elasticsearch.action.admin.indices.delete.DeleteIndexResponse; -import org.elasticsearch.action.admin.indices.exists.indices.IndicesExistsResponse; -import org.elasticsearch.action.bulk.BulkRequestBuilder; -import org.elasticsearch.action.get.GetRequestBuilder; -import org.elasticsearch.action.get.MultiGetRequestBuilder; -import org.elasticsearch.action.index.IndexRequestBuilder; -import org.elasticsearch.action.search.SearchRequestBuilder; -import org.elasticsearch.action.update.UpdateRequest; -import org.elasticsearch.action.update.UpdateRequestBuilder; -import org.elasticsearch.client.IndicesAdminClient; -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.common.transport.InetSocketTransportAddress; -import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.transport.client.PreBuiltTransportClient; -import org.skywalking.apm.collector.core.client.Client; -import org.skywalking.apm.collector.core.client.ClientException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class ElasticSearchClient implements Client { - - private final Logger logger = LoggerFactory.getLogger(ElasticSearchClient.class); - - private org.elasticsearch.client.Client client; - - private final String clusterName; - - private final Boolean clusterTransportSniffer; - - private final String clusterNodes; - - public ElasticSearchClient(String clusterName, Boolean clusterTransportSniffer, String clusterNodes) { - this.clusterName = clusterName; - this.clusterTransportSniffer = clusterTransportSniffer; - this.clusterNodes = clusterNodes; - } - - @Override public void initialize() throws ClientException { - Settings settings = Settings.builder() - .put("cluster.name", clusterName) - .put("client.transport.sniff", clusterTransportSniffer) - .build(); - - client = new PreBuiltTransportClient(settings); - - List pairsList = parseClusterNodes(clusterNodes); - for (AddressPairs pairs : pairsList) { - try { - ((PreBuiltTransportClient)client).addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName(pairs.host), pairs.port)); - } catch (UnknownHostException e) { - throw new ElasticSearchClientException(e.getMessage(), e); - } - } - } - - @Override public void shutdown() { - - } - - private List parseClusterNodes(String nodes) { - List pairsList = new LinkedList<>(); - logger.info("elasticsearch cluster nodes: {}", nodes); - String[] nodesSplit = nodes.split(","); - for (int i = 0; i < nodesSplit.length; i++) { - String node = nodesSplit[i]; - String host = node.split(":")[0]; - String port = node.split(":")[1]; - pairsList.add(new AddressPairs(host, Integer.valueOf(port))); - } - - return pairsList; - } - - class AddressPairs { - private String host; - private Integer port; - - public AddressPairs(String host, Integer port) { - this.host = host; - this.port = port; - } - } - - public boolean createIndex(String indexName, String indexType, Settings settings, XContentBuilder mappingBuilder) { - IndicesAdminClient adminClient = client.admin().indices(); - CreateIndexResponse response = adminClient.prepareCreate(indexName).setSettings(settings).addMapping(indexType, mappingBuilder).get(); - logger.info("create {} index with type of {} finished, isAcknowledged: {}", indexName, indexType, response.isAcknowledged()); - return response.isShardsAcked(); - } - - public boolean deleteIndex(String indexName) { - IndicesAdminClient adminClient = client.admin().indices(); - DeleteIndexResponse response = adminClient.prepareDelete(indexName).get(); - logger.info("delete {} index finished, isAcknowledged: {}", indexName, response.isAcknowledged()); - return response.isAcknowledged(); - } - - public boolean isExistsIndex(String indexName) { - IndicesAdminClient adminClient = client.admin().indices(); - IndicesExistsResponse response = adminClient.prepareExists(indexName).get(); - return response.isExists(); - } - - public SearchRequestBuilder prepareSearch(String indexName) { - return client.prepareSearch(indexName); - } - - public IndexRequestBuilder prepareIndex(String indexName, String id) { - return client.prepareIndex(indexName, "type", id); - } - - public UpdateRequestBuilder prepareUpdate(String indexName, String id) { - return client.prepareUpdate(indexName, "type", id); - } - - public GetRequestBuilder prepareGet(String indexName, String id) { - return client.prepareGet(indexName, "type", id); - } - - public MultiGetRequestBuilder prepareMultiGet() { - return client.prepareMultiGet(); - } - - public BulkRequestBuilder prepareBulk() { - return client.prepareBulk(); - } - - public void update(UpdateRequest updateRequest) { - try { - client.update(updateRequest).get(); - } catch (InterruptedException | ExecutionException e) { - logger.error(e.getMessage(), e); - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-client/src/main/java/org/skywalking/apm/collector/client/elasticsearch/ElasticSearchClientException.java b/apm-collector-3.2.3/apm-collector-client/src/main/java/org/skywalking/apm/collector/client/elasticsearch/ElasticSearchClientException.java deleted file mode 100644 index 24eb74459c..0000000000 --- a/apm-collector-3.2.3/apm-collector-client/src/main/java/org/skywalking/apm/collector/client/elasticsearch/ElasticSearchClientException.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.client.elasticsearch; - -import org.skywalking.apm.collector.core.client.ClientException; - -/** - * @author peng-yongsheng - */ -public class ElasticSearchClientException extends ClientException { - public ElasticSearchClientException(String message) { - super(message); - } - - public ElasticSearchClientException(String message, Throwable cause) { - super(message, cause); - } -} diff --git a/apm-collector-3.2.3/apm-collector-client/src/main/java/org/skywalking/apm/collector/client/grpc/GRPCClient.java b/apm-collector-3.2.3/apm-collector-client/src/main/java/org/skywalking/apm/collector/client/grpc/GRPCClient.java deleted file mode 100644 index 782148bbd0..0000000000 --- a/apm-collector-3.2.3/apm-collector-client/src/main/java/org/skywalking/apm/collector/client/grpc/GRPCClient.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.client.grpc; - -import io.grpc.ManagedChannel; -import io.grpc.ManagedChannelBuilder; -import org.skywalking.apm.collector.core.client.Client; -import org.skywalking.apm.collector.core.client.ClientException; - -/** - * @author peng-yongsheng - */ -public class GRPCClient implements Client { - - private final String host; - - private final int port; - - private ManagedChannel channel; - - public GRPCClient(String host, int port) { - this.host = host; - this.port = port; - } - - @Override public void initialize() throws ClientException { - channel = ManagedChannelBuilder.forAddress(host, port).usePlaintext(true).build(); - } - - @Override public void shutdown() { - channel.shutdownNow(); - } - - public ManagedChannel getChannel() { - return channel; - } - - @Override public String toString() { - return host + ":" + port; - } -} diff --git a/apm-collector-3.2.3/apm-collector-client/src/main/java/org/skywalking/apm/collector/client/grpc/GRPCClientException.java b/apm-collector-3.2.3/apm-collector-client/src/main/java/org/skywalking/apm/collector/client/grpc/GRPCClientException.java deleted file mode 100644 index a0322ea6ab..0000000000 --- a/apm-collector-3.2.3/apm-collector-client/src/main/java/org/skywalking/apm/collector/client/grpc/GRPCClientException.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.client.grpc; - -import org.skywalking.apm.collector.core.client.ClientException; - -/** - * @author peng-yongsheng - */ -public class GRPCClientException extends ClientException { - - public GRPCClientException(String message) { - super(message); - } - - public GRPCClientException(String message, Throwable cause) { - super(message, cause); - } -} diff --git a/apm-collector-3.2.3/apm-collector-client/src/main/java/org/skywalking/apm/collector/client/h2/H2Client.java b/apm-collector-3.2.3/apm-collector-client/src/main/java/org/skywalking/apm/collector/client/h2/H2Client.java deleted file mode 100644 index 74dd9b9220..0000000000 --- a/apm-collector-3.2.3/apm-collector-client/src/main/java/org/skywalking/apm/collector/client/h2/H2Client.java +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.client.h2; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import org.h2.util.IOUtils; -import org.skywalking.apm.collector.core.client.Client; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class H2Client implements Client { - - private final Logger logger = LoggerFactory.getLogger(H2Client.class); - - private Connection conn; - private String url; - private String userName; - private String password; - - public H2Client() { - this.url = "jdbc:h2:mem:collector"; - this.userName = ""; - this.password = ""; - } - - public H2Client(String url, String userName, String password) { - this.url = url; - this.userName = userName; - this.password = password; - } - - @Override public void initialize() throws H2ClientException { - try { - Class.forName("org.h2.Driver"); - conn = DriverManager. - getConnection(this.url, this.userName, this.password); - } catch (Exception e) { - throw new H2ClientException(e.getMessage(), e); - } - } - - @Override public void shutdown() { - IOUtils.closeSilently(conn); - } - - public Connection getConnection() throws H2ClientException { - return conn; - } - - public void execute(String sql) throws H2ClientException { - try (Statement statement = getConnection().createStatement()) { - statement.execute(sql); - statement.closeOnCompletion(); - } catch (SQLException e) { - throw new H2ClientException(e.getMessage(), e); - } - } - - public ResultSet executeQuery(String sql, Object[] params) throws H2ClientException { - logger.debug("execute query with result: {}", sql); - ResultSet rs; - PreparedStatement statement; - try { - statement = getConnection().prepareStatement(sql); - if (params != null) { - for (int i = 0; i < params.length; i++) { - statement.setObject(i + 1, params[i]); - } - } - rs = statement.executeQuery(); - statement.closeOnCompletion(); - } catch (SQLException e) { - throw new H2ClientException(e.getMessage(), e); - } - return rs; - } - - public boolean execute(String sql, Object[] params) throws H2ClientException { - logger.debug("execute insert/update/delete: {}", sql); - boolean flag; - Connection conn = getConnection(); - try (PreparedStatement statement = conn.prepareStatement(sql)) { - conn.setAutoCommit(true); - if (params != null) { - for (int i = 0; i < params.length; i++) { - statement.setObject(i + 1, params[i]); - } - } - flag = statement.execute(); - } catch (SQLException e) { - throw new H2ClientException(e.getMessage(), e); - } - return flag; - } -} diff --git a/apm-collector-3.2.3/apm-collector-client/src/main/java/org/skywalking/apm/collector/client/h2/H2ClientException.java b/apm-collector-3.2.3/apm-collector-client/src/main/java/org/skywalking/apm/collector/client/h2/H2ClientException.java deleted file mode 100644 index 45e4828a8a..0000000000 --- a/apm-collector-3.2.3/apm-collector-client/src/main/java/org/skywalking/apm/collector/client/h2/H2ClientException.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.client.h2; - -import org.skywalking.apm.collector.core.client.ClientException; - -/** - * @author peng-yongsheng - */ -public class H2ClientException extends ClientException { - - public H2ClientException(String message) { - super(message); - } - - public H2ClientException(String message, Throwable cause) { - super(message, cause); - } -} diff --git a/apm-collector-3.2.3/apm-collector-client/src/main/java/org/skywalking/apm/collector/client/redis/RedisClient.java b/apm-collector-3.2.3/apm-collector-client/src/main/java/org/skywalking/apm/collector/client/redis/RedisClient.java deleted file mode 100644 index e759547439..0000000000 --- a/apm-collector-3.2.3/apm-collector-client/src/main/java/org/skywalking/apm/collector/client/redis/RedisClient.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.client.redis; - -import org.skywalking.apm.collector.core.client.Client; -import org.skywalking.apm.collector.core.client.ClientException; -import redis.clients.jedis.Jedis; - -/** - * @author peng-yongsheng - */ -public class RedisClient implements Client { - - private Jedis jedis; - - private final String host; - private final int port; - - public RedisClient(String host, int port) { - this.host = host; - this.port = port; - } - - @Override public void initialize() throws ClientException { - jedis = new Jedis(host, port); - } - - @Override public void shutdown() { - - } - - public void setex(String key, int seconds, String value) { - jedis.setex(key, seconds, value); - } -} diff --git a/apm-collector-3.2.3/apm-collector-client/src/main/java/org/skywalking/apm/collector/client/redis/RedisClientException.java b/apm-collector-3.2.3/apm-collector-client/src/main/java/org/skywalking/apm/collector/client/redis/RedisClientException.java deleted file mode 100644 index 0e30172259..0000000000 --- a/apm-collector-3.2.3/apm-collector-client/src/main/java/org/skywalking/apm/collector/client/redis/RedisClientException.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.client.redis; - -import org.skywalking.apm.collector.core.client.ClientException; - -/** - * @author peng-yongsheng - */ -public class RedisClientException extends ClientException { - - public RedisClientException(String message) { - super(message); - } - - public RedisClientException(String message, Throwable cause) { - super(message, cause); - } -} diff --git a/apm-collector-3.2.3/apm-collector-client/src/main/java/org/skywalking/apm/collector/client/zookeeper/ZookeeperClient.java b/apm-collector-3.2.3/apm-collector-client/src/main/java/org/skywalking/apm/collector/client/zookeeper/ZookeeperClient.java deleted file mode 100644 index a561e8b808..0000000000 --- a/apm-collector-3.2.3/apm-collector-client/src/main/java/org/skywalking/apm/collector/client/zookeeper/ZookeeperClient.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.client.zookeeper; - -import java.io.IOException; -import java.util.List; -import org.apache.zookeeper.CreateMode; -import org.apache.zookeeper.KeeperException; -import org.apache.zookeeper.Watcher; -import org.apache.zookeeper.ZooKeeper; -import org.apache.zookeeper.data.ACL; -import org.apache.zookeeper.data.Stat; -import org.skywalking.apm.collector.core.client.Client; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class ZookeeperClient implements Client { - - private final Logger logger = LoggerFactory.getLogger(ZookeeperClient.class); - - private ZooKeeper zk; - - private final String hostPort; - private final int sessionTimeout; - private final Watcher watcher; - - public ZookeeperClient(String hostPort, int sessionTimeout, Watcher watcher) { - this.hostPort = hostPort; - this.sessionTimeout = sessionTimeout; - this.watcher = watcher; - } - - @Override public void initialize() throws ZookeeperClientException { - try { - zk = new ZooKeeper(hostPort, sessionTimeout, watcher); - } catch (IOException e) { - throw new ZookeeperClientException(e.getMessage(), e); - } - } - - @Override public void shutdown() { - - } - - public void create(final String path, byte data[], List acl, - CreateMode createMode) throws ZookeeperClientException { - try { - zk.create(path, data, acl, createMode); - } catch (KeeperException | InterruptedException e) { - throw new ZookeeperClientException(e.getMessage(), e); - } - } - - public Stat exists(final String path, boolean watch) throws ZookeeperClientException { - try { - return zk.exists(path, watch); - } catch (KeeperException | InterruptedException e) { - throw new ZookeeperClientException(e.getMessage(), e); - } - } - - public void delete(final String path, int version) throws ZookeeperClientException { - try { - zk.delete(path, version); - } catch (KeeperException | InterruptedException e) { - throw new ZookeeperClientException(e.getMessage(), e); - } - } - - public byte[] getData(String path, boolean watch, Stat stat) throws ZookeeperClientException { - try { - return zk.getData(path, watch, stat); - } catch (KeeperException | InterruptedException e) { - throw new ZookeeperClientException(e.getMessage(), e); - } - } - - public Stat setData(final String path, byte data[], int version) throws ZookeeperClientException { - try { - return zk.setData(path, data, version); - } catch (KeeperException | InterruptedException e) { - throw new ZookeeperClientException(e.getMessage(), e); - } - } - - public List getChildren(final String path, boolean watch) throws ZookeeperClientException { - try { - return zk.getChildren(path, watch); - } catch (KeeperException | InterruptedException e) { - throw new ZookeeperClientException(e.getMessage(), e); - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-client/src/main/java/org/skywalking/apm/collector/client/zookeeper/ZookeeperClientException.java b/apm-collector-3.2.3/apm-collector-client/src/main/java/org/skywalking/apm/collector/client/zookeeper/ZookeeperClientException.java deleted file mode 100644 index cdf80f33f7..0000000000 --- a/apm-collector-3.2.3/apm-collector-client/src/main/java/org/skywalking/apm/collector/client/zookeeper/ZookeeperClientException.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.client.zookeeper; - -import org.skywalking.apm.collector.core.client.ClientException; - -/** - * @author peng-yongsheng - */ -public class ZookeeperClientException extends ClientException { - public ZookeeperClientException(String message) { - super(message); - } - - public ZookeeperClientException(String message, Throwable cause) { - super(message, cause); - } -} diff --git a/apm-collector-3.2.3/apm-collector-client/src/main/java/org/skywalking/apm/collector/client/zookeeper/util/PathUtils.java b/apm-collector-3.2.3/apm-collector-client/src/main/java/org/skywalking/apm/collector/client/zookeeper/util/PathUtils.java deleted file mode 100644 index ccf8d37e44..0000000000 --- a/apm-collector-3.2.3/apm-collector-client/src/main/java/org/skywalking/apm/collector/client/zookeeper/util/PathUtils.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.client.zookeeper.util; - -/** - * @author peng-yongsheng - */ -public class PathUtils { - - public static String convertKey2Path(String key) { - String[] keys = key.split("\\."); - StringBuilder pathBuilder = new StringBuilder(); - for (String subPath : keys) { - pathBuilder.append("/").append(subPath); - } - return pathBuilder.toString(); - } -} diff --git a/apm-collector-3.2.3/apm-collector-cluster/pom.xml b/apm-collector-3.2.3/apm-collector-cluster/pom.xml deleted file mode 100644 index 77d472d420..0000000000 --- a/apm-collector-3.2.3/apm-collector-cluster/pom.xml +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - apm-collector-3.2.3 - org.skywalking - 3.2.4-2017 - - 4.0.0 - - apm-collector-3.2.3-cluster - jar - - - - org.skywalking - apm-collector-3.2.3-core - ${project.version} - - - org.skywalking - apm-collector-3.2.3-client - ${project.version} - - - diff --git a/apm-collector-3.2.3/apm-collector-cluster/src/main/java/org/skywalking/apm/collector/cluster/ClusterModuleDefine.java b/apm-collector-3.2.3/apm-collector-cluster/src/main/java/org/skywalking/apm/collector/cluster/ClusterModuleDefine.java deleted file mode 100644 index 1d372476cf..0000000000 --- a/apm-collector-3.2.3/apm-collector-cluster/src/main/java/org/skywalking/apm/collector/cluster/ClusterModuleDefine.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.cluster; - -import java.util.List; -import org.skywalking.apm.collector.core.CollectorException; -import org.skywalking.apm.collector.core.client.Client; -import org.skywalking.apm.collector.core.client.ClientException; -import org.skywalking.apm.collector.core.client.DataMonitor; -import org.skywalking.apm.collector.core.cluster.ClusterModuleRegistrationReader; -import org.skywalking.apm.collector.core.framework.CollectorContextHelper; -import org.skywalking.apm.collector.core.framework.Handler; -import org.skywalking.apm.collector.core.framework.UnexpectedException; -import org.skywalking.apm.collector.core.module.ModuleDefine; -import org.skywalking.apm.collector.core.module.ModuleRegistration; -import org.skywalking.apm.collector.core.server.Server; - -/** - * @author peng-yongsheng - */ -public abstract class ClusterModuleDefine extends ModuleDefine { - - public static final String BASE_CATALOG = "skywalking"; - - private Client client; - - @Override protected void initializeOtherContext() { - try { - client = createClient(); - client.initialize(); - dataMonitor().setClient(client); - ClusterModuleRegistrationReader reader = registrationReader(); - - CollectorContextHelper.INSTANCE.getClusterModuleContext().setDataMonitor(dataMonitor()); - CollectorContextHelper.INSTANCE.getClusterModuleContext().setReader(reader); - } catch (ClientException e) { - throw new UnexpectedException(e.getMessage()); - } - } - - public final Client getClient() { - return this.client; - } - - @Override public final Server server() { - return null; - } - - @Override public final List handlerList() { - return null; - } - - @Override protected final ModuleRegistration registration() { - throw new UnsupportedOperationException("Cluster module do not need module registration."); - } - - public abstract DataMonitor dataMonitor(); - - public abstract ClusterModuleRegistrationReader registrationReader(); - - public void startMonitor() throws CollectorException { - dataMonitor().start(); - } -} diff --git a/apm-collector-3.2.3/apm-collector-cluster/src/main/java/org/skywalking/apm/collector/cluster/ClusterModuleGroupDefine.java b/apm-collector-3.2.3/apm-collector-cluster/src/main/java/org/skywalking/apm/collector/cluster/ClusterModuleGroupDefine.java deleted file mode 100644 index 051947bf06..0000000000 --- a/apm-collector-3.2.3/apm-collector-cluster/src/main/java/org/skywalking/apm/collector/cluster/ClusterModuleGroupDefine.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.cluster; - -import org.skywalking.apm.collector.core.cluster.ClusterModuleContext; -import org.skywalking.apm.collector.core.config.GroupConfigParser; -import org.skywalking.apm.collector.core.framework.Context; -import org.skywalking.apm.collector.core.module.ModuleGroupDefine; -import org.skywalking.apm.collector.core.module.ModuleInstaller; - -/** - * @author peng-yongsheng - */ -public class ClusterModuleGroupDefine implements ModuleGroupDefine { - - public static final String GROUP_NAME = "cluster"; - private final ClusterModuleInstaller installer; - - public ClusterModuleGroupDefine() { - installer = new ClusterModuleInstaller(); - } - - @Override public String name() { - return GROUP_NAME; - } - - @Override public Context groupContext() { - return new ClusterModuleContext(GROUP_NAME); - } - - @Override public ModuleInstaller moduleInstaller() { - return installer; - } - - @Override public GroupConfigParser groupConfigParser() { - return null; - } -} diff --git a/apm-collector-3.2.3/apm-collector-cluster/src/main/java/org/skywalking/apm/collector/cluster/ClusterModuleInstaller.java b/apm-collector-3.2.3/apm-collector-cluster/src/main/java/org/skywalking/apm/collector/cluster/ClusterModuleInstaller.java deleted file mode 100644 index 07c15b0217..0000000000 --- a/apm-collector-3.2.3/apm-collector-cluster/src/main/java/org/skywalking/apm/collector/cluster/ClusterModuleInstaller.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.cluster; - -import java.util.LinkedList; -import java.util.List; -import org.skywalking.apm.collector.core.CollectorException; -import org.skywalking.apm.collector.core.cluster.ClusterModuleContext; -import org.skywalking.apm.collector.core.framework.CollectorContextHelper; -import org.skywalking.apm.collector.core.framework.Context; -import org.skywalking.apm.collector.core.module.SingleModuleInstaller; - -/** - * @author peng-yongsheng - */ -public class ClusterModuleInstaller extends SingleModuleInstaller { - - @Override public String groupName() { - return ClusterModuleGroupDefine.GROUP_NAME; - } - - @Override public Context moduleContext() { - ClusterModuleContext clusterModuleContext = new ClusterModuleContext(ClusterModuleGroupDefine.GROUP_NAME); - CollectorContextHelper.INSTANCE.putClusterContext(clusterModuleContext); - return clusterModuleContext; - } - - @Override public List dependenceModules() { - List dependenceModules = new LinkedList<>(); - dependenceModules.add("collector_inside"); - return dependenceModules; - } - - @Override public void onAfterInstall() throws CollectorException { - ((ClusterModuleDefine)getModuleDefine()).startMonitor(); - } -} diff --git a/apm-collector-3.2.3/apm-collector-cluster/src/main/java/org/skywalking/apm/collector/cluster/ClusterNodeExistException.java b/apm-collector-3.2.3/apm-collector-cluster/src/main/java/org/skywalking/apm/collector/cluster/ClusterNodeExistException.java deleted file mode 100644 index 35af2df681..0000000000 --- a/apm-collector-3.2.3/apm-collector-cluster/src/main/java/org/skywalking/apm/collector/cluster/ClusterNodeExistException.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.cluster; - -import org.skywalking.apm.collector.core.client.ClientException; - -/** - * @author peng-yongsheng - */ -public class ClusterNodeExistException extends ClientException { - - public ClusterNodeExistException(String message) { - super(message); - } - - public ClusterNodeExistException(String message, Throwable cause) { - super(message, cause); - } -} diff --git a/apm-collector-3.2.3/apm-collector-cluster/src/main/java/org/skywalking/apm/collector/cluster/redis/ClusterRedisConfig.java b/apm-collector-3.2.3/apm-collector-cluster/src/main/java/org/skywalking/apm/collector/cluster/redis/ClusterRedisConfig.java deleted file mode 100644 index c5c5e43e19..0000000000 --- a/apm-collector-3.2.3/apm-collector-cluster/src/main/java/org/skywalking/apm/collector/cluster/redis/ClusterRedisConfig.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.cluster.redis; - -/** - * @author peng-yongsheng - */ -public class ClusterRedisConfig { - public static String HOST; - public static int PORT; -} diff --git a/apm-collector-3.2.3/apm-collector-cluster/src/main/java/org/skywalking/apm/collector/cluster/redis/ClusterRedisConfigParser.java b/apm-collector-3.2.3/apm-collector-cluster/src/main/java/org/skywalking/apm/collector/cluster/redis/ClusterRedisConfigParser.java deleted file mode 100644 index abc3e6cc1e..0000000000 --- a/apm-collector-3.2.3/apm-collector-cluster/src/main/java/org/skywalking/apm/collector/cluster/redis/ClusterRedisConfigParser.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.cluster.redis; - -import java.util.Map; -import org.skywalking.apm.collector.core.config.ConfigParseException; -import org.skywalking.apm.collector.core.module.ModuleConfigParser; -import org.skywalking.apm.collector.core.util.StringUtils; - -/** - * @author peng-yongsheng - */ -public class ClusterRedisConfigParser implements ModuleConfigParser { - - private static final String HOST = "host"; - private static final String PORT = "port"; - - @Override public void parse(Map config) throws ConfigParseException { - ClusterRedisConfig.HOST = (String)config.get(HOST); - ClusterRedisConfig.PORT = (Integer)config.get(PORT); - if (StringUtils.isEmpty(ClusterRedisConfig.HOST) || ClusterRedisConfig.PORT == 0) { - throw new ConfigParseException(""); - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-cluster/src/main/java/org/skywalking/apm/collector/cluster/redis/ClusterRedisModuleDefine.java b/apm-collector-3.2.3/apm-collector-cluster/src/main/java/org/skywalking/apm/collector/cluster/redis/ClusterRedisModuleDefine.java deleted file mode 100644 index 7718448557..0000000000 --- a/apm-collector-3.2.3/apm-collector-cluster/src/main/java/org/skywalking/apm/collector/cluster/redis/ClusterRedisModuleDefine.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.cluster.redis; - -import org.skywalking.apm.collector.client.redis.RedisClient; -import org.skywalking.apm.collector.cluster.ClusterModuleDefine; -import org.skywalking.apm.collector.cluster.ClusterModuleGroupDefine; -import org.skywalking.apm.collector.core.client.Client; -import org.skywalking.apm.collector.core.client.DataMonitor; -import org.skywalking.apm.collector.core.cluster.ClusterModuleRegistrationReader; -import org.skywalking.apm.collector.core.module.ModuleConfigParser; - -/** - * @author peng-yongsheng - */ -public class ClusterRedisModuleDefine extends ClusterModuleDefine { - - public static final String MODULE_NAME = "redis"; - - @Override public String group() { - return ClusterModuleGroupDefine.GROUP_NAME; - } - - @Override public String name() { - return MODULE_NAME; - } - - @Override public boolean defaultModule() { - return false; - } - - @Override protected ModuleConfigParser configParser() { - return new ClusterRedisConfigParser(); - } - - @Override public DataMonitor dataMonitor() { - return null; - } - - @Override protected Client createClient() { - return new RedisClient(ClusterRedisConfig.HOST, ClusterRedisConfig.PORT); - } - - @Override public ClusterModuleRegistrationReader registrationReader() { - return null; - } -} diff --git a/apm-collector-3.2.3/apm-collector-cluster/src/main/java/org/skywalking/apm/collector/cluster/redis/ClusterRedisModuleRegistrationReader.java b/apm-collector-3.2.3/apm-collector-cluster/src/main/java/org/skywalking/apm/collector/cluster/redis/ClusterRedisModuleRegistrationReader.java deleted file mode 100644 index a05c28e294..0000000000 --- a/apm-collector-3.2.3/apm-collector-cluster/src/main/java/org/skywalking/apm/collector/cluster/redis/ClusterRedisModuleRegistrationReader.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.cluster.redis; - -import org.skywalking.apm.collector.core.client.DataMonitor; -import org.skywalking.apm.collector.core.cluster.ClusterModuleRegistrationReader; - -/** - * @author peng-yongsheng - */ -public class ClusterRedisModuleRegistrationReader extends ClusterModuleRegistrationReader { - - public ClusterRedisModuleRegistrationReader(DataMonitor dataMonitor) { - super(dataMonitor); - } -} diff --git a/apm-collector-3.2.3/apm-collector-cluster/src/main/java/org/skywalking/apm/collector/cluster/standalone/ClusterStandaloneConfigParser.java b/apm-collector-3.2.3/apm-collector-cluster/src/main/java/org/skywalking/apm/collector/cluster/standalone/ClusterStandaloneConfigParser.java deleted file mode 100644 index 3aa9eb9f1e..0000000000 --- a/apm-collector-3.2.3/apm-collector-cluster/src/main/java/org/skywalking/apm/collector/cluster/standalone/ClusterStandaloneConfigParser.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.cluster.standalone; - -import java.util.Map; -import org.skywalking.apm.collector.core.config.ConfigParseException; -import org.skywalking.apm.collector.core.module.ModuleConfigParser; - -/** - * @author peng-yongsheng - */ -public class ClusterStandaloneConfigParser implements ModuleConfigParser { - @Override public void parse(Map config) throws ConfigParseException { - } -} diff --git a/apm-collector-3.2.3/apm-collector-cluster/src/main/java/org/skywalking/apm/collector/cluster/standalone/ClusterStandaloneDataMonitor.java b/apm-collector-3.2.3/apm-collector-cluster/src/main/java/org/skywalking/apm/collector/cluster/standalone/ClusterStandaloneDataMonitor.java deleted file mode 100644 index d99be53a77..0000000000 --- a/apm-collector-3.2.3/apm-collector-cluster/src/main/java/org/skywalking/apm/collector/cluster/standalone/ClusterStandaloneDataMonitor.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.cluster.standalone; - -import java.util.Iterator; -import java.util.LinkedHashMap; -import java.util.Map; -import org.skywalking.apm.collector.client.h2.H2Client; -import org.skywalking.apm.collector.client.zookeeper.util.PathUtils; -import org.skywalking.apm.collector.core.CollectorException; -import org.skywalking.apm.collector.core.client.Client; -import org.skywalking.apm.collector.core.client.ClientException; -import org.skywalking.apm.collector.core.client.DataMonitor; -import org.skywalking.apm.collector.core.cluster.ClusterDataListener; -import org.skywalking.apm.collector.core.module.ModuleRegistration; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class ClusterStandaloneDataMonitor implements DataMonitor { - - private final Logger logger = LoggerFactory.getLogger(ClusterStandaloneDataMonitor.class); - - private H2Client client; - - private Map listeners; - private Map registrations; - - public ClusterStandaloneDataMonitor() { - listeners = new LinkedHashMap<>(); - registrations = new LinkedHashMap<>(); - } - - @Override public void setClient(Client client) { - this.client = (H2Client)client; - } - - @Override - public void addListener(ClusterDataListener listener, ModuleRegistration registration) throws ClientException { - String path = PathUtils.convertKey2Path(listener.path()); - logger.info("listener path: {}", path); - listeners.put(path, listener); - registrations.put(path, registration); - } - - @Override public ClusterDataListener getListener(String path) { - path = PathUtils.convertKey2Path(path); - return listeners.get(path); - } - - @Override public void createPath(String path) throws ClientException { - - } - - @Override public void setData(String path, String value) throws ClientException { - if (listeners.containsKey(path)) { - listeners.get(path).addAddress(value); - listeners.get(path).serverJoinNotify(value); - } - } - - @Override public void start() throws CollectorException { - Iterator> entryIterator = registrations.entrySet().iterator(); - while (entryIterator.hasNext()) { - Map.Entry next = entryIterator.next(); - ModuleRegistration.Value value = next.getValue().buildValue(); - String contextPath = value.getContextPath() == null ? "" : value.getContextPath(); - setData(next.getKey(), value.getHostPort() + contextPath); - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-cluster/src/main/java/org/skywalking/apm/collector/cluster/standalone/ClusterStandaloneModuleDefine.java b/apm-collector-3.2.3/apm-collector-cluster/src/main/java/org/skywalking/apm/collector/cluster/standalone/ClusterStandaloneModuleDefine.java deleted file mode 100644 index e5d334dcf9..0000000000 --- a/apm-collector-3.2.3/apm-collector-cluster/src/main/java/org/skywalking/apm/collector/cluster/standalone/ClusterStandaloneModuleDefine.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.cluster.standalone; - -import org.skywalking.apm.collector.client.h2.H2Client; -import org.skywalking.apm.collector.cluster.ClusterModuleDefine; -import org.skywalking.apm.collector.cluster.ClusterModuleGroupDefine; -import org.skywalking.apm.collector.core.client.Client; -import org.skywalking.apm.collector.core.client.DataMonitor; -import org.skywalking.apm.collector.core.cluster.ClusterModuleRegistrationReader; -import org.skywalking.apm.collector.core.module.ModuleConfigParser; - -/** - * @author peng-yongsheng - */ -public class ClusterStandaloneModuleDefine extends ClusterModuleDefine { - - public static final String MODULE_NAME = "standalone"; - - private final ClusterStandaloneDataMonitor dataMonitor; - - public ClusterStandaloneModuleDefine() { - this.dataMonitor = new ClusterStandaloneDataMonitor(); - } - - @Override public String group() { - return ClusterModuleGroupDefine.GROUP_NAME; - } - - @Override public String name() { - return MODULE_NAME; - } - - @Override public boolean defaultModule() { - return true; - } - - @Override protected ModuleConfigParser configParser() { - return new ClusterStandaloneConfigParser(); - } - - @Override public DataMonitor dataMonitor() { - return dataMonitor; - } - - @Override protected Client createClient() { - return new H2Client(); - } - - @Override public ClusterModuleRegistrationReader registrationReader() { - return new ClusterStandaloneModuleRegistrationReader(dataMonitor); - } -} diff --git a/apm-collector-3.2.3/apm-collector-cluster/src/main/java/org/skywalking/apm/collector/cluster/standalone/ClusterStandaloneModuleRegistrationReader.java b/apm-collector-3.2.3/apm-collector-cluster/src/main/java/org/skywalking/apm/collector/cluster/standalone/ClusterStandaloneModuleRegistrationReader.java deleted file mode 100644 index 9d20357d77..0000000000 --- a/apm-collector-3.2.3/apm-collector-cluster/src/main/java/org/skywalking/apm/collector/cluster/standalone/ClusterStandaloneModuleRegistrationReader.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.cluster.standalone; - -import org.skywalking.apm.collector.core.client.DataMonitor; -import org.skywalking.apm.collector.core.cluster.ClusterModuleRegistrationReader; - -/** - * @author peng-yongsheng - */ -public class ClusterStandaloneModuleRegistrationReader extends ClusterModuleRegistrationReader { - - public ClusterStandaloneModuleRegistrationReader(DataMonitor dataMonitor) { - super(dataMonitor); - } -} diff --git a/apm-collector-3.2.3/apm-collector-cluster/src/main/java/org/skywalking/apm/collector/cluster/zookeeper/ClusterZKConfig.java b/apm-collector-3.2.3/apm-collector-cluster/src/main/java/org/skywalking/apm/collector/cluster/zookeeper/ClusterZKConfig.java deleted file mode 100644 index 1b350b3d36..0000000000 --- a/apm-collector-3.2.3/apm-collector-cluster/src/main/java/org/skywalking/apm/collector/cluster/zookeeper/ClusterZKConfig.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.cluster.zookeeper; - -/** - * @author peng-yongsheng - */ -public class ClusterZKConfig { - public static String HOST_PORT; - public static int SESSION_TIMEOUT; -} diff --git a/apm-collector-3.2.3/apm-collector-cluster/src/main/java/org/skywalking/apm/collector/cluster/zookeeper/ClusterZKConfigParser.java b/apm-collector-3.2.3/apm-collector-cluster/src/main/java/org/skywalking/apm/collector/cluster/zookeeper/ClusterZKConfigParser.java deleted file mode 100644 index f407190f44..0000000000 --- a/apm-collector-3.2.3/apm-collector-cluster/src/main/java/org/skywalking/apm/collector/cluster/zookeeper/ClusterZKConfigParser.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.cluster.zookeeper; - -import java.util.Map; -import org.skywalking.apm.collector.core.config.ConfigParseException; -import org.skywalking.apm.collector.core.module.ModuleConfigParser; -import org.skywalking.apm.collector.core.util.StringUtils; - -/** - * @author peng-yongsheng - */ -public class ClusterZKConfigParser implements ModuleConfigParser { - - private static final String HOST_PORT = "hostPort"; - private static final String SESSION_TIMEOUT = "sessionTimeout"; - - @Override public void parse(Map config) throws ConfigParseException { - ClusterZKConfig.HOST_PORT = (String)config.get(HOST_PORT); - ClusterZKConfig.SESSION_TIMEOUT = 3000; - - if (StringUtils.isEmpty(ClusterZKConfig.HOST_PORT)) { - throw new ConfigParseException(""); - } - - if (!StringUtils.isEmpty(config.get(SESSION_TIMEOUT))) { - ClusterZKConfig.SESSION_TIMEOUT = (Integer)config.get(SESSION_TIMEOUT); - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-cluster/src/main/java/org/skywalking/apm/collector/cluster/zookeeper/ClusterZKDataMonitor.java b/apm-collector-3.2.3/apm-collector-cluster/src/main/java/org/skywalking/apm/collector/cluster/zookeeper/ClusterZKDataMonitor.java deleted file mode 100644 index 2f4990ec39..0000000000 --- a/apm-collector-3.2.3/apm-collector-cluster/src/main/java/org/skywalking/apm/collector/cluster/zookeeper/ClusterZKDataMonitor.java +++ /dev/null @@ -1,164 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.cluster.zookeeper; - -import java.util.HashSet; -import java.util.Iterator; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; -import org.apache.zookeeper.CreateMode; -import org.apache.zookeeper.WatchedEvent; -import org.apache.zookeeper.Watcher; -import org.apache.zookeeper.ZooDefs; -import org.apache.zookeeper.data.Stat; -import org.skywalking.apm.collector.client.zookeeper.ZookeeperClient; -import org.skywalking.apm.collector.client.zookeeper.ZookeeperClientException; -import org.skywalking.apm.collector.client.zookeeper.util.PathUtils; -import org.skywalking.apm.collector.cluster.ClusterNodeExistException; -import org.skywalking.apm.collector.core.CollectorException; -import org.skywalking.apm.collector.core.client.Client; -import org.skywalking.apm.collector.core.client.ClientException; -import org.skywalking.apm.collector.core.client.DataMonitor; -import org.skywalking.apm.collector.core.cluster.ClusterDataListener; -import org.skywalking.apm.collector.core.module.ModuleRegistration; -import org.skywalking.apm.collector.core.util.CollectionUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class ClusterZKDataMonitor implements DataMonitor, Watcher { - - private final Logger logger = LoggerFactory.getLogger(ClusterZKDataMonitor.class); - - private ZookeeperClient client; - - private Map listeners; - private Map registrations; - - public ClusterZKDataMonitor() { - listeners = new LinkedHashMap<>(); - registrations = new LinkedHashMap<>(); - } - - @Override public synchronized void process(WatchedEvent event) { - logger.info("changed path {}, event type: {}", event.getPath(), event.getType().name()); - if (listeners.containsKey(event.getPath())) { - List paths; - try { - paths = client.getChildren(event.getPath(), true); - ClusterDataListener listener = listeners.get(event.getPath()); - Set remoteNodes = new HashSet<>(); - Set notifiedNodes = listener.getAddresses(); - if (CollectionUtils.isNotEmpty(paths)) { - for (String serverPath : paths) { - Stat stat = new Stat(); - byte[] data = client.getData(event.getPath() + "/" + serverPath, true, stat); - String dataStr = new String(data); - String addressValue = serverPath + dataStr; - remoteNodes.add(addressValue); - if (!notifiedNodes.contains(addressValue)) { - logger.info("path children has been created, path: {}, data: {}", event.getPath() + "/" + serverPath, dataStr); - listener.addAddress(addressValue); - listener.serverJoinNotify(addressValue); - } - } - } - - String[] notifiedNodeArray = notifiedNodes.toArray(new String[notifiedNodes.size()]); - for (int i = notifiedNodeArray.length - 1; i >= 0; i--) { - String address = notifiedNodeArray[i]; - if (remoteNodes.isEmpty() || !remoteNodes.contains(address)) { - logger.info("path children has been remove, path and data: {}", event.getPath() + "/" + address); - listener.removeAddress(address); - listener.serverQuitNotify(address); - } - } - } catch (ZookeeperClientException e) { - logger.error(e.getMessage(), e); - } - } - } - - @Override public void setClient(Client client) { - this.client = (ZookeeperClient)client; - } - - @Override public void start() throws CollectorException { - Iterator> entryIterator = registrations.entrySet().iterator(); - while (entryIterator.hasNext()) { - Map.Entry next = entryIterator.next(); - createPath(next.getKey()); - - ModuleRegistration.Value value = next.getValue().buildValue(); - String contextPath = value.getContextPath() == null ? "" : value.getContextPath(); - - client.getChildren(next.getKey(), true); - String serverPath = next.getKey() + "/" + value.getHostPort(); - - Stat stat = client.exists(serverPath, false); - if (stat != null) { - client.delete(serverPath, stat.getVersion()); - } - stat = client.exists(serverPath, false); - if (stat == null) { - setData(serverPath, contextPath); - } else { - client.delete(serverPath, stat.getVersion()); - throw new ClusterNodeExistException("current address: " + value.getHostPort() + " has been registered, check the host and port configuration or wait a moment."); - } - } - } - - @Override - public void addListener(ClusterDataListener listener, ModuleRegistration registration) throws ClientException { - String path = PathUtils.convertKey2Path(listener.path()); - logger.info("listener path: {}", path); - listeners.put(path, listener); - registrations.put(path, registration); - } - - @Override public ClusterDataListener getListener(String path) { - path = PathUtils.convertKey2Path(path); - return listeners.get(path); - } - - @Override public void createPath(String path) throws ClientException { - String[] paths = path.replaceFirst("/", "").split("/"); - - StringBuilder pathBuilder = new StringBuilder(); - for (String subPath : paths) { - pathBuilder.append("/").append(subPath); - if (client.exists(pathBuilder.toString(), false) == null) { - client.create(pathBuilder.toString(), null, ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT); - } - } - } - - @Override public void setData(String path, String value) throws ClientException { - if (client.exists(path, false) == null) { - client.create(path, value.getBytes(), ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL); - } else { - client.setData(path, value.getBytes(), -1); - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-cluster/src/main/java/org/skywalking/apm/collector/cluster/zookeeper/ClusterZKModuleDefine.java b/apm-collector-3.2.3/apm-collector-cluster/src/main/java/org/skywalking/apm/collector/cluster/zookeeper/ClusterZKModuleDefine.java deleted file mode 100644 index 6cbc453c1e..0000000000 --- a/apm-collector-3.2.3/apm-collector-cluster/src/main/java/org/skywalking/apm/collector/cluster/zookeeper/ClusterZKModuleDefine.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.cluster.zookeeper; - -import org.skywalking.apm.collector.client.zookeeper.ZookeeperClient; -import org.skywalking.apm.collector.cluster.ClusterModuleDefine; -import org.skywalking.apm.collector.cluster.ClusterModuleGroupDefine; -import org.skywalking.apm.collector.core.client.Client; -import org.skywalking.apm.collector.core.client.DataMonitor; -import org.skywalking.apm.collector.core.cluster.ClusterModuleRegistrationReader; -import org.skywalking.apm.collector.core.module.ModuleConfigParser; - -/** - * @author peng-yongsheng - */ -public class ClusterZKModuleDefine extends ClusterModuleDefine { - - public static final String MODULE_NAME = "zookeeper"; - private final ClusterZKDataMonitor dataMonitor; - - public ClusterZKModuleDefine() { - dataMonitor = new ClusterZKDataMonitor(); - } - - @Override protected String group() { - return ClusterModuleGroupDefine.GROUP_NAME; - } - - @Override public String name() { - return MODULE_NAME; - } - - @Override public boolean defaultModule() { - return false; - } - - @Override protected ModuleConfigParser configParser() { - return new ClusterZKConfigParser(); - } - - @Override public DataMonitor dataMonitor() { - return dataMonitor; - } - - @Override protected Client createClient() { - return new ZookeeperClient(ClusterZKConfig.HOST_PORT, ClusterZKConfig.SESSION_TIMEOUT, dataMonitor); - } - - @Override public ClusterModuleRegistrationReader registrationReader() { - return new ClusterZKModuleRegistrationReader(dataMonitor); - } -} diff --git a/apm-collector-3.2.3/apm-collector-cluster/src/main/java/org/skywalking/apm/collector/cluster/zookeeper/ClusterZKModuleRegistrationReader.java b/apm-collector-3.2.3/apm-collector-cluster/src/main/java/org/skywalking/apm/collector/cluster/zookeeper/ClusterZKModuleRegistrationReader.java deleted file mode 100644 index a62e7baabe..0000000000 --- a/apm-collector-3.2.3/apm-collector-cluster/src/main/java/org/skywalking/apm/collector/cluster/zookeeper/ClusterZKModuleRegistrationReader.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.cluster.zookeeper; - -import org.skywalking.apm.collector.core.client.DataMonitor; -import org.skywalking.apm.collector.core.cluster.ClusterModuleRegistrationReader; - -/** - * @author peng-yongsheng - */ -public class ClusterZKModuleRegistrationReader extends ClusterModuleRegistrationReader { - - public ClusterZKModuleRegistrationReader(DataMonitor dataMonitor) { - super(dataMonitor); - } -} diff --git a/apm-collector-3.2.3/apm-collector-cluster/src/main/resources/META-INF/defines/group.define b/apm-collector-3.2.3/apm-collector-cluster/src/main/resources/META-INF/defines/group.define deleted file mode 100644 index 333959bcb1..0000000000 --- a/apm-collector-3.2.3/apm-collector-cluster/src/main/resources/META-INF/defines/group.define +++ /dev/null @@ -1 +0,0 @@ -org.skywalking.apm.collector.cluster.ClusterModuleGroupDefine \ No newline at end of file diff --git a/apm-collector-3.2.3/apm-collector-cluster/src/main/resources/META-INF/defines/module.define b/apm-collector-3.2.3/apm-collector-cluster/src/main/resources/META-INF/defines/module.define deleted file mode 100644 index 64e4e0bf72..0000000000 --- a/apm-collector-3.2.3/apm-collector-cluster/src/main/resources/META-INF/defines/module.define +++ /dev/null @@ -1,3 +0,0 @@ -org.skywalking.apm.collector.cluster.zookeeper.ClusterZKModuleDefine -org.skywalking.apm.collector.cluster.standalone.ClusterStandaloneModuleDefine -org.skywalking.apm.collector.cluster.redis.ClusterRedisModuleDefine \ No newline at end of file diff --git a/apm-collector-3.2.3/apm-collector-core/pom.xml b/apm-collector-3.2.3/apm-collector-core/pom.xml deleted file mode 100644 index 719ffe8228..0000000000 --- a/apm-collector-3.2.3/apm-collector-core/pom.xml +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - apm-collector-3.2.3 - org.skywalking - 3.2.4-2017 - - 4.0.0 - - apm-collector-3.2.3-core - jar - - - - org.yaml - snakeyaml - 1.18 - - - com.google.code.gson - gson - 2.8.1 - - - diff --git a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/CollectorException.java b/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/CollectorException.java deleted file mode 100644 index ba459eeebb..0000000000 --- a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/CollectorException.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.core; - -/** - * @author peng-yongsheng - */ -public class CollectorException extends Exception { - - public CollectorException(String message) { - super(message); - } - - public CollectorException(String message, Throwable cause) { - super(message, cause); - } -} diff --git a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/client/Client.java b/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/client/Client.java deleted file mode 100644 index d6f4141ebf..0000000000 --- a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/client/Client.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.core.client; - -/** - * @author peng-yongsheng - */ -public interface Client { - void initialize() throws ClientException; - - void shutdown(); -} diff --git a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/client/ClientException.java b/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/client/ClientException.java deleted file mode 100644 index b3088011c8..0000000000 --- a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/client/ClientException.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.core.client; - -import org.skywalking.apm.collector.core.CollectorException; - -/** - * @author peng-yongsheng - */ -public abstract class ClientException extends CollectorException { - public ClientException(String message) { - super(message); - } - - public ClientException(String message, Throwable cause) { - super(message, cause); - } -} diff --git a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/client/DataMonitor.java b/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/client/DataMonitor.java deleted file mode 100644 index 3143383624..0000000000 --- a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/client/DataMonitor.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.core.client; - -import org.skywalking.apm.collector.core.cluster.ClusterDataListener; -import org.skywalking.apm.collector.core.framework.Starter; -import org.skywalking.apm.collector.core.module.ModuleRegistration; - -/** - * @author peng-yongsheng - */ -public interface DataMonitor extends Starter { - void setClient(Client client); - - void addListener(ClusterDataListener listener, ModuleRegistration registration) throws ClientException; - - ClusterDataListener getListener(String path); - - void createPath(String path) throws ClientException; - - void setData(String path, String value) throws ClientException; -} diff --git a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/cluster/ClusterDataListener.java b/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/cluster/ClusterDataListener.java deleted file mode 100644 index 1d0f43b6a5..0000000000 --- a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/cluster/ClusterDataListener.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.core.cluster; - -import java.util.HashSet; -import java.util.Set; -import org.skywalking.apm.collector.core.framework.Listener; - -/** - * @author peng-yongsheng - */ -public abstract class ClusterDataListener implements Listener { - - private Set addresses; - - public ClusterDataListener() { - addresses = new HashSet<>(); - } - - public abstract String path(); - - public final void addAddress(String address) { - addresses.add(address); - } - - public final void removeAddress(String address) { - addresses.remove(address); - } - - public final Set getAddresses() { - return addresses; - } - - public abstract void serverJoinNotify(String serverAddress); - - public abstract void serverQuitNotify(String serverAddress); -} diff --git a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/cluster/ClusterDataListenerDefine.java b/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/cluster/ClusterDataListenerDefine.java deleted file mode 100644 index b77e1a1a68..0000000000 --- a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/cluster/ClusterDataListenerDefine.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.core.cluster; - -/** - * @author peng-yongsheng - */ -public interface ClusterDataListenerDefine { - ClusterDataListener listener(); -} diff --git a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/cluster/ClusterModuleContext.java b/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/cluster/ClusterModuleContext.java deleted file mode 100644 index 56ab0aa66f..0000000000 --- a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/cluster/ClusterModuleContext.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.core.cluster; - -import org.skywalking.apm.collector.core.client.DataMonitor; -import org.skywalking.apm.collector.core.framework.Context; - -/** - * @author peng-yongsheng - */ -public class ClusterModuleContext extends Context { - - public ClusterModuleContext(String groupName) { - super(groupName); - } - - private ClusterModuleRegistrationReader reader; - - private DataMonitor dataMonitor; - - public ClusterModuleRegistrationReader getReader() { - return reader; - } - - public void setReader(ClusterModuleRegistrationReader reader) { - this.reader = reader; - } - - public DataMonitor getDataMonitor() { - return dataMonitor; - } - - public void setDataMonitor(DataMonitor dataMonitor) { - this.dataMonitor = dataMonitor; - } -} diff --git a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/cluster/ClusterModuleDiscovery.java b/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/cluster/ClusterModuleDiscovery.java deleted file mode 100644 index 508ecd0ab2..0000000000 --- a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/cluster/ClusterModuleDiscovery.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.core.cluster; - -/** - * @author peng-yongsheng - */ -public interface ClusterModuleDiscovery { - - void discover(); -} diff --git a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/cluster/ClusterModuleException.java b/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/cluster/ClusterModuleException.java deleted file mode 100644 index f8ba83d01c..0000000000 --- a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/cluster/ClusterModuleException.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.core.cluster; - -import org.skywalking.apm.collector.core.module.ModuleException; - -/** - * @author peng-yongsheng - */ -public class ClusterModuleException extends ModuleException { - - public ClusterModuleException(String message) { - super(message); - } - - public ClusterModuleException(String message, Throwable cause) { - super(message, cause); - } -} diff --git a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/cluster/ClusterModuleRegistrationReader.java b/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/cluster/ClusterModuleRegistrationReader.java deleted file mode 100644 index 775b92fe1a..0000000000 --- a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/cluster/ClusterModuleRegistrationReader.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.core.cluster; - -import java.util.Set; -import org.skywalking.apm.collector.core.client.DataMonitor; - -/** - * @author peng-yongsheng - */ -public abstract class ClusterModuleRegistrationReader { - - private final DataMonitor dataMonitor; - - public ClusterModuleRegistrationReader(DataMonitor dataMonitor) { - this.dataMonitor = dataMonitor; - } - - public final Set read(String path) { - return dataMonitor.getListener(path).getAddresses(); - } -} diff --git a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/config/ConfigException.java b/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/config/ConfigException.java deleted file mode 100644 index b5e970046c..0000000000 --- a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/config/ConfigException.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.core.config; - -import org.skywalking.apm.collector.core.CollectorException; - -/** - * @author peng-yongsheng - */ -public abstract class ConfigException extends CollectorException { - - public ConfigException(String message) { - super(message); - } - - public ConfigException(String message, Throwable cause) { - super(message, cause); - } -} diff --git a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/config/ConfigLoader.java b/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/config/ConfigLoader.java deleted file mode 100644 index bc0deb8b63..0000000000 --- a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/config/ConfigLoader.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.core.config; - -import org.skywalking.apm.collector.core.framework.Loader; - -/** - * @author peng-yongsheng - */ -public interface ConfigLoader extends Loader { -} diff --git a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/config/ConfigLoaderException.java b/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/config/ConfigLoaderException.java deleted file mode 100644 index 2a6ce6bc73..0000000000 --- a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/config/ConfigLoaderException.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.core.config; - -/** - * @author peng-yongsheng - */ -public abstract class ConfigLoaderException extends ConfigException { - - public ConfigLoaderException(String message) { - super(message); - } - - public ConfigLoaderException(String message, Throwable cause) { - super(message, cause); - } -} diff --git a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/config/ConfigParseException.java b/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/config/ConfigParseException.java deleted file mode 100644 index f5293b8916..0000000000 --- a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/config/ConfigParseException.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.core.config; - -/** - * @author peng-yongsheng - */ -public class ConfigParseException extends ConfigException { - - public ConfigParseException(String message) { - super(message); - } - - public ConfigParseException(String message, Throwable cause) { - super(message, cause); - } -} diff --git a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/config/GroupConfigParser.java b/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/config/GroupConfigParser.java deleted file mode 100644 index 62f644d0b0..0000000000 --- a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/config/GroupConfigParser.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.core.config; - -import java.util.Map; - -/** - * @author peng-yongsheng - */ -public interface GroupConfigParser { - String NODE_NAME = "config"; - - void parse(Map config); -} diff --git a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/config/SystemConfig.java b/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/config/SystemConfig.java deleted file mode 100644 index ec787f6843..0000000000 --- a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/config/SystemConfig.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.core.config; - -/** - * @author peng-yongsheng - */ -public class SystemConfig { - public static String DATA_PATH = "../data"; -} diff --git a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/config/SystemConfigParser.java b/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/config/SystemConfigParser.java deleted file mode 100644 index aa90354dd3..0000000000 --- a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/config/SystemConfigParser.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.core.config; - -import org.skywalking.apm.collector.core.util.StringUtils; - -/** - * @author peng-yongsheng - */ -public enum SystemConfigParser { - INSTANCE; - - private static final String DATA_PATH = "data.path"; - - public void parse() { - if (!StringUtils.isEmpty(System.getProperty(DATA_PATH))) { - SystemConfig.DATA_PATH = System.getProperty(DATA_PATH); - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/framework/CollectorContextHelper.java b/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/framework/CollectorContextHelper.java deleted file mode 100644 index eaace4ac08..0000000000 --- a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/framework/CollectorContextHelper.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.core.framework; - -import java.util.LinkedHashMap; -import java.util.Map; -import org.skywalking.apm.collector.core.cluster.ClusterModuleContext; - -/** - * @author peng-yongsheng - */ -public enum CollectorContextHelper { - INSTANCE; - - private ClusterModuleContext clusterModuleContext; - private Map contexts = new LinkedHashMap<>(); - - public Context getContext(String moduleGroupName) { - return contexts.get(moduleGroupName); - } - - public ClusterModuleContext getClusterModuleContext() { - return this.clusterModuleContext; - } - - public void putContext(Context context) { - if (contexts.containsKey(context.getGroupName())) { - throw new UnsupportedOperationException("This module context was put, do not allow put a new one"); - } else { - contexts.put(context.getGroupName(), context); - } - } - - public void putClusterContext(ClusterModuleContext clusterModuleContext) { - this.clusterModuleContext = clusterModuleContext; - } -} diff --git a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/framework/Context.java b/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/framework/Context.java deleted file mode 100644 index 4627622784..0000000000 --- a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/framework/Context.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.core.framework; - -/** - * @author peng-yongsheng - */ -public abstract class Context { - private final String groupName; - - public Context(String groupName) { - this.groupName = groupName; - } - - public final String getGroupName() { - return groupName; - } -} diff --git a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/framework/DataInitializer.java b/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/framework/DataInitializer.java deleted file mode 100644 index 497ff19099..0000000000 --- a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/framework/DataInitializer.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.core.framework; - -import org.skywalking.apm.collector.core.client.Client; -import org.skywalking.apm.collector.core.client.ClientException; - -/** - * @author peng-yongsheng - */ -public interface DataInitializer { - void initialize(Client client) throws ClientException; - - void addItem(Client client, String itemKey) throws ClientException; - - boolean existItem(Client client, String itemKey) throws ClientException; -} diff --git a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/framework/Decision.java b/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/framework/Decision.java deleted file mode 100644 index 3194177760..0000000000 --- a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/framework/Decision.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.core.framework; - -/** - * @author peng-yongsheng - */ -public interface Decision { -} diff --git a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/framework/Define.java b/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/framework/Define.java deleted file mode 100644 index 6650fe4e1c..0000000000 --- a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/framework/Define.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.core.framework; - -/** - * @author peng-yongsheng - */ -public interface Define { - String name(); -} diff --git a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/framework/DefineException.java b/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/framework/DefineException.java deleted file mode 100644 index 18ebb00c95..0000000000 --- a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/framework/DefineException.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.core.framework; - -import org.skywalking.apm.collector.core.CollectorException; - -/** - * @author peng-yongsheng - */ -public abstract class DefineException extends CollectorException { - - public DefineException(String message) { - super(message); - } - - public DefineException(String message, Throwable cause) { - super(message, cause); - } -} diff --git a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/framework/DefinitionFile.java b/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/framework/DefinitionFile.java deleted file mode 100644 index c06b6a8e98..0000000000 --- a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/framework/DefinitionFile.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.core.framework; - -/** - * @author peng-yongsheng - */ -public abstract class DefinitionFile { - - private static final String CATALOG = "META-INF/defines/"; - - protected abstract String fileName(); - - public final String get() { - return CATALOG + fileName(); - } -} diff --git a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/framework/Executor.java b/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/framework/Executor.java deleted file mode 100644 index f768bac444..0000000000 --- a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/framework/Executor.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.core.framework; - -/** - * @author peng-yongsheng - */ -public interface Executor { - void execute(Object message); -} diff --git a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/framework/Handler.java b/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/framework/Handler.java deleted file mode 100644 index b482237bed..0000000000 --- a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/framework/Handler.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.core.framework; - -/** - * @author peng-yongsheng - */ -public interface ServerHandler { -} diff --git a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/framework/Listener.java b/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/framework/Listener.java deleted file mode 100644 index 20e8e8aa48..0000000000 --- a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/framework/Listener.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.core.framework; - -/** - * @author peng-yongsheng - */ -public interface Listener { -} diff --git a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/framework/Loader.java b/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/framework/Loader.java deleted file mode 100644 index 8cd44208e2..0000000000 --- a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/framework/Loader.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.core.framework; - -/** - * @author peng-yongsheng - */ -public interface Loader { - T load() throws DefineException; -} diff --git a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/framework/PriorityDecision.java b/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/framework/PriorityDecision.java deleted file mode 100644 index bc9a263de9..0000000000 --- a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/framework/PriorityDecision.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.core.framework; - -import java.util.List; - -/** - * @author peng-yongsheng - */ -public class PriorityDecision implements Decision { - - public Object decide(List source) { - return source.get(0); - } - - public static class Priority { - private final int value; - private final Object object; - - public Priority(int value, Object object) { - this.value = value; - this.object = object; - } - - public int getValue() { - return value; - } - - public Object getObject() { - return object; - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/framework/Provider.java b/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/framework/Provider.java deleted file mode 100644 index f49cf0519f..0000000000 --- a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/framework/Provider.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.core.framework; - -/** - * @author peng-yongsheng - */ -public interface Provider { - D create(); -} diff --git a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/framework/Starter.java b/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/framework/Starter.java deleted file mode 100644 index ae5f2f2634..0000000000 --- a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/framework/Starter.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.core.framework; - -import org.skywalking.apm.collector.core.CollectorException; - -/** - * @author peng-yongsheng - */ -public interface Starter { - void start() throws CollectorException; -} diff --git a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/framework/UnexpectedException.java b/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/framework/UnexpectedException.java deleted file mode 100644 index dd10bf08dc..0000000000 --- a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/framework/UnexpectedException.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.core.framework; - -/** - * @author peng-yongsheng - */ -public class UnexpectedException extends RuntimeException { - - public UnexpectedException(String message) { - super(message); - } -} diff --git a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/module/CommonModuleInstaller.java b/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/module/CommonModuleInstaller.java deleted file mode 100644 index 5ded4903ca..0000000000 --- a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/module/CommonModuleInstaller.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.core.module; - -import java.util.Map; -import org.skywalking.apm.collector.core.CollectorException; - -/** - * @author peng-yongsheng - */ -public abstract class CommonModuleInstaller implements ModuleInstaller { - - private boolean isInstalled = false; - private Map moduleConfig; - private Map moduleDefineMap; - - @Override - public final void injectConfiguration(Map moduleConfig, Map moduleDefineMap) { - this.moduleConfig = moduleConfig; - this.moduleDefineMap = moduleDefineMap; - } - - final Map getModuleConfig() { - return moduleConfig; - } - - final Map getModuleDefineMap() { - return moduleDefineMap; - } - - public abstract void onAfterInstall() throws CollectorException; - - @Override public final void afterInstall() throws CollectorException { - if (!isInstalled) { - onAfterInstall(); - } - isInstalled = true; - } -} diff --git a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/module/Module.java b/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/module/Module.java deleted file mode 100644 index c315e0cfc3..0000000000 --- a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/module/Module.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.core.module; - -import java.util.Map; - -/** - * @author peng-yongsheng - */ -public interface Module { - void install(Map configuration); -} diff --git a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/module/ModuleConfigLoader.java b/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/module/ModuleConfigLoader.java deleted file mode 100644 index 4b5140e2a5..0000000000 --- a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/module/ModuleConfigLoader.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.core.module; - -import java.io.FileNotFoundException; -import java.io.Reader; -import java.util.Map; -import org.skywalking.apm.collector.core.config.ConfigLoader; -import org.skywalking.apm.collector.core.framework.DefineException; -import org.skywalking.apm.collector.core.util.ResourceUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.yaml.snakeyaml.Yaml; - -/** - * @author peng-yongsheng - */ -public class ModuleConfigLoader implements ConfigLoader> { - - private final Logger logger = LoggerFactory.getLogger(ModuleConfigLoader.class); - - @Override public Map load() throws DefineException { - Yaml yaml = new Yaml(); - try { - try { - Reader applicationReader = ResourceUtils.read("application.yml"); - return (Map)yaml.load(applicationReader); - } catch (FileNotFoundException e) { - logger.info("Could not found application.yml file, use default"); - return (Map)yaml.load(ResourceUtils.read("application-default.yml")); - } - } catch (FileNotFoundException e) { - throw new ModuleDefineException(e.getMessage(), e); - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/module/ModuleConfigParser.java b/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/module/ModuleConfigParser.java deleted file mode 100644 index 9c7ef7b354..0000000000 --- a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/module/ModuleConfigParser.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.core.module; - -import java.util.Map; -import org.skywalking.apm.collector.core.config.ConfigParseException; - -/** - * @author peng-yongsheng - */ -public interface ModuleConfigParser { - void parse(Map config) throws ConfigParseException; -} diff --git a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/module/ModuleContext.java b/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/module/ModuleContext.java deleted file mode 100644 index 97121822ef..0000000000 --- a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/module/ModuleContext.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.core.module; - -import org.skywalking.apm.collector.core.cluster.ClusterModuleContext; - -/** - * @author peng-yongsheng - */ -public class ModuleContext { - private ClusterModuleContext clusterContext; - - public ClusterModuleContext getClusterContext() { - return clusterContext; - } - - public void setClusterContext(ClusterModuleContext clusterContext) { - this.clusterContext = clusterContext; - } -} diff --git a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/module/ModuleDefine.java b/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/module/ModuleDefine.java deleted file mode 100644 index 8544ad1ab9..0000000000 --- a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/module/ModuleDefine.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.core.module; - -import java.util.List; -import org.skywalking.apm.collector.core.client.Client; -import org.skywalking.apm.collector.core.framework.Define; -import org.skywalking.apm.collector.core.framework.Handler; -import org.skywalking.apm.collector.core.server.Server; - -/** - * @author peng-yongsheng - */ -public abstract class ModuleDefine implements Define { - - protected abstract String group(); - - public abstract boolean defaultModule(); - - protected abstract ModuleConfigParser configParser(); - - protected abstract Client createClient(); - - protected abstract Server server(); - - public abstract List handlerList(); - - protected abstract ModuleRegistration registration(); - - protected abstract void initializeOtherContext(); -} diff --git a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/module/ModuleDefineException.java b/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/module/ModuleDefineException.java deleted file mode 100644 index 202f31ccbd..0000000000 --- a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/module/ModuleDefineException.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.core.module; - -import org.skywalking.apm.collector.core.framework.DefineException; - -/** - * @author peng-yongsheng - */ -public class ModuleDefineException extends DefineException { - public ModuleDefineException(String message) { - super(message); - } - - public ModuleDefineException(String message, Throwable cause) { - super(message, cause); - } -} diff --git a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/module/ModuleDefineLoader.java b/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/module/ModuleDefineLoader.java deleted file mode 100644 index 3a65c6f640..0000000000 --- a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/module/ModuleDefineLoader.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.core.module; - -import java.util.LinkedHashMap; -import java.util.Map; -import org.skywalking.apm.collector.core.framework.DefineException; -import org.skywalking.apm.collector.core.framework.Loader; -import org.skywalking.apm.collector.core.util.DefinitionLoader; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class ModuleDefineLoader implements Loader>> { - - private final Logger logger = LoggerFactory.getLogger(ModuleDefineLoader.class); - - @Override public Map> load() throws DefineException { - Map> moduleDefineMap = new LinkedHashMap<>(); - - ModuleDefinitionFile definitionFile = new ModuleDefinitionFile(); - logger.info("module definition file name: {}", definitionFile.fileName()); - DefinitionLoader definitionLoader = DefinitionLoader.load(ModuleDefine.class, definitionFile); - for (ModuleDefine moduleDefine : definitionLoader) { - logger.info("loaded module definition class: {}", moduleDefine.getClass().getName()); - - String groupName = moduleDefine.group(); - if (!moduleDefineMap.containsKey(groupName)) { - moduleDefineMap.put(groupName, new LinkedHashMap<>()); - } - moduleDefineMap.get(groupName).put(moduleDefine.name().toLowerCase(), moduleDefine); - } - return moduleDefineMap; - } -} diff --git a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/module/ModuleDefinitionFile.java b/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/module/ModuleDefinitionFile.java deleted file mode 100644 index d14cef1e41..0000000000 --- a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/module/ModuleDefinitionFile.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.core.module; - -import org.skywalking.apm.collector.core.framework.DefinitionFile; - -/** - * @author peng-yongsheng - */ -public class ModuleDefinitionFile extends DefinitionFile { - @Override protected String fileName() { - return "module.define"; - } -} diff --git a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/module/ModuleException.java b/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/module/ModuleException.java deleted file mode 100644 index da7a56cd7f..0000000000 --- a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/module/ModuleException.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.core.module; - -import org.skywalking.apm.collector.core.framework.DefineException; - -/** - * @author peng-yongsheng - */ -public abstract class ModuleException extends DefineException { - - public ModuleException(String message) { - super(message); - } - - public ModuleException(String message, Throwable cause) { - super(message, cause); - } -} diff --git a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/module/ModuleGroupDefine.java b/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/module/ModuleGroupDefine.java deleted file mode 100644 index 105103aa1a..0000000000 --- a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/module/ModuleGroupDefine.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.core.module; - -import org.skywalking.apm.collector.core.config.GroupConfigParser; -import org.skywalking.apm.collector.core.framework.Context; - -/** - * @author peng-yongsheng - */ -public interface ModuleGroupDefine { - String name(); - - Context groupContext(); - - ModuleInstaller moduleInstaller(); - - GroupConfigParser groupConfigParser(); -} diff --git a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/module/ModuleGroupDefineFile.java b/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/module/ModuleGroupDefineFile.java deleted file mode 100644 index db871d9b2f..0000000000 --- a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/module/ModuleGroupDefineFile.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.core.module; - -import org.skywalking.apm.collector.core.framework.DefinitionFile; - -/** - * @author peng-yongsheng - */ -public class ModuleGroupDefineFile extends DefinitionFile { - @Override protected String fileName() { - return "group.define"; - } -} diff --git a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/module/ModuleGroupDefineLoader.java b/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/module/ModuleGroupDefineLoader.java deleted file mode 100644 index 38deb7659c..0000000000 --- a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/module/ModuleGroupDefineLoader.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.core.module; - -import java.util.Iterator; -import java.util.LinkedHashMap; -import java.util.Map; -import org.skywalking.apm.collector.core.framework.DefineException; -import org.skywalking.apm.collector.core.framework.Loader; -import org.skywalking.apm.collector.core.util.DefinitionLoader; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class ModuleGroupDefineLoader implements Loader> { - - private final Logger logger = LoggerFactory.getLogger(ModuleGroupDefineLoader.class); - - @Override public Map load() throws DefineException { - Map moduleGroupDefineMap = new LinkedHashMap<>(); - - ModuleGroupDefineFile definitionFile = new ModuleGroupDefineFile(); - logger.info("module group definition file name: {}", definitionFile.fileName()); - DefinitionLoader definitionLoader = DefinitionLoader.load(ModuleGroupDefine.class, definitionFile); - Iterator defineIterator = definitionLoader.iterator(); - while (defineIterator.hasNext()) { - ModuleGroupDefine groupDefine = defineIterator.next(); - String groupName = groupDefine.name().toLowerCase(); - moduleGroupDefineMap.put(groupName, groupDefine); - } - return moduleGroupDefineMap; - } -} diff --git a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/module/ModuleInstaller.java b/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/module/ModuleInstaller.java deleted file mode 100644 index a59c0a20d4..0000000000 --- a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/module/ModuleInstaller.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.core.module; - -import java.util.List; -import java.util.Map; -import org.skywalking.apm.collector.core.CollectorException; -import org.skywalking.apm.collector.core.client.ClientException; -import org.skywalking.apm.collector.core.config.ConfigException; -import org.skywalking.apm.collector.core.framework.Context; -import org.skywalking.apm.collector.core.framework.DefineException; -import org.skywalking.apm.collector.core.server.ServerException; -import org.skywalking.apm.collector.core.server.ServerHolder; - -/** - * @author peng-yongsheng - */ -public interface ModuleInstaller { - - List dependenceModules(); - - void injectServerHolder(ServerHolder serverHolder); - - String groupName(); - - Context moduleContext(); - - void injectConfiguration(Map moduleConfig, Map moduleDefineMap); - - void preInstall() throws DefineException, ConfigException, ServerException; - - void install() throws ClientException, DefineException, ConfigException, ServerException; - - void afterInstall() throws CollectorException; -} diff --git a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/module/ModuleRegistration.java b/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/module/ModuleRegistration.java deleted file mode 100644 index 42bbd5fe38..0000000000 --- a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/module/ModuleRegistration.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.core.module; - -/** - * @author peng-yongsheng - */ -public abstract class ModuleRegistration { - - public abstract Value buildValue(); - - public static class Value { - private final String host; - private final int port; - private final String contextPath; - - public Value(String host, int port, String contextPath) { - this.host = host; - this.port = port; - this.contextPath = contextPath; - } - - public String getHost() { - return host; - } - - public int getPort() { - return port; - } - - public String getHostPort() { - return host + ":" + port; - } - - public String getContextPath() { - return contextPath; - } - } -} \ No newline at end of file diff --git a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/module/MultipleModuleInstaller.java b/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/module/MultipleModuleInstaller.java deleted file mode 100644 index 2f64d0a2b7..0000000000 --- a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/module/MultipleModuleInstaller.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.core.module; - -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import org.skywalking.apm.collector.core.CollectorException; -import org.skywalking.apm.collector.core.client.ClientException; -import org.skywalking.apm.collector.core.cluster.ClusterDataListenerDefine; -import org.skywalking.apm.collector.core.config.ConfigException; -import org.skywalking.apm.collector.core.framework.CollectorContextHelper; -import org.skywalking.apm.collector.core.framework.DefineException; -import org.skywalking.apm.collector.core.server.ServerException; -import org.skywalking.apm.collector.core.server.ServerHolder; -import org.skywalking.apm.collector.core.util.ObjectUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public abstract class MultipleModuleInstaller extends CommonModuleInstaller { - - private final Logger logger = LoggerFactory.getLogger(MultipleModuleInstaller.class); - - public MultipleModuleInstaller() { - moduleDefines = new LinkedList<>(); - } - - private List moduleDefines; - private ServerHolder serverHolder; - - @Override public final void injectServerHolder(ServerHolder serverHolder) { - this.serverHolder = serverHolder; - } - - @Override public final void preInstall() throws DefineException, ConfigException, ServerException { - logger.info("install module group: {}", groupName()); - Map moduleConfig = getModuleConfig(); - Map moduleDefineMap = getModuleDefineMap(); - - Iterator> moduleDefineIterator = moduleDefineMap.entrySet().iterator(); - while (moduleDefineIterator.hasNext()) { - Map.Entry moduleDefineEntry = moduleDefineIterator.next(); - logger.info("module {} initialize", moduleDefineEntry.getKey()); - moduleDefineEntry.getValue().configParser().parse(moduleConfig.get(moduleDefineEntry.getKey())); - moduleDefines.add(moduleDefineEntry.getValue()); - serverHolder.holdServer(moduleDefineEntry.getValue().server(), moduleDefineEntry.getValue().handlerList()); - } - } - - @Override public void install() throws DefineException, ConfigException, ServerException, ClientException { - CollectorContextHelper.INSTANCE.putContext(moduleContext()); - for (ModuleDefine moduleDefine : moduleDefines) { - moduleDefine.initializeOtherContext(); - - if (moduleDefine instanceof ClusterDataListenerDefine) { - ClusterDataListenerDefine listenerDefine = (ClusterDataListenerDefine)moduleDefine; - if (ObjectUtils.isNotEmpty(listenerDefine.listener()) && ObjectUtils.isNotEmpty(moduleDefine.registration())) { - logger.info("add group: {}, module: {}, listener into cluster data monitor", moduleDefine.group(), moduleDefine.name()); - CollectorContextHelper.INSTANCE.getClusterModuleContext().getDataMonitor().addListener(listenerDefine.listener(), moduleDefine.registration()); - } - } - } - } - - @Override public void onAfterInstall() throws CollectorException { - - } -} diff --git a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/module/SingleModuleInstaller.java b/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/module/SingleModuleInstaller.java deleted file mode 100644 index b61776948e..0000000000 --- a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/module/SingleModuleInstaller.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.core.module; - -import java.util.Iterator; -import java.util.Map; -import org.skywalking.apm.collector.core.client.ClientException; -import org.skywalking.apm.collector.core.cluster.ClusterDataListenerDefine; -import org.skywalking.apm.collector.core.cluster.ClusterModuleContext; -import org.skywalking.apm.collector.core.cluster.ClusterModuleException; -import org.skywalking.apm.collector.core.config.ConfigException; -import org.skywalking.apm.collector.core.framework.CollectorContextHelper; -import org.skywalking.apm.collector.core.framework.DefineException; -import org.skywalking.apm.collector.core.server.ServerException; -import org.skywalking.apm.collector.core.server.ServerHolder; -import org.skywalking.apm.collector.core.util.CollectionUtils; -import org.skywalking.apm.collector.core.util.ObjectUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public abstract class SingleModuleInstaller extends CommonModuleInstaller { - - private final Logger logger = LoggerFactory.getLogger(SingleModuleInstaller.class); - - private ModuleDefine moduleDefine; - private ServerHolder serverHolder; - - @Override public final void injectServerHolder(ServerHolder serverHolder) { - this.serverHolder = serverHolder; - } - - @Override public final void preInstall() throws DefineException, ConfigException, ServerException { - logger.info("install module group: {}", groupName()); - Map moduleConfig = getModuleConfig(); - Map moduleDefineMap = getModuleDefineMap(); - if (CollectionUtils.isNotEmpty(moduleConfig)) { - if (moduleConfig.size() > 1) { - throw new ClusterModuleException("single module, but configure multiple modules"); - } - - Map.Entry configEntry = moduleConfig.entrySet().iterator().next(); - if (moduleDefineMap.containsKey(configEntry.getKey())) { - moduleDefine = moduleDefineMap.get(configEntry.getKey()); - moduleDefine.configParser().parse(configEntry.getValue()); - } else { - throw new ClusterModuleException("module name incorrect, please check the module name in application.yml"); - } - } else { - logger.info("could not configure module, use the default"); - Iterator> moduleDefineIterator = moduleDefineMap.entrySet().iterator(); - - boolean hasDefaultModule = false; - while (moduleDefineIterator.hasNext()) { - Map.Entry moduleDefineEntry = moduleDefineIterator.next(); - if (moduleDefineEntry.getValue().defaultModule()) { - if (hasDefaultModule) { - throw new ClusterModuleException("single module, but configure multiple default module"); - } - this.moduleDefine = moduleDefineEntry.getValue(); - if (this.moduleDefine.configParser() != null) { - this.moduleDefine.configParser().parse(null); - } - hasDefaultModule = true; - } - } - } - serverHolder.holdServer(moduleDefine.server(), moduleDefine.handlerList()); - } - - @Override public void install() throws ClientException, DefineException, ConfigException, ServerException { - if (!(moduleContext() instanceof ClusterModuleContext)) { - CollectorContextHelper.INSTANCE.putContext(moduleContext()); - } - moduleDefine.initializeOtherContext(); - - if (moduleDefine instanceof ClusterDataListenerDefine) { - ClusterDataListenerDefine listenerDefine = (ClusterDataListenerDefine)moduleDefine; - if (ObjectUtils.isNotEmpty(listenerDefine.listener()) && ObjectUtils.isNotEmpty(moduleDefine.registration())) { - CollectorContextHelper.INSTANCE.getClusterModuleContext().getDataMonitor().addListener(listenerDefine.listener(), moduleDefine.registration()); - logger.info("add group: {}, module: {}, listener into cluster data monitor", moduleDefine.group(), moduleDefine.name()); - } - } - } - - protected ModuleDefine getModuleDefine() { - return moduleDefine; - } -} diff --git a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/queue/DaemonThreadFactory.java b/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/queue/DaemonThreadFactory.java deleted file mode 100644 index 7da9a25770..0000000000 --- a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/queue/DaemonThreadFactory.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.core.queue; - -import java.util.concurrent.ThreadFactory; - -/** - * @author peng-yongsheng - */ -public enum DaemonThreadFactory implements ThreadFactory { - INSTANCE; - - @Override - public Thread newThread(Runnable r) { - Thread t = new Thread(r); - t.setDaemon(true); - return t; - } -} diff --git a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/queue/EndOfBatchCommand.java b/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/queue/EndOfBatchCommand.java deleted file mode 100644 index 41565d36b3..0000000000 --- a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/queue/EndOfBatchCommand.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.core.queue; - -/** - * @author peng-yongsheng - */ -public class EndOfBatchCommand { -} diff --git a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/queue/MessageHolder.java b/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/queue/MessageHolder.java deleted file mode 100644 index c10ba3512d..0000000000 --- a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/queue/MessageHolder.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.core.queue; - -/** - * @author peng-yongsheng - */ -public class MessageHolder { - private Object message; - - public Object getMessage() { - return message; - } - - public void setMessage(Object message) { - this.message = message; - } - - public void reset() { - message = null; - } -} diff --git a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/queue/QueueCreator.java b/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/queue/QueueCreator.java deleted file mode 100644 index 39236b58a7..0000000000 --- a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/queue/QueueCreator.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.core.queue; - -/** - * @author peng-yongsheng - */ -public interface QueueCreator { - QueueEventHandler create(int queueSize, QueueExecutor executor); -} diff --git a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/queue/QueueEventHandler.java b/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/queue/QueueEventHandler.java deleted file mode 100644 index aa13c82b29..0000000000 --- a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/queue/QueueEventHandler.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.core.queue; - -/** - * @author peng-yongsheng - */ -public interface QueueEventHandler { - void tell(Object message); -} diff --git a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/queue/QueueExecutor.java b/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/queue/QueueExecutor.java deleted file mode 100644 index 27d88e655b..0000000000 --- a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/queue/QueueExecutor.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.core.queue; - -import org.skywalking.apm.collector.core.framework.Executor; - -/** - * @author peng-yongsheng - */ -public interface QueueExecutor extends Executor { -} diff --git a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/remote/Remote.java b/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/remote/Remote.java deleted file mode 100644 index 9459d18404..0000000000 --- a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/remote/Remote.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.core.remote; - -/** - * @author peng-yongsheng - */ -public interface Remote { - void call(Object message); -} diff --git a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/server/Server.java b/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/server/Server.java deleted file mode 100644 index 934e5d0013..0000000000 --- a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/server/Server.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.core.server; - -import org.skywalking.apm.collector.core.framework.Handler; - -/** - * @author peng-yongsheng - */ -public interface Server { - - String hostPort(); - - String serverClassify(); - - void initialize() throws ServerException; - - void start() throws ServerException; - - void addHandler(Handler handler); -} diff --git a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/server/ServerException.java b/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/server/ServerException.java deleted file mode 100644 index 9eedf1fc05..0000000000 --- a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/server/ServerException.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.core.server; - -import org.skywalking.apm.collector.core.CollectorException; - -/** - * @author peng-yongsheng - */ -public abstract class ServerException extends CollectorException { - - public ServerException(String message) { - super(message); - } - - public ServerException(String message, Throwable cause) { - super(message, cause); - } -} diff --git a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/server/ServerHolder.java b/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/server/ServerHolder.java deleted file mode 100644 index 2484c6e686..0000000000 --- a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/server/ServerHolder.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.core.server; - -import java.util.LinkedList; -import java.util.List; -import org.skywalking.apm.collector.core.framework.Handler; -import org.skywalking.apm.collector.core.util.CollectionUtils; -import org.skywalking.apm.collector.core.util.ObjectUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class ServerHolder { - - private final Logger logger = LoggerFactory.getLogger(ServerHolder.class); - - private List servers; - - public ServerHolder() { - servers = new LinkedList<>(); - } - - public void holdServer(Server newServer, List handlers) throws ServerException { - if (ObjectUtils.isEmpty(newServer) || CollectionUtils.isEmpty(handlers)) { - return; - } - - boolean isNewServer = true; - for (Server server : servers) { - if (server.hostPort().equals(newServer.hostPort()) && server.serverClassify().equals(newServer.serverClassify())) { - isNewServer = false; - addHandler(handlers, server); - } - } - if (isNewServer) { - newServer.initialize(); - servers.add(newServer); - addHandler(handlers, newServer); - } - } - - private void addHandler(List handlers, Server server) { - if (CollectionUtils.isNotEmpty(handlers)) { - handlers.forEach(handler -> { - server.addHandler(handler); - logger.debug("add handler into server: {}, handler name: {}", server.hostPort(), handler.getClass().getName()); - }); - } - } - - public List getServers() { - return servers; - } -} diff --git a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/server/ServerModuleDefine.java b/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/server/ServerModuleDefine.java deleted file mode 100644 index dca6ccdbe4..0000000000 --- a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/server/ServerModuleDefine.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.core.server; - -import org.skywalking.apm.collector.core.module.ModuleDefine; - -/** - * @author peng-yongsheng - */ -public abstract class ServerModuleDefine extends ModuleDefine { -} diff --git a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/storage/ColumnDefine.java b/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/storage/ColumnDefine.java deleted file mode 100644 index 75e6161321..0000000000 --- a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/storage/ColumnDefine.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.core.storage; - -/** - * @author peng-yongsheng - */ -public abstract class ColumnDefine { - private final String name; - private final String type; - - public ColumnDefine(String name, String type) { - this.name = name; - this.type = type; - } - - public final String getName() { - return name; - } - - public String getType() { - return type; - } -} diff --git a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/storage/StorageBatchBuilder.java b/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/storage/StorageBatchBuilder.java deleted file mode 100644 index dec0f2b701..0000000000 --- a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/storage/StorageBatchBuilder.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.core.storage; - -import java.util.List; -import java.util.Map; - -/** - * @author peng-yongsheng - */ -public abstract class StorageBatchBuilder { - public abstract List build(C client, Map lastData); -} diff --git a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/storage/StorageDefineLoader.java b/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/storage/StorageDefineLoader.java deleted file mode 100644 index af6b907586..0000000000 --- a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/storage/StorageDefineLoader.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.core.storage; - -import java.util.LinkedList; -import java.util.List; -import org.skywalking.apm.collector.core.framework.DefineException; -import org.skywalking.apm.collector.core.framework.Loader; -import org.skywalking.apm.collector.core.util.DefinitionLoader; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class StorageDefineLoader implements Loader> { - - private final Logger logger = LoggerFactory.getLogger(StorageDefineLoader.class); - - @Override public List load() throws DefineException { - List tableDefines = new LinkedList<>(); - - StorageDefinitionFile definitionFile = new StorageDefinitionFile(); - logger.info("storage definition file name: {}", definitionFile.fileName()); - DefinitionLoader definitionLoader = DefinitionLoader.load(TableDefine.class, definitionFile); - for (TableDefine tableDefine : definitionLoader) { - logger.info("loaded storage definition class: {}", tableDefine.getClass().getName()); - tableDefines.add(tableDefine); - } - return tableDefines; - } -} diff --git a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/storage/StorageDefinitionFile.java b/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/storage/StorageDefinitionFile.java deleted file mode 100644 index 9c34cd72f1..0000000000 --- a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/storage/StorageDefinitionFile.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.core.storage; - -import org.skywalking.apm.collector.core.framework.DefinitionFile; - -/** - * @author peng-yongsheng - */ -public class StorageDefinitionFile extends DefinitionFile { - @Override protected String fileName() { - return "storage.define"; - } -} diff --git a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/storage/StorageException.java b/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/storage/StorageException.java deleted file mode 100644 index e5ac3967ed..0000000000 --- a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/storage/StorageException.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.core.storage; - -import org.skywalking.apm.collector.core.CollectorException; - -/** - * @author peng-yongsheng - */ -public abstract class StorageException extends CollectorException { - public StorageException(String message) { - super(message); - } - - public StorageException(String message, Throwable cause) { - super(message, cause); - } -} diff --git a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/storage/StorageInstallException.java b/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/storage/StorageInstallException.java deleted file mode 100644 index 237a5d048e..0000000000 --- a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/storage/StorageInstallException.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.core.storage; - -/** - * @author peng-yongsheng - */ -public class StorageInstallException extends StorageException { - - public StorageInstallException(String message) { - super(message); - } - - public StorageInstallException(String message, Throwable cause) { - super(message, cause); - } -} diff --git a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/storage/StorageInstaller.java b/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/storage/StorageInstaller.java deleted file mode 100644 index 9246367797..0000000000 --- a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/storage/StorageInstaller.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.core.storage; - -import java.util.List; -import org.skywalking.apm.collector.core.client.Client; -import org.skywalking.apm.collector.core.framework.DefineException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public abstract class StorageInstaller { - - private final Logger logger = LoggerFactory.getLogger(StorageInstaller.class); - - public final void install(Client client) throws StorageException { - StorageDefineLoader defineLoader = new StorageDefineLoader(); - try { - List tableDefines = defineLoader.load(); - defineFilter(tableDefines); - Boolean debug = System.getProperty("debug") != null; - - for (TableDefine tableDefine : tableDefines) { - tableDefine.initialize(); - if (!isExists(client, tableDefine)) { - logger.info("table: {} not exists", tableDefine.getName()); - createTable(client, tableDefine); - } else if (debug) { - logger.info("table: {} exists", tableDefine.getName()); - deleteTable(client, tableDefine); - createTable(client, tableDefine); - } - } - } catch (DefineException e) { - throw new StorageInstallException(e.getMessage(), e); - } - } - - protected abstract void defineFilter(List tableDefines); - - protected abstract boolean isExists(Client client, TableDefine tableDefine) throws StorageException; - - protected abstract boolean deleteTable(Client client, TableDefine tableDefine) throws StorageException; - - protected abstract boolean createTable(Client client, TableDefine tableDefine) throws StorageException; -} diff --git a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/storage/TableDefine.java b/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/storage/TableDefine.java deleted file mode 100644 index 731280f959..0000000000 --- a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/storage/TableDefine.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.core.storage; - -import java.util.LinkedList; -import java.util.List; - -/** - * @author peng-yongsheng - */ -public abstract class TableDefine { - private final String name; - private final List columnDefines; - - public TableDefine(String name) { - this.name = name; - this.columnDefines = new LinkedList<>(); - } - - public abstract void initialize(); - - public final void addColumn(ColumnDefine columnDefine) { - columnDefines.add(columnDefine); - } - - public final String getName() { - return name; - } - - public final List getColumnDefines() { - return columnDefines; - } -} diff --git a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/stream/AbstractHashMessage.java b/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/stream/AbstractHashMessage.java deleted file mode 100644 index a2157b4cae..0000000000 --- a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/stream/AbstractHashMessage.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.core.stream; - -/** - * The AbstractHashMessage implementations represent aggregate message, - * which use to aggregate metric. - *

- * - * @author peng-yongsheng - * @since v3.0-2017 - */ -public abstract class AbstractHashMessage { - private int hashCode; - - public AbstractHashMessage(String key) { - this.hashCode = key.hashCode(); - } - - public int getHashCode() { - return hashCode; - } -} diff --git a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/stream/Data.java b/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/stream/Data.java deleted file mode 100644 index 8311d4af92..0000000000 --- a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/stream/Data.java +++ /dev/null @@ -1,132 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.core.stream; - -/** - * @author peng-yongsheng - */ -public class Data extends AbstractHashMessage { - private final int stringCapacity; - private final int longCapacity; - private final int doubleCapacity; - private final int integerCapacity; - private final int booleanCapacity; - private final int byteCapacity; - private String[] dataStrings; - private Long[] dataLongs; - private Double[] dataDoubles; - private Integer[] dataIntegers; - private Boolean[] dataBooleans; - private byte[][] dataBytes; - - public Data(String id, int stringCapacity, int longCapacity, int doubleCapacity, int integerCapacity, - int booleanCapacity, int byteCapacity) { - super(id); - this.dataStrings = new String[stringCapacity]; - this.dataStrings[0] = id; - this.dataLongs = new Long[longCapacity]; - this.dataDoubles = new Double[doubleCapacity]; - this.dataIntegers = new Integer[integerCapacity]; - this.dataBooleans = new Boolean[booleanCapacity]; - this.dataBytes = new byte[byteCapacity][]; - this.stringCapacity = stringCapacity; - this.longCapacity = longCapacity; - this.doubleCapacity = doubleCapacity; - this.integerCapacity = integerCapacity; - this.booleanCapacity = booleanCapacity; - this.byteCapacity = byteCapacity; - } - - public void setDataString(int position, String value) { - dataStrings[position] = value; - } - - public void setDataLong(int position, Long value) { - dataLongs[position] = value; - } - - public void setDataDouble(int position, Double value) { - dataDoubles[position] = value; - } - - public void setDataInteger(int position, Integer value) { - dataIntegers[position] = value; - } - - public void setDataBoolean(int position, Boolean value) { - dataBooleans[position] = value; - } - - public void setDataBytes(int position, byte[] dataBytes) { - this.dataBytes[position] = dataBytes; - } - - public String getDataString(int position) { - return dataStrings[position]; - } - - public Long getDataLong(int position) { - return dataLongs[position]; - } - - public Double getDataDouble(int position) { - return dataDoubles[position]; - } - - public Integer getDataInteger(int position) { - return dataIntegers[position]; - } - - public Boolean getDataBoolean(int position) { - return dataBooleans[position]; - } - - public byte[] getDataBytes(int position) { - return dataBytes[position]; - } - - public String id() { - return dataStrings[0]; - } - - @Override public String toString() { - StringBuilder dataStr = new StringBuilder(); - dataStr.append("string: ["); - for (int i = 0; i < dataStrings.length; i++) { - dataStr.append(dataStrings[i]).append(","); - } - dataStr.append("], longs: ["); - for (int i = 0; i < dataLongs.length; i++) { - dataStr.append(dataLongs[i]).append(","); - } - dataStr.append("], double: ["); - for (int i = 0; i < dataDoubles.length; i++) { - dataStr.append(dataDoubles[i]).append(","); - } - dataStr.append("], integer: ["); - for (int i = 0; i < dataIntegers.length; i++) { - dataStr.append(dataIntegers[i]).append(","); - } - dataStr.append("], boolean: ["); - for (int i = 0; i < dataBooleans.length; i++) { - dataStr.append(dataBooleans[i]).append(","); - } - return dataStr.toString(); - } -} diff --git a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/stream/Operation.java b/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/stream/Operation.java deleted file mode 100644 index 84f9b0df2a..0000000000 --- a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/stream/Operation.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.core.stream; - -/** - * @author peng-yongsheng - */ -public interface Operation { - String operate(String newValue, String oldValue); - - Long operate(Long newValue, Long oldValue); - - Double operate(Double newValue, Double oldValue); - - Integer operate(Integer newValue, Integer oldValue); - - Boolean operate(Boolean newValue, Boolean oldValue); - - byte[] operate(byte[] newValue, byte[] oldValue); -} diff --git a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/stream/Transform.java b/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/stream/Transform.java deleted file mode 100644 index 672e60e67c..0000000000 --- a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/stream/Transform.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.core.stream; - -/** - * @author peng-yongsheng - */ -public interface Transform { - Data toData(); - - T toSelf(Data data); -} diff --git a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/stream/operate/AddOperation.java b/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/stream/operate/AddOperation.java deleted file mode 100644 index e9adfe9a1f..0000000000 --- a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/stream/operate/AddOperation.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.core.stream.operate; - -import org.skywalking.apm.collector.core.stream.Operation; - -/** - * @author peng-yongsheng - */ -public class AddOperation implements Operation { - - @Override public String operate(String newValue, String oldValue) { - throw new UnsupportedOperationException("not support string addition operation"); - } - - @Override public Long operate(Long newValue, Long oldValue) { - return newValue + oldValue; - } - - @Override public Double operate(Double newValue, Double oldValue) { - return newValue + oldValue; - } - - @Override public Integer operate(Integer newValue, Integer oldValue) { - return newValue + oldValue; - } - - @Override public Boolean operate(Boolean newValue, Boolean oldValue) { - throw new UnsupportedOperationException("not support boolean addition operation"); - } - - @Override public byte[] operate(byte[] newValue, byte[] oldValue) { - throw new UnsupportedOperationException("not support byte addition operation"); - } -} diff --git a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/stream/operate/CoverOperation.java b/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/stream/operate/CoverOperation.java deleted file mode 100644 index 966c54b668..0000000000 --- a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/stream/operate/CoverOperation.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.core.stream.operate; - -import org.skywalking.apm.collector.core.stream.Operation; - -/** - * @author peng-yongsheng - */ -public class CoverOperation implements Operation { - @Override public String operate(String newValue, String oldValue) { - return newValue; - } - - @Override public Long operate(Long newValue, Long oldValue) { - return newValue; - } - - @Override public Double operate(Double newValue, Double oldValue) { - return newValue; - } - - @Override public Integer operate(Integer newValue, Integer oldValue) { - return newValue; - } - - @Override public Boolean operate(Boolean newValue, Boolean oldValue) { - return newValue; - } - - @Override public byte[] operate(byte[] newValue, byte[] oldValue) { - return newValue; - } -} diff --git a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/stream/operate/NonOperation.java b/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/stream/operate/NonOperation.java deleted file mode 100644 index 16887786a7..0000000000 --- a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/stream/operate/NonOperation.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.core.stream.operate; - -import org.skywalking.apm.collector.core.stream.Operation; - -/** - * @author peng-yongsheng - */ -public class NonOperation implements Operation { - @Override public String operate(String newValue, String oldValue) { - return oldValue; - } - - @Override public Long operate(Long newValue, Long oldValue) { - return oldValue; - } - - @Override public Double operate(Double newValue, Double oldValue) { - return oldValue; - } - - @Override public Integer operate(Integer newValue, Integer oldValue) { - return oldValue; - } - - @Override public Boolean operate(Boolean newValue, Boolean oldValue) { - return oldValue; - } - - @Override public byte[] operate(byte[] newValue, byte[] oldValue) { - return oldValue; - } -} diff --git a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/util/BytesUtils.java b/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/util/BytesUtils.java deleted file mode 100644 index d39c914c15..0000000000 --- a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/util/BytesUtils.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.core.util; - -/** - * @author peng-yongsheng - */ -public class BytesUtils { - - public static byte[] long2Bytes(long num) { - byte[] byteNum = new byte[8]; - for (int ix = 0; ix < 8; ++ix) { - int offset = 64 - (ix + 1) * 8; - byteNum[ix] = (byte)((num >> offset) & 0xff); - } - return byteNum; - } - - public static long bytes2Long(byte[] byteNum) { - long num = 0; - for (int ix = 0; ix < 8; ++ix) { - num <<= 8; - num |= byteNum[ix] & 0xff; - } - return num; - } -} diff --git a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/util/CollectionUtils.java b/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/util/CollectionUtils.java deleted file mode 100644 index a0dd89bdb4..0000000000 --- a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/util/CollectionUtils.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.core.util; - -import java.util.List; -import java.util.Map; - -/** - * @author peng-yongsheng - */ -public class CollectionUtils { - - public static boolean isEmpty(Map map) { - return map == null || map.size() == 0; - } - - public static boolean isEmpty(List list) { - return list == null || list.size() == 0; - } - - public static boolean isNotEmpty(List list) { - return !isEmpty(list); - } - - public static boolean isNotEmpty(Map map) { - return !isEmpty(map); - } - - public static boolean isNotEmpty(T[] array) { - return array != null && array.length > 0; - } -} diff --git a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/util/ColumnNameUtils.java b/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/util/ColumnNameUtils.java deleted file mode 100644 index 0909cf39e6..0000000000 --- a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/util/ColumnNameUtils.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.core.util; - -/** - * @author peng-yongsheng - */ -public enum ColumnNameUtils { - INSTANCE; - - public String rename(String columnName) { - StringBuilder renamedColumnName = new StringBuilder(); - char[] chars = columnName.toLowerCase().toCharArray(); - - boolean findUnderline = false; - for (char character : chars) { - if (character == '_') { - findUnderline = true; - } else if (findUnderline) { - renamedColumnName.append(String.valueOf(character).toUpperCase()); - findUnderline = false; - } else { - renamedColumnName.append(character); - } - } - return renamedColumnName.toString(); - } -} diff --git a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/util/Const.java b/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/util/Const.java deleted file mode 100644 index f6a4a90221..0000000000 --- a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/util/Const.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.core.util; - -/** - * @author peng-yongsheng - */ -public class Const { - public static final String ID_SPLIT = "_"; - public static final int USER_ID = 1; - public static final int NONE_SERVICE_ID = 1; - public static final String NONE_SERVICE_NAME = "None"; - public static final String USER_CODE = "User"; - public static final String SEGMENT_SPAN_SPLIT = "S"; - public static final String UNKNOWN = "Unknown"; - public static final String EXCEPTION = "Exception"; - public static final String EMPTY_STRING = ""; - public static final String FILE_SUFFIX = "sw"; -} diff --git a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/util/DefinitionLoader.java b/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/util/DefinitionLoader.java deleted file mode 100644 index 461cff6044..0000000000 --- a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/util/DefinitionLoader.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.core.util; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStreamReader; -import java.net.URL; -import java.util.Enumeration; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Objects; -import java.util.Properties; -import org.skywalking.apm.collector.core.framework.DefinitionFile; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class DefinitionLoader implements Iterable { - - private final Logger logger = LoggerFactory.getLogger(DefinitionLoader.class); - - private final Class definition; - private final DefinitionFile definitionFile; - - protected DefinitionLoader(Class svc, DefinitionFile definitionFile) { - this.definition = Objects.requireNonNull(svc, "definition interface cannot be null"); - this.definitionFile = definitionFile; - } - - public static DefinitionLoader load(Class definition, DefinitionFile definitionFile) { - return new DefinitionLoader(definition, definitionFile); - } - - @Override public final Iterator iterator() { - logger.info("load definition file: {}", definitionFile.get()); - List definitionList = new LinkedList<>(); - try { - Enumeration urlEnumeration = this.getClass().getClassLoader().getResources(definitionFile.get()); - while (urlEnumeration.hasMoreElements()) { - URL definitionFileURL = urlEnumeration.nextElement(); - logger.info("definition file url: {}", definitionFileURL.getPath()); - BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(definitionFileURL.openStream())); - Properties properties = new Properties(); - properties.load(bufferedReader); - - Enumeration defineItem = properties.propertyNames(); - while (defineItem.hasMoreElements()) { - String fullNameClass = (String)defineItem.nextElement(); - definitionList.add(fullNameClass); - } - } - } catch (IOException e) { - logger.error(e.getMessage(), e); - } - - Iterator moduleDefineIterator = definitionList.iterator(); - - return new Iterator() { - @Override public boolean hasNext() { - return moduleDefineIterator.hasNext(); - } - - @Override public D next() { - String definitionClass = moduleDefineIterator.next(); - logger.info("definitionClass: {}", definitionClass); - try { - Class c = Class.forName(definitionClass); - return (D)c.newInstance(); - } catch (Exception e) { - logger.error(e.getMessage(), e); - } - return null; - } - }; - } -} diff --git a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/util/ObjectUtils.java b/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/util/ObjectUtils.java deleted file mode 100644 index 428f09dac9..0000000000 --- a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/util/ObjectUtils.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.core.util; - -/** - * @author peng-yongsheng - */ -public class ObjectUtils { - public static boolean isEmpty(Object obj) { - return obj == null; - } - - public static boolean isNotEmpty(Object obj) { - return !isEmpty(obj); - } -} diff --git a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/util/ResourceUtils.java b/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/util/ResourceUtils.java deleted file mode 100644 index e1e832df5f..0000000000 --- a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/util/ResourceUtils.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.core.util; - -import java.io.FileNotFoundException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.Reader; -import java.net.URL; - -/** - * @author peng-yongsheng - */ -public class ResourceUtils { - - public static Reader read(String fileName) throws FileNotFoundException { - URL url = ResourceUtils.class.getClassLoader().getResource(fileName); - if (url == null) { - throw new FileNotFoundException("file not found: " + fileName); - } - InputStream inputStream = ResourceUtils.class.getClassLoader().getResourceAsStream(fileName); - return new InputStreamReader(inputStream); - } -} diff --git a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/util/StringUtils.java b/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/util/StringUtils.java deleted file mode 100644 index eb4c004779..0000000000 --- a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/util/StringUtils.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.core.util; - -/** - * @author peng-yongsheng - */ -public class StringUtils { - - public static final String EMPTY_STRING = ""; - - public static boolean isEmpty(Object str) { - return str == null || EMPTY_STRING.equals(str); - } - - public static boolean isNotEmpty(Object str) { - return !isEmpty(str); - } -} diff --git a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/util/TimeBucketUtils.java b/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/util/TimeBucketUtils.java deleted file mode 100644 index 4514ff9917..0000000000 --- a/apm-collector-3.2.3/apm-collector-core/src/main/java/org/skywalking/apm/collector/core/util/TimeBucketUtils.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.core.util; - -import java.text.SimpleDateFormat; -import java.util.Calendar; -import java.util.TimeZone; -import org.skywalking.apm.collector.core.framework.UnexpectedException; - -/** - * @author peng-yongsheng - */ -public enum TimeBucketUtils { - INSTANCE; - - private final SimpleDateFormat dayDateFormat = new SimpleDateFormat("yyyyMMdd"); - private final SimpleDateFormat hourDateFormat = new SimpleDateFormat("yyyyMMddHH"); - private final SimpleDateFormat minuteDateFormat = new SimpleDateFormat("yyyyMMddHHmm"); - private final SimpleDateFormat secondDateFormat = new SimpleDateFormat("yyyyMMddHHmmss"); - - public long getMinuteTimeBucket(long time) { - Calendar calendar = Calendar.getInstance(); - calendar.setTimeInMillis(time); - String timeStr = minuteDateFormat.format(calendar.getTime()); - return Long.valueOf(timeStr); - } - - public long getSecondTimeBucket(long time) { - Calendar calendar = Calendar.getInstance(); - calendar.setTimeInMillis(time); - String timeStr = secondDateFormat.format(calendar.getTime()); - return Long.valueOf(timeStr); - } - - public long getHourTimeBucket(long time) { - Calendar calendar = Calendar.getInstance(); - calendar.setTimeInMillis(time); - String timeStr = hourDateFormat.format(calendar.getTime()) + "00"; - return Long.valueOf(timeStr); - } - - public long getDayTimeBucket(long time) { - Calendar calendar = Calendar.getInstance(); - calendar.setTimeInMillis(time); - String timeStr = dayDateFormat.format(calendar.getTime()) + "0000"; - return Long.valueOf(timeStr); - } - - public long changeTimeBucket2TimeStamp(String timeBucketType, long timeBucket) { - if (TimeBucketType.SECOND.name().toLowerCase().equals(timeBucketType.toLowerCase())) { - Calendar calendar = Calendar.getInstance(); - calendar.set(Calendar.YEAR, Integer.valueOf(String.valueOf(timeBucket).substring(0, 4))); - calendar.set(Calendar.MONTH, Integer.valueOf(String.valueOf(timeBucket).substring(4, 6)) - 1); - calendar.set(Calendar.DAY_OF_MONTH, Integer.valueOf(String.valueOf(timeBucket).substring(6, 8))); - calendar.set(Calendar.HOUR_OF_DAY, Integer.valueOf(String.valueOf(timeBucket).substring(8, 10))); - calendar.set(Calendar.MINUTE, Integer.valueOf(String.valueOf(timeBucket).substring(10, 12))); - calendar.set(Calendar.SECOND, Integer.valueOf(String.valueOf(timeBucket).substring(12, 14))); - return calendar.getTimeInMillis(); - } else if (TimeBucketType.MINUTE.name().toLowerCase().equals(timeBucketType.toLowerCase())) { - Calendar calendar = Calendar.getInstance(); - calendar.set(Calendar.YEAR, Integer.valueOf(String.valueOf(timeBucket).substring(0, 4))); - calendar.set(Calendar.MONTH, Integer.valueOf(String.valueOf(timeBucket).substring(4, 6)) - 1); - calendar.set(Calendar.DAY_OF_MONTH, Integer.valueOf(String.valueOf(timeBucket).substring(6, 8))); - calendar.set(Calendar.HOUR_OF_DAY, Integer.valueOf(String.valueOf(timeBucket).substring(8, 10))); - calendar.set(Calendar.MINUTE, Integer.valueOf(String.valueOf(timeBucket).substring(10, 12))); - return calendar.getTimeInMillis(); - } else { - throw new UnexpectedException("time bucket type must be second or minute"); - } - } - - public long[] getFiveSecondTimeBuckets(long secondTimeBucket) { - long timeStamp = changeTimeBucket2TimeStamp(TimeBucketType.SECOND.name(), secondTimeBucket); - Calendar calendar = Calendar.getInstance(); - calendar.setTimeInMillis(timeStamp); - - long[] timeBuckets = new long[5]; - timeBuckets[0] = secondTimeBucket; - for (int i = 0; i < 4; i++) { - calendar.add(Calendar.SECOND, -1); - timeBuckets[i + 1] = getSecondTimeBucket(calendar.getTimeInMillis()); - } - return timeBuckets; - } - - public long changeToUTCTimeBucket(long timeBucket) { - String timeBucketStr = String.valueOf(timeBucket); - - if (TimeZone.getDefault().getID().equals("GMT+08:00") || timeBucketStr.endsWith("0000")) { - return timeBucket; - } else { - return timeBucket - 800; - } - } - - public long addSecondForSecondTimeBucket(String timeBucketType, long timeBucket, int second) { - if (!TimeBucketType.SECOND.name().equals(timeBucketType)) { - throw new UnexpectedException("time bucket type must be second "); - } - Calendar calendar = Calendar.getInstance(); - calendar.setTimeInMillis(changeTimeBucket2TimeStamp(timeBucketType, timeBucket)); - calendar.add(Calendar.SECOND, second); - - return getSecondTimeBucket(calendar.getTimeInMillis()); - } - - public enum TimeBucketType { - SECOND, MINUTE, HOUR, DAY - } -} diff --git a/apm-collector-3.2.3/apm-collector-core/src/main/resources/application-default.yml b/apm-collector-3.2.3/apm-collector-core/src/main/resources/application-default.yml deleted file mode 100644 index e6d654a9d4..0000000000 --- a/apm-collector-3.2.3/apm-collector-core/src/main/resources/application-default.yml +++ /dev/null @@ -1,36 +0,0 @@ -#cluster: -# zookeeper: -# hostPort: localhost:2181 -# sessionTimeout: 100000 -agent_server: - jetty: - host: localhost - port: 10800 - context_path: / -agent_stream: - grpc: - host: localhost - port: 11800 - jetty: - host: localhost - port: 12800 - context_path: / - config: - buffer_offset_max_file_size: 10M - buffer_segment_max_file_size: 500M -ui: - jetty: - host: localhost - port: 12800 - context_path: / -collector_inside: - grpc: - host: localhost - port: 11800 -#storage: -# elasticsearch: -# cluster_name: CollectorDBCluster -# cluster_transport_sniffer: true -# cluster_nodes: localhost:9300 -# index_shards_number: 2 -# index_replicas_number: 0 \ No newline at end of file diff --git a/apm-collector-3.2.3/apm-collector-core/src/main/resources/logback.xml b/apm-collector-3.2.3/apm-collector-core/src/main/resources/logback.xml deleted file mode 100644 index 00f1534300..0000000000 --- a/apm-collector-3.2.3/apm-collector-core/src/main/resources/logback.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - %d{HH:mm:ss.SSS} [%thread] %-5level %logger{70} - %msg%n - - - - - - - - - - \ No newline at end of file diff --git a/apm-collector-3.2.3/apm-collector-core/src/test/java/org/skywalking/apm/collector/core/module/ModuleConfigLoaderTestCase.java b/apm-collector-3.2.3/apm-collector-core/src/test/java/org/skywalking/apm/collector/core/module/ModuleConfigLoaderTestCase.java deleted file mode 100644 index 546e39dcd3..0000000000 --- a/apm-collector-3.2.3/apm-collector-core/src/test/java/org/skywalking/apm/collector/core/module/ModuleConfigLoaderTestCase.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.core.module; - -import java.util.Map; - -import org.junit.Assert; -import org.junit.Test; -import org.skywalking.apm.collector.core.framework.DefineException; - -/** - * @author neeuq - */ -public class ModuleConfigLoaderTestCase { - - @SuppressWarnings({ "rawtypes" }) - @Test - public void testLoad() throws DefineException { - ModuleConfigLoader configLoader = new ModuleConfigLoader(); - Map configuration = configLoader.load(); - Assert.assertNotNull(configuration.get("cluster")); - Assert.assertNotNull(configuration.get("cluster").get("zookeeper")); - } -} diff --git a/apm-collector-3.2.3/apm-collector-core/src/test/java/org/skywalking/apm/collector/core/utils/ColumnNameUtilsTestCase.java b/apm-collector-3.2.3/apm-collector-core/src/test/java/org/skywalking/apm/collector/core/utils/ColumnNameUtilsTestCase.java deleted file mode 100644 index 4e68bbc873..0000000000 --- a/apm-collector-3.2.3/apm-collector-core/src/test/java/org/skywalking/apm/collector/core/utils/ColumnNameUtilsTestCase.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.core.utils; - -import org.junit.Assert; -import org.junit.Test; -import org.skywalking.apm.collector.core.util.ColumnNameUtils; - -/** - * @author peng-yongsheng - */ -public class ColumnNameUtilsTestCase { - - @Test - public void testRename() { - String columnName = ColumnNameUtils.INSTANCE.rename("aaa_bbb_ccc"); - Assert.assertEquals("aaaBbbCcc", columnName); - } -} diff --git a/apm-collector-3.2.3/apm-collector-core/src/test/java/org/skywalking/apm/collector/core/utils/ResourceUtilsTestCase.java b/apm-collector-3.2.3/apm-collector-core/src/test/java/org/skywalking/apm/collector/core/utils/ResourceUtilsTestCase.java deleted file mode 100644 index 851050c117..0000000000 --- a/apm-collector-3.2.3/apm-collector-core/src/test/java/org/skywalking/apm/collector/core/utils/ResourceUtilsTestCase.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.core.utils; - -import java.io.IOException; -import java.io.Reader; - -import org.junit.Assert; -import org.junit.Test; -import org.skywalking.apm.collector.core.util.ResourceUtils; - -/** - * @author neeuq - */ -public class ResourceUtilsTestCase { - - @Test - public void testRead() throws IOException { - Reader reader = ResourceUtils.read("application.yml"); - Assert.assertNotNull(reader); - reader.close(); - } - -} diff --git a/apm-collector-3.2.3/apm-collector-core/src/test/java/org/skywalking/apm/collector/core/utils/TimeBucketUtilsTestCase.java b/apm-collector-3.2.3/apm-collector-core/src/test/java/org/skywalking/apm/collector/core/utils/TimeBucketUtilsTestCase.java deleted file mode 100644 index 4f5cdfc330..0000000000 --- a/apm-collector-3.2.3/apm-collector-core/src/test/java/org/skywalking/apm/collector/core/utils/TimeBucketUtilsTestCase.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.core.utils; - -import org.junit.Assert; -import org.junit.Test; -import org.skywalking.apm.collector.core.util.TimeBucketUtils; - -/** - * @author peng-yongsheng - */ -public class TimeBucketUtilsTestCase { - - @Test - public void testGetFiveSecondTimeBucket() { - long[] timeBuckets = TimeBucketUtils.INSTANCE.getFiveSecondTimeBuckets(20170804224810L); - Assert.assertEquals(20170804224810L, timeBuckets[0]); - Assert.assertEquals(20170804224809L, timeBuckets[1]); - Assert.assertEquals(20170804224808L, timeBuckets[2]); - Assert.assertEquals(20170804224807L, timeBuckets[3]); - Assert.assertEquals(20170804224806L, timeBuckets[4]); - } - - @Test - public void testChangeTimeBucket2TimeStamp() { - long timeStamp = TimeBucketUtils.INSTANCE.changeTimeBucket2TimeStamp(TimeBucketUtils.TimeBucketType.MINUTE.name(), 201708120810L); - long minute = TimeBucketUtils.INSTANCE.getMinuteTimeBucket(timeStamp); - Assert.assertEquals(201708120810L, minute); - } -} diff --git a/apm-collector-3.2.3/apm-collector-core/src/test/resources/META-INF/defines/module.define b/apm-collector-3.2.3/apm-collector-core/src/test/resources/META-INF/defines/module.define deleted file mode 100644 index 5d6f8c358c..0000000000 --- a/apm-collector-3.2.3/apm-collector-core/src/test/resources/META-INF/defines/module.define +++ /dev/null @@ -1 +0,0 @@ -cluster=org.skywalking.apm.collector.core.module.ClusterModuleForTest \ No newline at end of file diff --git a/apm-collector-3.2.3/apm-collector-core/src/test/resources/application.yml b/apm-collector-3.2.3/apm-collector-core/src/test/resources/application.yml deleted file mode 100644 index ec549438f9..0000000000 --- a/apm-collector-3.2.3/apm-collector-core/src/test/resources/application.yml +++ /dev/null @@ -1,8 +0,0 @@ -cluster: - zookeeper: - host: localhost-zk - port: 1000 - redis: - host: localhost-rd - port: 2000 - diff --git a/apm-collector-3.2.3/apm-collector-core/src/test/resources/logback-test.xml b/apm-collector-3.2.3/apm-collector-core/src/test/resources/logback-test.xml deleted file mode 100644 index acd6b8a572..0000000000 --- a/apm-collector-3.2.3/apm-collector-core/src/test/resources/logback-test.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n - - - - - - - \ No newline at end of file diff --git a/apm-collector-3.2.3/apm-collector-queue/pom.xml b/apm-collector-3.2.3/apm-collector-queue/pom.xml deleted file mode 100644 index 8fad53f355..0000000000 --- a/apm-collector-3.2.3/apm-collector-queue/pom.xml +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - apm-collector-3.2.3 - org.skywalking - 3.2.4-2017 - - 4.0.0 - - apm-collector-3.2.3-queue - jar - - - - org.skywalking - apm-collector-3.2.3-core - ${project.version} - - - com.lmax - disruptor - 3.3.6 - - - diff --git a/apm-collector-3.2.3/apm-collector-queue/src/main/java/org/skywalking/apm/collector/queue/QueueModuleContext.java b/apm-collector-3.2.3/apm-collector-queue/src/main/java/org/skywalking/apm/collector/queue/QueueModuleContext.java deleted file mode 100644 index 36ba58b282..0000000000 --- a/apm-collector-3.2.3/apm-collector-queue/src/main/java/org/skywalking/apm/collector/queue/QueueModuleContext.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.queue; - -import org.skywalking.apm.collector.core.framework.Context; -import org.skywalking.apm.collector.core.queue.QueueCreator; - -/** - * @author peng-yongsheng - */ -public class QueueModuleContext extends Context { - private QueueCreator queueCreator; - - public QueueModuleContext(String groupName) { - super(groupName); - } - - public QueueCreator getQueueCreator() { - return queueCreator; - } - - public void setQueueCreator(QueueCreator queueCreator) { - this.queueCreator = queueCreator; - } -} diff --git a/apm-collector-3.2.3/apm-collector-queue/src/main/java/org/skywalking/apm/collector/queue/QueueModuleDefine.java b/apm-collector-3.2.3/apm-collector-queue/src/main/java/org/skywalking/apm/collector/queue/QueueModuleDefine.java deleted file mode 100644 index b5648eb3b2..0000000000 --- a/apm-collector-3.2.3/apm-collector-queue/src/main/java/org/skywalking/apm/collector/queue/QueueModuleDefine.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.queue; - -import java.util.List; -import org.skywalking.apm.collector.core.client.Client; -import org.skywalking.apm.collector.core.framework.Handler; -import org.skywalking.apm.collector.core.module.ModuleDefine; -import org.skywalking.apm.collector.core.module.ModuleRegistration; -import org.skywalking.apm.collector.core.server.Server; - -/** - * @author peng-yongsheng - */ -public abstract class QueueModuleDefine extends ModuleDefine { - - @Override protected Client createClient() { - return null; - } - - @Override protected final ModuleRegistration registration() { - throw new UnsupportedOperationException(""); - } - - @Override protected final Server server() { - return null; - } - - @Override public final List handlerList() { - return null; - } -} diff --git a/apm-collector-3.2.3/apm-collector-queue/src/main/java/org/skywalking/apm/collector/queue/QueueModuleException.java b/apm-collector-3.2.3/apm-collector-queue/src/main/java/org/skywalking/apm/collector/queue/QueueModuleException.java deleted file mode 100644 index 7854625f8d..0000000000 --- a/apm-collector-3.2.3/apm-collector-queue/src/main/java/org/skywalking/apm/collector/queue/QueueModuleException.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.queue; - -import org.skywalking.apm.collector.core.module.ModuleException; - -/** - * @author peng-yongsheng - */ -public class QueueModuleException extends ModuleException { - public QueueModuleException(String message) { - super(message); - } - - public QueueModuleException(String message, Throwable cause) { - super(message, cause); - } -} diff --git a/apm-collector-3.2.3/apm-collector-queue/src/main/java/org/skywalking/apm/collector/queue/QueueModuleGroupDefine.java b/apm-collector-3.2.3/apm-collector-queue/src/main/java/org/skywalking/apm/collector/queue/QueueModuleGroupDefine.java deleted file mode 100644 index 812a422a05..0000000000 --- a/apm-collector-3.2.3/apm-collector-queue/src/main/java/org/skywalking/apm/collector/queue/QueueModuleGroupDefine.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.queue; - -import org.skywalking.apm.collector.core.config.GroupConfigParser; -import org.skywalking.apm.collector.core.framework.Context; -import org.skywalking.apm.collector.core.module.ModuleGroupDefine; -import org.skywalking.apm.collector.core.module.ModuleInstaller; - -/** - * @author peng-yongsheng - */ -public class QueueModuleGroupDefine implements ModuleGroupDefine { - - public static final String GROUP_NAME = "queue"; - private final QueueModuleInstaller installer; - - public QueueModuleGroupDefine() { - installer = new QueueModuleInstaller(); - } - - @Override public String name() { - return GROUP_NAME; - } - - @Override public Context groupContext() { - return new QueueModuleContext(GROUP_NAME); - } - - @Override public ModuleInstaller moduleInstaller() { - return installer; - } - - @Override public GroupConfigParser groupConfigParser() { - return null; - } -} diff --git a/apm-collector-3.2.3/apm-collector-queue/src/main/java/org/skywalking/apm/collector/queue/QueueModuleInstaller.java b/apm-collector-3.2.3/apm-collector-queue/src/main/java/org/skywalking/apm/collector/queue/QueueModuleInstaller.java deleted file mode 100644 index 95c8dce522..0000000000 --- a/apm-collector-3.2.3/apm-collector-queue/src/main/java/org/skywalking/apm/collector/queue/QueueModuleInstaller.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.queue; - -import java.util.List; -import org.skywalking.apm.collector.core.CollectorException; -import org.skywalking.apm.collector.core.client.ClientException; -import org.skywalking.apm.collector.core.config.ConfigException; -import org.skywalking.apm.collector.core.framework.CollectorContextHelper; -import org.skywalking.apm.collector.core.framework.Context; -import org.skywalking.apm.collector.core.framework.DefineException; -import org.skywalking.apm.collector.core.framework.UnexpectedException; -import org.skywalking.apm.collector.core.module.SingleModuleInstaller; -import org.skywalking.apm.collector.core.server.ServerException; -import org.skywalking.apm.collector.queue.datacarrier.DataCarrierQueueCreator; -import org.skywalking.apm.collector.queue.datacarrier.QueueDataCarrierModuleDefine; -import org.skywalking.apm.collector.queue.disruptor.DisruptorQueueCreator; -import org.skywalking.apm.collector.queue.disruptor.QueueDisruptorModuleDefine; - -/** - * @author peng-yongsheng - */ -public class QueueModuleInstaller extends SingleModuleInstaller { - - @Override public String groupName() { - return QueueModuleGroupDefine.GROUP_NAME; - } - - @Override public Context moduleContext() { - return new QueueModuleContext(groupName()); - } - - @Override public List dependenceModules() { - return null; - } - - @Override public void install() throws ClientException, DefineException, ConfigException, ServerException { - super.install(); - if (getModuleDefine() instanceof QueueDataCarrierModuleDefine) { - ((QueueModuleContext)CollectorContextHelper.INSTANCE.getContext(groupName())).setQueueCreator(new DataCarrierQueueCreator()); - } else if (getModuleDefine() instanceof QueueDisruptorModuleDefine) { - ((QueueModuleContext)CollectorContextHelper.INSTANCE.getContext(groupName())).setQueueCreator(new DisruptorQueueCreator()); - } else { - throw new UnexpectedException(""); - } - } - - @Override public void onAfterInstall() throws CollectorException { - } -} diff --git a/apm-collector-3.2.3/apm-collector-queue/src/main/java/org/skywalking/apm/collector/queue/datacarrier/DataCarrierQueueConfigParser.java b/apm-collector-3.2.3/apm-collector-queue/src/main/java/org/skywalking/apm/collector/queue/datacarrier/DataCarrierQueueConfigParser.java deleted file mode 100644 index c3ad34a636..0000000000 --- a/apm-collector-3.2.3/apm-collector-queue/src/main/java/org/skywalking/apm/collector/queue/datacarrier/DataCarrierQueueConfigParser.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.queue.datacarrier; - -import java.util.Map; -import org.skywalking.apm.collector.core.config.ConfigParseException; -import org.skywalking.apm.collector.core.module.ModuleConfigParser; - -/** - * @author peng-yongsheng - */ -public class DataCarrierQueueConfigParser implements ModuleConfigParser { - - @Override public void parse(Map config) throws ConfigParseException { - - } -} diff --git a/apm-collector-3.2.3/apm-collector-queue/src/main/java/org/skywalking/apm/collector/queue/datacarrier/DataCarrierQueueCreator.java b/apm-collector-3.2.3/apm-collector-queue/src/main/java/org/skywalking/apm/collector/queue/datacarrier/DataCarrierQueueCreator.java deleted file mode 100644 index 482db64ee4..0000000000 --- a/apm-collector-3.2.3/apm-collector-queue/src/main/java/org/skywalking/apm/collector/queue/datacarrier/DataCarrierQueueCreator.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.queue.datacarrier; - -import org.skywalking.apm.collector.core.queue.QueueCreator; -import org.skywalking.apm.collector.core.queue.QueueEventHandler; -import org.skywalking.apm.collector.core.queue.QueueExecutor; - -/** - * @author peng-yongsheng - */ -public class DataCarrierQueueCreator implements QueueCreator { - - @Override public QueueEventHandler create(int queueSize, QueueExecutor executor) { - return null; - } -} diff --git a/apm-collector-3.2.3/apm-collector-queue/src/main/java/org/skywalking/apm/collector/queue/datacarrier/QueueDataCarrierModuleDefine.java b/apm-collector-3.2.3/apm-collector-queue/src/main/java/org/skywalking/apm/collector/queue/datacarrier/QueueDataCarrierModuleDefine.java deleted file mode 100644 index 0694d57ace..0000000000 --- a/apm-collector-3.2.3/apm-collector-queue/src/main/java/org/skywalking/apm/collector/queue/datacarrier/QueueDataCarrierModuleDefine.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.queue.datacarrier; - -import org.skywalking.apm.collector.core.framework.CollectorContextHelper; -import org.skywalking.apm.collector.core.module.ModuleConfigParser; -import org.skywalking.apm.collector.queue.QueueModuleContext; -import org.skywalking.apm.collector.queue.QueueModuleDefine; -import org.skywalking.apm.collector.queue.QueueModuleGroupDefine; - -/** - * @author peng-yongsheng - */ -public class QueueDataCarrierModuleDefine extends QueueModuleDefine { - - @Override protected String group() { - return QueueModuleGroupDefine.GROUP_NAME; - } - - @Override public String name() { - return "data_carrier"; - } - - @Override public boolean defaultModule() { - return false; - } - - @Override protected ModuleConfigParser configParser() { - return new DataCarrierQueueConfigParser(); - } - - @Override protected void initializeOtherContext() { - ((QueueModuleContext)CollectorContextHelper.INSTANCE.getContext(group())).setQueueCreator(new DataCarrierQueueCreator()); - } -} diff --git a/apm-collector-3.2.3/apm-collector-queue/src/main/java/org/skywalking/apm/collector/queue/disruptor/DisruptorEventHandler.java b/apm-collector-3.2.3/apm-collector-queue/src/main/java/org/skywalking/apm/collector/queue/disruptor/DisruptorEventHandler.java deleted file mode 100644 index 35e286fcad..0000000000 --- a/apm-collector-3.2.3/apm-collector-queue/src/main/java/org/skywalking/apm/collector/queue/disruptor/DisruptorEventHandler.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.queue.disruptor; - -import com.lmax.disruptor.EventHandler; -import com.lmax.disruptor.RingBuffer; -import org.skywalking.apm.collector.core.queue.EndOfBatchCommand; -import org.skywalking.apm.collector.core.queue.MessageHolder; -import org.skywalking.apm.collector.core.queue.QueueEventHandler; -import org.skywalking.apm.collector.core.queue.QueueExecutor; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class DisruptorEventHandler implements EventHandler, QueueEventHandler { - - private final Logger logger = LoggerFactory.getLogger(DisruptorEventHandler.class); - - private RingBuffer ringBuffer; - private QueueExecutor executor; - - DisruptorEventHandler(RingBuffer ringBuffer, QueueExecutor executor) { - this.ringBuffer = ringBuffer; - this.executor = executor; - } - - /** - * Receive the message from disruptor, when message in disruptor is empty, then send the cached data - * to the next workers. - * - * @param event published to the {@link RingBuffer} - * @param sequence of the event being processed - * @param endOfBatch flag to indicate if this is the last event in a batch from the {@link RingBuffer} - */ - public void onEvent(MessageHolder event, long sequence, boolean endOfBatch) { - Object message = event.getMessage(); - event.reset(); - - executor.execute(message); - if (endOfBatch) { - executor.execute(new EndOfBatchCommand()); - } - } - - /** - * Push the message into disruptor ring buffer. - * - * @param message of the data to process. - */ - public void tell(Object message) { - long sequence = ringBuffer.next(); - try { - ringBuffer.get(sequence).setMessage(message); - } finally { - ringBuffer.publish(sequence); - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-queue/src/main/java/org/skywalking/apm/collector/queue/disruptor/DisruptorQueueConfigParser.java b/apm-collector-3.2.3/apm-collector-queue/src/main/java/org/skywalking/apm/collector/queue/disruptor/DisruptorQueueConfigParser.java deleted file mode 100644 index 9a7914bd1a..0000000000 --- a/apm-collector-3.2.3/apm-collector-queue/src/main/java/org/skywalking/apm/collector/queue/disruptor/DisruptorQueueConfigParser.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.queue.disruptor; - -import java.util.Map; -import org.skywalking.apm.collector.core.config.ConfigParseException; -import org.skywalking.apm.collector.core.module.ModuleConfigParser; - -/** - * @author peng-yongsheng - */ -public class DisruptorQueueConfigParser implements ModuleConfigParser { - - @Override public void parse(Map config) throws ConfigParseException { - - } -} diff --git a/apm-collector-3.2.3/apm-collector-queue/src/main/java/org/skywalking/apm/collector/queue/disruptor/DisruptorQueueCreator.java b/apm-collector-3.2.3/apm-collector-queue/src/main/java/org/skywalking/apm/collector/queue/disruptor/DisruptorQueueCreator.java deleted file mode 100644 index 320a22206b..0000000000 --- a/apm-collector-3.2.3/apm-collector-queue/src/main/java/org/skywalking/apm/collector/queue/disruptor/DisruptorQueueCreator.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.queue.disruptor; - -import com.lmax.disruptor.ExceptionHandler; -import com.lmax.disruptor.RingBuffer; -import com.lmax.disruptor.dsl.Disruptor; -import org.skywalking.apm.collector.core.queue.DaemonThreadFactory; -import org.skywalking.apm.collector.core.queue.MessageHolder; -import org.skywalking.apm.collector.core.queue.QueueCreator; -import org.skywalking.apm.collector.core.queue.QueueEventHandler; -import org.skywalking.apm.collector.core.queue.QueueExecutor; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class DisruptorQueueCreator implements QueueCreator { - - private final Logger logger = LoggerFactory.getLogger(DisruptorQueueCreator.class); - - @Override public QueueEventHandler create(int queueSize, QueueExecutor executor) { - // Specify the size of the ring buffer, must be power of 2. - if (!((((queueSize - 1) & queueSize) == 0) && queueSize != 0)) { - throw new IllegalArgumentException("queue size must be power of 2"); - } - - // Construct the Disruptor - Disruptor disruptor = new Disruptor(MessageHolderFactory.INSTANCE, queueSize, DaemonThreadFactory.INSTANCE); - - disruptor.setDefaultExceptionHandler(new ExceptionHandler() { - @Override public void handleEventException(Throwable ex, long sequence, MessageHolder event) { - logger.error("handler message error! message: {}.", event.getMessage(), ex); - } - - @Override public void handleOnStartException(Throwable ex) { - logger.error("create disruptor failed!", ex); - } - - @Override public void handleOnShutdownException(Throwable ex) { - logger.error("shutdown disruptor failed!", ex); - } - }); - - RingBuffer ringBuffer = disruptor.getRingBuffer(); - DisruptorEventHandler eventHandler = new DisruptorEventHandler(ringBuffer, executor); - - // Connect the handler - disruptor.handleEventsWith(eventHandler); - - // Start the Disruptor, starts all threads running - disruptor.start(); - return eventHandler; - } -} diff --git a/apm-collector-3.2.3/apm-collector-queue/src/main/java/org/skywalking/apm/collector/queue/disruptor/MessageHolderFactory.java b/apm-collector-3.2.3/apm-collector-queue/src/main/java/org/skywalking/apm/collector/queue/disruptor/MessageHolderFactory.java deleted file mode 100644 index 1e006c9435..0000000000 --- a/apm-collector-3.2.3/apm-collector-queue/src/main/java/org/skywalking/apm/collector/queue/disruptor/MessageHolderFactory.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.queue.disruptor; - -import com.lmax.disruptor.EventFactory; -import org.skywalking.apm.collector.core.queue.MessageHolder; - -/** - * @author peng-yongsheng - */ -public class MessageHolderFactory implements EventFactory { - - public static MessageHolderFactory INSTANCE = new MessageHolderFactory(); - - public MessageHolder newInstance() { - return new MessageHolder(); - } -} diff --git a/apm-collector-3.2.3/apm-collector-queue/src/main/java/org/skywalking/apm/collector/queue/disruptor/QueueDisruptorModuleDefine.java b/apm-collector-3.2.3/apm-collector-queue/src/main/java/org/skywalking/apm/collector/queue/disruptor/QueueDisruptorModuleDefine.java deleted file mode 100644 index 3f92e56b2b..0000000000 --- a/apm-collector-3.2.3/apm-collector-queue/src/main/java/org/skywalking/apm/collector/queue/disruptor/QueueDisruptorModuleDefine.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.queue.disruptor; - -import org.skywalking.apm.collector.core.framework.CollectorContextHelper; -import org.skywalking.apm.collector.core.module.ModuleConfigParser; -import org.skywalking.apm.collector.queue.QueueModuleContext; -import org.skywalking.apm.collector.queue.QueueModuleDefine; -import org.skywalking.apm.collector.queue.QueueModuleGroupDefine; - -/** - * @author peng-yongsheng - */ -public class QueueDisruptorModuleDefine extends QueueModuleDefine { - - @Override protected String group() { - return QueueModuleGroupDefine.GROUP_NAME; - } - - @Override public String name() { - return "disruptor"; - } - - @Override public boolean defaultModule() { - return true; - } - - @Override protected ModuleConfigParser configParser() { - return new DisruptorQueueConfigParser(); - } - - @Override protected void initializeOtherContext() { - ((QueueModuleContext)CollectorContextHelper.INSTANCE.getContext(group())).setQueueCreator(new DisruptorQueueCreator()); - } -} diff --git a/apm-collector-3.2.3/apm-collector-queue/src/main/resources/META-INF/defines/group.define b/apm-collector-3.2.3/apm-collector-queue/src/main/resources/META-INF/defines/group.define deleted file mode 100644 index 761c2b7e07..0000000000 --- a/apm-collector-3.2.3/apm-collector-queue/src/main/resources/META-INF/defines/group.define +++ /dev/null @@ -1 +0,0 @@ -org.skywalking.apm.collector.queue.QueueModuleGroupDefine \ No newline at end of file diff --git a/apm-collector-3.2.3/apm-collector-queue/src/main/resources/META-INF/defines/module.define b/apm-collector-3.2.3/apm-collector-queue/src/main/resources/META-INF/defines/module.define deleted file mode 100644 index bf98f67428..0000000000 --- a/apm-collector-3.2.3/apm-collector-queue/src/main/resources/META-INF/defines/module.define +++ /dev/null @@ -1,2 +0,0 @@ -org.skywalking.apm.collector.queue.disruptor.QueueDisruptorModuleDefine -org.skywalking.apm.collector.queue.datacarrier.QueueDataCarrierModuleDefine \ No newline at end of file diff --git a/apm-collector-3.2.3/apm-collector-remote/pom.xml b/apm-collector-3.2.3/apm-collector-remote/pom.xml deleted file mode 100644 index 19674c4c8e..0000000000 --- a/apm-collector-3.2.3/apm-collector-remote/pom.xml +++ /dev/null @@ -1,122 +0,0 @@ - - - - - - apm-collector-3.2.3 - org.skywalking - 3.2.4-2017 - - 4.0.0 - - apm-collector-3.2.3-remote - jar - - - UTF-8 - 1.4.0 - 4.1.12.Final - 1.6 - - - - - io.grpc - grpc-netty - ${grpc.version} - - - io.netty - netty-codec-http2 - - - io.netty - netty-handler-proxy - - - - - io.grpc - grpc-protobuf - ${grpc.version} - - - io.grpc - grpc-stub - ${grpc.version} - - - io.netty - netty-codec-http2 - ${netty.version} - - - io.netty - netty-handler-proxy - ${netty.version} - - - - - - - kr.motd.maven - os-maven-plugin - 1.4.1.Final - - - - - org.apache.maven.plugins - maven-resources-plugin - 2.4.3 - - ${project.build.sourceEncoding} - - - - org.xolstice.maven.plugins - protobuf-maven-plugin - 0.5.0 - - - com.google.protobuf:protoc:3.3.0:exe:${os.detected.classifier} - - grpc-java - io.grpc:protoc-gen-grpc-java:1.4.0:exe:${os.detected.classifier} - - - - - - compile - compile-custom - - - - - - - diff --git a/apm-collector-3.2.3/apm-collector-remote/src/main/proto/RemoteCommonService.proto b/apm-collector-3.2.3/apm-collector-remote/src/main/proto/RemoteCommonService.proto deleted file mode 100644 index b2100424fa..0000000000 --- a/apm-collector-3.2.3/apm-collector-remote/src/main/proto/RemoteCommonService.proto +++ /dev/null @@ -1,32 +0,0 @@ -syntax = "proto3"; - -option java_multiple_files = true; -option java_package = "org.skywalking.apm.collector.remote.grpc.proto"; - -service RemoteCommonService { - rpc call (stream RemoteMessage) returns (Empty) { - } -} - -message RemoteMessage { - string workerRole = 1; - RemoteData remoteData = 2; -} - -message RemoteData { - int32 stringCapacity = 1; - int32 longCapacity = 2; - int32 doubleCapacity = 3; - int32 integerCapacity = 4; - int32 byteCapacity = 5; - int32 booleanCapacity = 6; - repeated string dataStrings = 7; - repeated int64 dataLongs = 8; - repeated double dataDoubles = 9; - repeated int32 dataIntegers = 10; - repeated bytes dataBytes = 11; - repeated bool dataBooleans = 12; -} - -message Empty { -} \ No newline at end of file diff --git a/apm-collector-3.2.3/apm-collector-server/pom.xml b/apm-collector-3.2.3/apm-collector-server/pom.xml deleted file mode 100644 index 3ff9138215..0000000000 --- a/apm-collector-3.2.3/apm-collector-server/pom.xml +++ /dev/null @@ -1,59 +0,0 @@ - - - - - - apm-collector-3.2.3 - org.skywalking - 3.2.4-2017 - - 4.0.0 - - apm-collector-3.2.3-server - jar - - - 9.4.2.v20170220 - - - - - org.skywalking - apm-network - ${project.version} - - - org.skywalking - apm-collector-3.2.3-core - ${project.version} - - - org.eclipse.jetty - jetty-server - ${jetty.version} - - - org.eclipse.jetty - jetty-servlet - ${jetty.version} - - - diff --git a/apm-collector-3.2.3/apm-collector-server/src/main/java/org/skywalking/apm/collector/server/grpc/GRPCHandler.java b/apm-collector-3.2.3/apm-collector-server/src/main/java/org/skywalking/apm/collector/server/grpc/GRPCHandler.java deleted file mode 100644 index b4ab728b91..0000000000 --- a/apm-collector-3.2.3/apm-collector-server/src/main/java/org/skywalking/apm/collector/server/grpc/GRPCHandler.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.server.grpc; - -import org.skywalking.apm.collector.core.framework.Handler; - -/** - * @author peng-yongsheng - */ -public interface GRPCHandler extends Handler { -} diff --git a/apm-collector-3.2.3/apm-collector-server/src/main/java/org/skywalking/apm/collector/server/grpc/GRPCServer.java b/apm-collector-3.2.3/apm-collector-server/src/main/java/org/skywalking/apm/collector/server/grpc/GRPCServer.java deleted file mode 100644 index 89dd7d10a5..0000000000 --- a/apm-collector-3.2.3/apm-collector-server/src/main/java/org/skywalking/apm/collector/server/grpc/GRPCServer.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.server.grpc; - -import io.grpc.netty.NettyServerBuilder; -import java.io.IOException; -import java.net.InetSocketAddress; -import org.skywalking.apm.collector.core.framework.Handler; -import org.skywalking.apm.collector.core.server.Server; -import org.skywalking.apm.collector.core.server.ServerException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class GRPCServer implements Server { - - private final Logger logger = LoggerFactory.getLogger(GRPCServer.class); - - private final String host; - private final int port; - private io.grpc.Server server; - private NettyServerBuilder nettyServerBuilder; - - public GRPCServer(String host, int port) { - this.host = host; - this.port = port; - } - - @Override public String hostPort() { - return host + ":" + port; - } - - @Override public String serverClassify() { - return "Google-RPC"; - } - - @Override public void initialize() throws ServerException { - InetSocketAddress address = new InetSocketAddress(host, port); - nettyServerBuilder = NettyServerBuilder.forAddress(address); - logger.info("Server started, host {} listening on {}", host, port); - } - - @Override public void start() throws ServerException { - try { - server = nettyServerBuilder.build(); - server.start(); - } catch (IOException e) { - throw new GRPCServerException(e.getMessage(), e); - } - } - - @Override public void addHandler(Handler handler) { - nettyServerBuilder.addService((io.grpc.BindableService)handler); - } -} diff --git a/apm-collector-3.2.3/apm-collector-server/src/main/java/org/skywalking/apm/collector/server/grpc/GRPCServerException.java b/apm-collector-3.2.3/apm-collector-server/src/main/java/org/skywalking/apm/collector/server/grpc/GRPCServerException.java deleted file mode 100644 index 6824f85387..0000000000 --- a/apm-collector-3.2.3/apm-collector-server/src/main/java/org/skywalking/apm/collector/server/grpc/GRPCServerException.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.server.grpc; - -import org.skywalking.apm.collector.core.server.ServerException; - -/** - * @author peng-yongsheng - */ -public class GRPCServerException extends ServerException { - - public GRPCServerException(String message) { - super(message); - } - - public GRPCServerException(String message, Throwable cause) { - super(message, cause); - } -} diff --git a/apm-collector-3.2.3/apm-collector-server/src/main/java/org/skywalking/apm/collector/server/jetty/ArgumentsParseException.java b/apm-collector-3.2.3/apm-collector-server/src/main/java/org/skywalking/apm/collector/server/jetty/ArgumentsParseException.java deleted file mode 100644 index 9e42d28a7f..0000000000 --- a/apm-collector-3.2.3/apm-collector-server/src/main/java/org/skywalking/apm/collector/server/jetty/ArgumentsParseException.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.server.jetty; - -import org.skywalking.apm.collector.core.CollectorException; - -/** - * @author peng-yongsheng - */ -public class ArgumentsParseException extends CollectorException { - - public ArgumentsParseException(String message) { - super(message); - } - - public ArgumentsParseException(String message, Throwable cause) { - super(message, cause); - } -} diff --git a/apm-collector-3.2.3/apm-collector-server/src/main/java/org/skywalking/apm/collector/server/jetty/JettyHandler.java b/apm-collector-3.2.3/apm-collector-server/src/main/java/org/skywalking/apm/collector/server/jetty/JettyHandler.java deleted file mode 100644 index 1b8c22f48c..0000000000 --- a/apm-collector-3.2.3/apm-collector-server/src/main/java/org/skywalking/apm/collector/server/jetty/JettyHandler.java +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.server.jetty; - -import com.google.gson.JsonElement; -import java.io.IOException; -import java.io.PrintWriter; -import java.util.Enumeration; -import javax.servlet.ServletConfig; -import javax.servlet.ServletContext; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import org.skywalking.apm.collector.core.framework.Handler; -import org.skywalking.apm.collector.core.util.ObjectUtils; - -/** - * @author peng-yongsheng - */ -public abstract class JettyHandler extends HttpServlet implements Handler { - - public abstract String pathSpec(); - - @Override - protected final void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { - try { - reply(resp, doGet(req)); - } catch (ArgumentsParseException e) { - replyError(resp, e.getMessage(), HttpServletResponse.SC_BAD_REQUEST); - } - } - - protected abstract JsonElement doGet(HttpServletRequest req) throws ArgumentsParseException; - - @Override - protected final void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { - try { - reply(resp, doPost(req)); - } catch (ArgumentsParseException e) { - replyError(resp, e.getMessage(), HttpServletResponse.SC_BAD_REQUEST); - } - } - - protected abstract JsonElement doPost(HttpServletRequest req) throws ArgumentsParseException; - - @Override - protected final void doHead(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { - super.doHead(req, resp); - } - - @Override protected final long getLastModified(HttpServletRequest req) { - return super.getLastModified(req); - } - - @Override - protected final void doPut(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { - super.doPut(req, resp); - } - - @Override - protected final void doDelete(HttpServletRequest req, - HttpServletResponse resp) throws ServletException, IOException { - super.doDelete(req, resp); - } - - @Override - protected final void doOptions(HttpServletRequest req, - HttpServletResponse resp) throws ServletException, IOException { - super.doOptions(req, resp); - } - - @Override - protected final void doTrace(HttpServletRequest req, - HttpServletResponse resp) throws ServletException, IOException { - super.doTrace(req, resp); - } - - @Override - protected final void service(HttpServletRequest req, - HttpServletResponse resp) throws ServletException, IOException { - super.service(req, resp); - } - - @Override public final void service(ServletRequest req, ServletResponse res) throws ServletException, IOException { - super.service(req, res); - } - - @Override public final void destroy() { - super.destroy(); - } - - @Override public final String getInitParameter(String name) { - return super.getInitParameter(name); - } - - @Override public final Enumeration getInitParameterNames() { - return super.getInitParameterNames(); - } - - @Override public final ServletConfig getServletConfig() { - return super.getServletConfig(); - } - - @Override public final ServletContext getServletContext() { - return super.getServletContext(); - } - - @Override public final String getServletInfo() { - return super.getServletInfo(); - } - - @Override public final void init(ServletConfig config) throws ServletException { - super.init(config); - } - - @Override public final void init() throws ServletException { - super.init(); - } - - @Override public final void log(String msg) { - super.log(msg); - } - - @Override public final void log(String message, Throwable t) { - super.log(message, t); - } - - @Override public final String getServletName() { - return super.getServletName(); - } - - private void reply(HttpServletResponse response, JsonElement resJson) throws IOException { - response.setContentType("text/json"); - response.setCharacterEncoding("utf-8"); - response.setStatus(HttpServletResponse.SC_OK); - - PrintWriter out = response.getWriter(); - if (ObjectUtils.isNotEmpty(resJson)) { - out.print(resJson); - } - out.flush(); - out.close(); - } - - private void replyError(HttpServletResponse response, String errorMessage, int status) throws IOException { - response.setContentType("text/plain"); - response.setCharacterEncoding("utf-8"); - response.setStatus(status); - response.setHeader("error-message", errorMessage); - - PrintWriter out = response.getWriter(); - out.flush(); - out.close(); - } -} \ No newline at end of file diff --git a/apm-collector-3.2.3/apm-collector-server/src/main/java/org/skywalking/apm/collector/server/jetty/JettyServer.java b/apm-collector-3.2.3/apm-collector-server/src/main/java/org/skywalking/apm/collector/server/jetty/JettyServer.java deleted file mode 100644 index 95d9c5db98..0000000000 --- a/apm-collector-3.2.3/apm-collector-server/src/main/java/org/skywalking/apm/collector/server/jetty/JettyServer.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.server.jetty; - -import java.net.InetSocketAddress; -import javax.servlet.http.HttpServlet; -import org.eclipse.jetty.servlet.ServletContextHandler; -import org.eclipse.jetty.servlet.ServletHolder; -import org.skywalking.apm.collector.core.framework.Handler; -import org.skywalking.apm.collector.core.server.Server; -import org.skywalking.apm.collector.core.server.ServerException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class JettyServer implements Server { - - private final Logger logger = LoggerFactory.getLogger(JettyServer.class); - - private final String host; - private final int port; - private final String contextPath; - private org.eclipse.jetty.server.Server server; - private ServletContextHandler servletContextHandler; - - public JettyServer(String host, int port, String contextPath) { - this.host = host; - this.port = port; - this.contextPath = contextPath; - } - - @Override public String hostPort() { - return host + ":" + port; - } - - @Override public String serverClassify() { - return "Jetty"; - } - - @Override public void initialize() throws ServerException { - server = new org.eclipse.jetty.server.Server(new InetSocketAddress(host, port)); - - servletContextHandler = new ServletContextHandler(ServletContextHandler.NO_SESSIONS); - servletContextHandler.setContextPath(contextPath); - logger.info("http server root context path: {}", contextPath); - - server.setHandler(servletContextHandler); - } - - @Override public void addHandler(Handler handler) { - ServletHolder servletHolder = new ServletHolder(); - servletHolder.setServlet((HttpServlet)handler); - servletContextHandler.addServlet(servletHolder, ((JettyHandler)handler).pathSpec()); - } - - @Override public void start() throws ServerException { - try { - server.start(); - } catch (Exception e) { - throw new JettyServerException(e.getMessage(), e); - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-server/src/main/java/org/skywalking/apm/collector/server/jetty/JettyServerException.java b/apm-collector-3.2.3/apm-collector-server/src/main/java/org/skywalking/apm/collector/server/jetty/JettyServerException.java deleted file mode 100644 index 538a4bcf80..0000000000 --- a/apm-collector-3.2.3/apm-collector-server/src/main/java/org/skywalking/apm/collector/server/jetty/JettyServerException.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.server.jetty; - -import org.skywalking.apm.collector.core.server.ServerException; - -/** - * @author peng-yongsheng - */ -public class JettyServerException extends ServerException { - - public JettyServerException(String message) { - super(message); - } - - public JettyServerException(String message, Throwable cause) { - super(message, cause); - } -} diff --git a/apm-collector-3.2.3/apm-collector-storage/pom.xml b/apm-collector-3.2.3/apm-collector-storage/pom.xml deleted file mode 100644 index 87c09011a6..0000000000 --- a/apm-collector-3.2.3/apm-collector-storage/pom.xml +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - apm-collector-3.2.3 - org.skywalking - 3.2.4-2017 - - 4.0.0 - - apm-collector-storage - jar - - - - org.skywalking - apm-collector-3.2.3-core - ${project.version} - - - org.skywalking - apm-collector-3.2.3-cluster - ${project.version} - - - org.skywalking - apm-collector-3.2.3-remote - ${project.version} - - - diff --git a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/StorageModuleContext.java b/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/StorageModuleContext.java deleted file mode 100644 index 7a73bbd495..0000000000 --- a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/StorageModuleContext.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.storage; - -import org.skywalking.apm.collector.core.client.Client; -import org.skywalking.apm.collector.core.framework.Context; - -/** - * @author peng-yongsheng - */ -public class StorageModuleContext extends Context { - - private Client client; - - public StorageModuleContext(String groupName) { - super(groupName); - } - - public Client getClient() { - return client; - } - - public void setClient(Client client) { - this.client = client; - } -} diff --git a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/StorageModuleDefine.java b/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/StorageModuleDefine.java deleted file mode 100644 index 49685f8cee..0000000000 --- a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/StorageModuleDefine.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.storage; - -import java.util.List; -import org.skywalking.apm.collector.core.client.Client; -import org.skywalking.apm.collector.core.client.ClientException; -import org.skywalking.apm.collector.core.cluster.ClusterDataListener; -import org.skywalking.apm.collector.core.cluster.ClusterDataListenerDefine; -import org.skywalking.apm.collector.core.framework.CollectorContextHelper; -import org.skywalking.apm.collector.core.framework.DefineException; -import org.skywalking.apm.collector.core.framework.Handler; -import org.skywalking.apm.collector.core.framework.UnexpectedException; -import org.skywalking.apm.collector.core.module.ModuleDefine; -import org.skywalking.apm.collector.core.module.ModuleRegistration; -import org.skywalking.apm.collector.core.server.Server; -import org.skywalking.apm.collector.core.storage.StorageException; -import org.skywalking.apm.collector.core.storage.StorageInstaller; - -/** - * @author peng-yongsheng - */ -public abstract class StorageModuleDefine extends ModuleDefine implements ClusterDataListenerDefine { - - @Override protected void initializeOtherContext() { - try { - StorageModuleContext context = (StorageModuleContext)CollectorContextHelper.INSTANCE.getContext(StorageModuleGroupDefine.GROUP_NAME); - Client client = createClient(); - client.initialize(); - context.setClient(client); - injectClientIntoDAO(client); - - storageInstaller().install(client); - } catch (ClientException | StorageException | DefineException e) { - throw new UnexpectedException(e.getMessage()); - } - } - - @Override public final List handlerList() { - return null; - } - - @Override protected final Server server() { - return null; - } - - @Override protected final ModuleRegistration registration() { - return null; - } - - @Override public final ClusterDataListener listener() { - return null; - } - - public abstract StorageInstaller storageInstaller(); - - public abstract void injectClientIntoDAO(Client client) throws DefineException; -} diff --git a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/StorageModuleException.java b/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/StorageModuleException.java deleted file mode 100644 index de954ffe00..0000000000 --- a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/StorageModuleException.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.storage; - -import org.skywalking.apm.collector.core.module.ModuleException; - -/** - * @author peng-yongsheng - */ -public class StorageModuleException extends ModuleException { - public StorageModuleException(String message) { - super(message); - } - - public StorageModuleException(String message, Throwable cause) { - super(message, cause); - } -} diff --git a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/StorageModuleGroupDefine.java b/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/StorageModuleGroupDefine.java deleted file mode 100644 index 627c96cfe9..0000000000 --- a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/StorageModuleGroupDefine.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.storage; - -import org.skywalking.apm.collector.core.config.GroupConfigParser; -import org.skywalking.apm.collector.core.framework.Context; -import org.skywalking.apm.collector.core.module.ModuleGroupDefine; -import org.skywalking.apm.collector.core.module.ModuleInstaller; - -/** - * @author peng-yongsheng - */ -public class StorageModuleGroupDefine implements ModuleGroupDefine { - - public static final String GROUP_NAME = "storage"; - private final StorageModuleInstaller installer; - - public StorageModuleGroupDefine() { - installer = new StorageModuleInstaller(); - } - - @Override public String name() { - return GROUP_NAME; - } - - @Override public Context groupContext() { - return new StorageModuleContext(GROUP_NAME); - } - - @Override public ModuleInstaller moduleInstaller() { - return installer; - } - - @Override public GroupConfigParser groupConfigParser() { - return null; - } -} diff --git a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/StorageModuleInstaller.java b/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/StorageModuleInstaller.java deleted file mode 100644 index e74e68871b..0000000000 --- a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/StorageModuleInstaller.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.storage; - -import java.util.List; -import org.skywalking.apm.collector.core.CollectorException; -import org.skywalking.apm.collector.core.framework.Context; -import org.skywalking.apm.collector.core.module.SingleModuleInstaller; - -/** - * @author peng-yongsheng - */ -public class StorageModuleInstaller extends SingleModuleInstaller { - - @Override public String groupName() { - return StorageModuleGroupDefine.GROUP_NAME; - } - - @Override public Context moduleContext() { - return new StorageModuleContext(groupName()); - } - - @Override public List dependenceModules() { - return null; - } - - @Override public void onAfterInstall() throws CollectorException { - - } -} diff --git a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/dao/DAO.java b/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/dao/DAO.java deleted file mode 100644 index 35c1af85f0..0000000000 --- a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/dao/DAO.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.storage.base.dao; - -import org.skywalking.apm.collector.core.client.Client; - -/** - * @author peng-yongsheng - */ -public abstract class DAO { - private C client; - - public final C getClient() { - return client; - } - - public final void setClient(C client) { - this.client = client; - } -} diff --git a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/dao/DAOContainer.java b/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/dao/DAOContainer.java deleted file mode 100644 index dcab9495f2..0000000000 --- a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/dao/DAOContainer.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.storage.base.dao; - -import java.util.HashMap; -import java.util.Map; - -/** - * @author peng-yongsheng - */ -public enum DAOContainer { - INSTANCE; - - private Map daos = new HashMap<>(); - - public void put(String interfaceName, DAO dao) { - daos.put(interfaceName, dao); - } - - public DAO get(String interfaceName) { - return daos.get(interfaceName); - } -} diff --git a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/dao/IBatchDAO.java b/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/dao/IBatchDAO.java deleted file mode 100644 index 10c92b195e..0000000000 --- a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/dao/IBatchDAO.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.storage.base.dao; - -import java.util.List; - -/** - * @author peng-yongsheng - */ -public interface IBatchDAO { - void batchPersistence(List batchCollection); -} diff --git a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/Attribute.java b/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/Attribute.java deleted file mode 100644 index 8cdb40f85e..0000000000 --- a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/Attribute.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.storage.base.define; - -import org.skywalking.apm.collector.core.stream.Operation; - -/** - * @author peng-yongsheng - */ -public class Attribute { - private final String name; - private final AttributeType type; - private final Operation operation; - - public Attribute(String name, AttributeType type, Operation operation) { - this.name = name; - this.type = type; - this.operation = operation; - } - - public String getName() { - return name; - } - - public AttributeType getType() { - return type; - } - - public Operation getOperation() { - return operation; - } -} diff --git a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/AttributeType.java b/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/AttributeType.java deleted file mode 100644 index 0384583a57..0000000000 --- a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/AttributeType.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.storage.base.define; - -/** - * @author peng-yongsheng - */ -public enum AttributeType { - STRING, LONG, DOUBLE, INTEGER, BYTE, BOOLEAN -} diff --git a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/CommonTable.java b/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/CommonTable.java deleted file mode 100644 index db87cbc22e..0000000000 --- a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/CommonTable.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.storage.base.define; - -/** - * @author peng-yongsheng - */ -public class CommonTable { - public static final String TABLE_TYPE = "type"; - public static final String COLUMN_ID = "id"; - public static final String COLUMN_AGG = "agg"; - public static final String COLUMN_TIME_BUCKET = "time_bucket"; -} diff --git a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/DataDefine.java b/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/DataDefine.java deleted file mode 100644 index 5c12c95498..0000000000 --- a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/DataDefine.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.storage.base.define; - -import org.skywalking.apm.collector.core.stream.Data; -import org.skywalking.apm.collector.remote.grpc.proto.RemoteData; - -/** - * @author peng-yongsheng - */ -public abstract class DataDefine { - private Attribute[] attributes; - private int stringCapacity; - private int longCapacity; - private int doubleCapacity; - private int integerCapacity; - private int booleanCapacity; - private int byteCapacity; - - public DataDefine() { - initial(); - } - - private void initial() { - attributes = new Attribute[initialCapacity()]; - attributeDefine(); - for (Attribute attribute : attributes) { - if (AttributeType.STRING.equals(attribute.getType())) { - stringCapacity++; - } else if (AttributeType.LONG.equals(attribute.getType())) { - longCapacity++; - } else if (AttributeType.DOUBLE.equals(attribute.getType())) { - doubleCapacity++; - } else if (AttributeType.INTEGER.equals(attribute.getType())) { - integerCapacity++; - } else if (AttributeType.BOOLEAN.equals(attribute.getType())) { - booleanCapacity++; - } else if (AttributeType.BYTE.equals(attribute.getType())) { - byteCapacity++; - } - } - } - - public final void addAttribute(int position, Attribute attribute) { - attributes[position] = attribute; - } - - protected abstract int initialCapacity(); - - protected abstract void attributeDefine(); - - public final Data build(String id) { - return new Data(id, stringCapacity, longCapacity, doubleCapacity, integerCapacity, booleanCapacity, byteCapacity); - } - - public void mergeData(Data newData, Data oldData) { - int stringPosition = 0; - int longPosition = 0; - int doublePosition = 0; - int integerPosition = 0; - int booleanPosition = 0; - int bytePosition = 0; - for (int i = 0; i < initialCapacity(); i++) { - Attribute attribute = attributes[i]; - if (AttributeType.STRING.equals(attribute.getType())) { - String stringData = attribute.getOperation().operate(newData.getDataString(stringPosition), oldData.getDataString(stringPosition)); - newData.setDataString(stringPosition, stringData); - stringPosition++; - } else if (AttributeType.LONG.equals(attribute.getType())) { - Long longData = attribute.getOperation().operate(newData.getDataLong(longPosition), oldData.getDataLong(longPosition)); - newData.setDataLong(longPosition, longData); - longPosition++; - } else if (AttributeType.DOUBLE.equals(attribute.getType())) { - Double doubleData = attribute.getOperation().operate(newData.getDataDouble(doublePosition), oldData.getDataDouble(doublePosition)); - newData.setDataDouble(doublePosition, doubleData); - doublePosition++; - } else if (AttributeType.INTEGER.equals(attribute.getType())) { - Integer integerData = attribute.getOperation().operate(newData.getDataInteger(integerPosition), oldData.getDataInteger(integerPosition)); - newData.setDataInteger(integerPosition, integerData); - integerPosition++; - } else if (AttributeType.BOOLEAN.equals(attribute.getType())) { - Boolean booleanData = attribute.getOperation().operate(newData.getDataBoolean(booleanPosition), oldData.getDataBoolean(booleanPosition)); - newData.setDataBoolean(booleanPosition, booleanData); - booleanPosition++; - } else if (AttributeType.BYTE.equals(attribute.getType())) { - byte[] byteData = attribute.getOperation().operate(newData.getDataBytes(bytePosition), oldData.getDataBytes(integerPosition)); - newData.setDataBytes(bytePosition, byteData); - bytePosition++; - } - } - } - - public abstract Object deserialize(RemoteData remoteData); - - public abstract RemoteData serialize(Object object); -} diff --git a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/global/GlobalTraceDataDefine.java b/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/global/GlobalTraceDataDefine.java deleted file mode 100644 index 6ed893d242..0000000000 --- a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/global/GlobalTraceDataDefine.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.storage.base.define.global; - -import org.skywalking.apm.collector.core.stream.Data; -import org.skywalking.apm.collector.core.stream.Transform; -import org.skywalking.apm.collector.core.stream.operate.CoverOperation; -import org.skywalking.apm.collector.core.stream.operate.NonOperation; -import org.skywalking.apm.collector.remote.grpc.proto.RemoteData; -import org.skywalking.apm.collector.storage.base.define.Attribute; -import org.skywalking.apm.collector.storage.base.define.AttributeType; -import org.skywalking.apm.collector.storage.base.define.DataDefine; - -/** - * @author peng-yongsheng - */ -public class GlobalTraceDataDefine extends DataDefine { - - @Override protected int initialCapacity() { - return 4; - } - - @Override protected void attributeDefine() { - addAttribute(0, new Attribute(GlobalTraceTable.COLUMN_ID, AttributeType.STRING, new NonOperation())); - addAttribute(1, new Attribute(GlobalTraceTable.COLUMN_SEGMENT_ID, AttributeType.STRING, new CoverOperation())); - addAttribute(2, new Attribute(GlobalTraceTable.COLUMN_GLOBAL_TRACE_ID, AttributeType.STRING, new CoverOperation())); - addAttribute(3, new Attribute(GlobalTraceTable.COLUMN_TIME_BUCKET, AttributeType.LONG, new CoverOperation())); - } - - @Override public Object deserialize(RemoteData remoteData) { - return null; - } - - @Override public RemoteData serialize(Object object) { - return null; - } - - public static class GlobalTrace implements Transform { - private String id; - private String segmentId; - private String globalTraceId; - private long timeBucket; - - public GlobalTrace() { - } - - @Override public Data toData() { - GlobalTraceDataDefine define = new GlobalTraceDataDefine(); - Data data = define.build(id); - data.setDataString(0, this.id); - data.setDataString(1, this.segmentId); - data.setDataString(2, this.globalTraceId); - data.setDataLong(0, this.timeBucket); - return data; - } - - @Override public Object toSelf(Data data) { - return null; - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getSegmentId() { - return segmentId; - } - - public void setSegmentId(String segmentId) { - this.segmentId = segmentId; - } - - public String getGlobalTraceId() { - return globalTraceId; - } - - public void setGlobalTraceId(String globalTraceId) { - this.globalTraceId = globalTraceId; - } - - public long getTimeBucket() { - return timeBucket; - } - - public void setTimeBucket(long timeBucket) { - this.timeBucket = timeBucket; - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/global/GlobalTraceTable.java b/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/global/GlobalTraceTable.java deleted file mode 100644 index a2e75c0dc2..0000000000 --- a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/global/GlobalTraceTable.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.storage.base.define.global; - -import org.skywalking.apm.collector.storage.base.define.CommonTable; - -/** - * @author peng-yongsheng - */ -public class GlobalTraceTable extends CommonTable { - public static final String TABLE = "global_trace"; - public static final String COLUMN_SEGMENT_ID = "segment_id"; - public static final String COLUMN_GLOBAL_TRACE_ID = "global_trace_id"; -} diff --git a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/instance/InstPerformanceDataDefine.java b/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/instance/InstPerformanceDataDefine.java deleted file mode 100644 index 23c9237859..0000000000 --- a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/instance/InstPerformanceDataDefine.java +++ /dev/null @@ -1,152 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.storage.base.define.instance; - -import org.skywalking.apm.collector.core.stream.Data; -import org.skywalking.apm.collector.core.stream.Transform; -import org.skywalking.apm.collector.core.stream.operate.AddOperation; -import org.skywalking.apm.collector.core.stream.operate.CoverOperation; -import org.skywalking.apm.collector.core.stream.operate.NonOperation; -import org.skywalking.apm.collector.remote.grpc.proto.RemoteData; -import org.skywalking.apm.collector.storage.base.define.Attribute; -import org.skywalking.apm.collector.storage.base.define.AttributeType; -import org.skywalking.apm.collector.storage.base.define.DataDefine; - -/** - * @author peng-yongsheng - */ -public class InstPerformanceDataDefine extends DataDefine { - - @Override protected int initialCapacity() { - return 6; - } - - @Override protected void attributeDefine() { - addAttribute(0, new Attribute(InstPerformanceTable.COLUMN_ID, AttributeType.STRING, new NonOperation())); - addAttribute(1, new Attribute(InstPerformanceTable.COLUMN_APPLICATION_ID, AttributeType.INTEGER, new CoverOperation())); - addAttribute(2, new Attribute(InstPerformanceTable.COLUMN_INSTANCE_ID, AttributeType.INTEGER, new CoverOperation())); - addAttribute(3, new Attribute(InstPerformanceTable.COLUMN_CALLS, AttributeType.INTEGER, new AddOperation())); - addAttribute(4, new Attribute(InstPerformanceTable.COLUMN_COST_TOTAL, AttributeType.LONG, new AddOperation())); - addAttribute(5, new Attribute(InstPerformanceTable.COLUMN_TIME_BUCKET, AttributeType.LONG, new CoverOperation())); - } - - @Override public Object deserialize(RemoteData remoteData) { - Data data = build(remoteData.getDataStrings(0)); - data.setDataInteger(0, remoteData.getDataIntegers(0)); - data.setDataInteger(1, remoteData.getDataIntegers(1)); - data.setDataInteger(2, remoteData.getDataIntegers(2)); - data.setDataLong(0, remoteData.getDataLongs(0)); - data.setDataLong(1, remoteData.getDataLongs(1)); - return data; - } - - @Override public RemoteData serialize(Object object) { - Data data = (Data)object; - RemoteData.Builder builder = RemoteData.newBuilder(); - builder.addDataStrings(data.getDataString(0)); - builder.addDataIntegers(data.getDataInteger(0)); - builder.addDataIntegers(data.getDataInteger(1)); - builder.addDataIntegers(data.getDataInteger(2)); - builder.addDataLongs(data.getDataLong(0)); - builder.addDataLongs(data.getDataLong(1)); - return builder.build(); - } - - public static class InstPerformance implements Transform { - private String id; - private int applicationId; - private int instanceId; - private int calls; - private long costTotal; - private long timeBucket; - - public InstPerformance() { - } - - @Override public Data toData() { - InstPerformanceDataDefine define = new InstPerformanceDataDefine(); - Data data = define.build(id); - data.setDataString(0, this.id); - data.setDataInteger(0, this.applicationId); - data.setDataInteger(1, this.instanceId); - data.setDataInteger(2, this.calls); - data.setDataLong(0, this.costTotal); - data.setDataLong(1, this.timeBucket); - return data; - } - - @Override public InstPerformance toSelf(Data data) { - this.id = data.getDataString(0); - this.applicationId = data.getDataInteger(0); - this.instanceId = data.getDataInteger(1); - this.calls = data.getDataInteger(2); - this.costTotal = data.getDataLong(0); - this.timeBucket = data.getDataLong(1); - return this; - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public int getInstanceId() { - return instanceId; - } - - public void setInstanceId(int instanceId) { - this.instanceId = instanceId; - } - - public int getCalls() { - return calls; - } - - public void setCalls(int calls) { - this.calls = calls; - } - - public long getCostTotal() { - return costTotal; - } - - public void setCostTotal(long costTotal) { - this.costTotal = costTotal; - } - - public long getTimeBucket() { - return timeBucket; - } - - public void setTimeBucket(long timeBucket) { - this.timeBucket = timeBucket; - } - - public int getApplicationId() { - return applicationId; - } - - public void setApplicationId(int applicationId) { - this.applicationId = applicationId; - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/instance/InstPerformanceTable.java b/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/instance/InstPerformanceTable.java deleted file mode 100644 index a8eb50da63..0000000000 --- a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/instance/InstPerformanceTable.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.storage.base.define.instance; - -import org.skywalking.apm.collector.storage.base.define.CommonTable; - -/** - * @author peng-yongsheng - */ -public class InstPerformanceTable extends CommonTable { - public static final String TABLE = "instance_performance"; - public static final String COLUMN_APPLICATION_ID = "application_id"; - public static final String COLUMN_INSTANCE_ID = "instance_id"; - public static final String COLUMN_CALLS = "calls"; - public static final String COLUMN_COST_TOTAL = "cost_total"; -} diff --git a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/jvm/CpuMetricDataDefine.java b/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/jvm/CpuMetricDataDefine.java deleted file mode 100644 index 5fd430c5df..0000000000 --- a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/jvm/CpuMetricDataDefine.java +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.storage.base.define.jvm; - -import org.skywalking.apm.collector.core.framework.UnexpectedException; -import org.skywalking.apm.collector.core.stream.Data; -import org.skywalking.apm.collector.core.stream.Transform; -import org.skywalking.apm.collector.core.stream.operate.AddOperation; -import org.skywalking.apm.collector.core.stream.operate.CoverOperation; -import org.skywalking.apm.collector.core.stream.operate.NonOperation; -import org.skywalking.apm.collector.remote.grpc.proto.RemoteData; -import org.skywalking.apm.collector.storage.base.define.Attribute; -import org.skywalking.apm.collector.storage.base.define.AttributeType; -import org.skywalking.apm.collector.storage.base.define.DataDefine; - -/** - * @author peng-yongsheng - */ -public class CpuMetricDataDefine extends DataDefine { - - @Override protected int initialCapacity() { - return 4; - } - - @Override protected void attributeDefine() { - addAttribute(0, new Attribute(CpuMetricTable.COLUMN_ID, AttributeType.STRING, new NonOperation())); - addAttribute(1, new Attribute(CpuMetricTable.COLUMN_INSTANCE_ID, AttributeType.INTEGER, new CoverOperation())); - addAttribute(2, new Attribute(CpuMetricTable.COLUMN_USAGE_PERCENT, AttributeType.DOUBLE, new AddOperation())); - addAttribute(3, new Attribute(CpuMetricTable.COLUMN_TIME_BUCKET, AttributeType.LONG, new CoverOperation())); - } - - @Override public Object deserialize(RemoteData remoteData) { - throw new UnexpectedException("cpu metric data did not need send to remote worker."); - } - - @Override public RemoteData serialize(Object object) { - throw new UnexpectedException("cpu metric data did not need send to remote worker."); - } - - public static class CpuMetric implements Transform { - private String id; - private int instanceId; - private double usagePercent; - private long timeBucket; - - public CpuMetric(String id, int instanceId, double usagePercent, long timeBucket) { - this.id = id; - this.instanceId = instanceId; - this.usagePercent = usagePercent; - this.timeBucket = timeBucket; - } - - public CpuMetric() { - } - - @Override public Data toData() { - CpuMetricDataDefine define = new CpuMetricDataDefine(); - Data data = define.build(id); - data.setDataString(0, this.id); - data.setDataInteger(0, this.instanceId); - data.setDataDouble(0, this.usagePercent); - data.setDataLong(0, this.timeBucket); - return data; - } - - @Override public CpuMetric toSelf(Data data) { - this.id = data.getDataString(0); - this.instanceId = data.getDataInteger(0); - this.usagePercent = data.getDataDouble(0); - this.timeBucket = data.getDataLong(0); - return this; - } - - public void setId(String id) { - this.id = id; - } - - public void setInstanceId(int instanceId) { - this.instanceId = instanceId; - } - - public void setUsagePercent(double usagePercent) { - this.usagePercent = usagePercent; - } - - public void setTimeBucket(long timeBucket) { - this.timeBucket = timeBucket; - } - - public String getId() { - return id; - } - - public int getInstanceId() { - return instanceId; - } - - public double getUsagePercent() { - return usagePercent; - } - - public long getTimeBucket() { - return timeBucket; - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/jvm/CpuMetricTable.java b/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/jvm/CpuMetricTable.java deleted file mode 100644 index ffd357bac1..0000000000 --- a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/jvm/CpuMetricTable.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.storage.base.define.jvm; - -import org.skywalking.apm.collector.storage.base.define.CommonTable; - -/** - * @author peng-yongsheng - */ -public class CpuMetricTable extends CommonTable { - public static final String TABLE = "cpu_metric"; - public static final String COLUMN_INSTANCE_ID = "instance_id"; - public static final String COLUMN_USAGE_PERCENT = "usage_percent"; -} diff --git a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/jvm/GCMetricDataDefine.java b/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/jvm/GCMetricDataDefine.java deleted file mode 100644 index fc40e2a271..0000000000 --- a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/jvm/GCMetricDataDefine.java +++ /dev/null @@ -1,147 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.storage.base.define.jvm; - -import org.skywalking.apm.collector.core.framework.UnexpectedException; -import org.skywalking.apm.collector.core.stream.Data; -import org.skywalking.apm.collector.core.stream.Transform; -import org.skywalking.apm.collector.core.stream.operate.CoverOperation; -import org.skywalking.apm.collector.core.stream.operate.NonOperation; -import org.skywalking.apm.collector.remote.grpc.proto.RemoteData; -import org.skywalking.apm.collector.storage.base.define.Attribute; -import org.skywalking.apm.collector.storage.base.define.AttributeType; -import org.skywalking.apm.collector.storage.base.define.DataDefine; - -/** - * @author peng-yongsheng - */ -public class GCMetricDataDefine extends DataDefine { - - @Override protected int initialCapacity() { - return 6; - } - - @Override protected void attributeDefine() { - addAttribute(0, new Attribute(GCMetricTable.COLUMN_ID, AttributeType.STRING, new NonOperation())); - addAttribute(1, new Attribute(GCMetricTable.COLUMN_INSTANCE_ID, AttributeType.INTEGER, new CoverOperation())); - addAttribute(2, new Attribute(GCMetricTable.COLUMN_PHRASE, AttributeType.INTEGER, new CoverOperation())); - addAttribute(3, new Attribute(GCMetricTable.COLUMN_COUNT, AttributeType.LONG, new CoverOperation())); - addAttribute(4, new Attribute(GCMetricTable.COLUMN_TIME, AttributeType.LONG, new CoverOperation())); - addAttribute(5, new Attribute(GCMetricTable.COLUMN_TIME_BUCKET, AttributeType.LONG, new CoverOperation())); - } - - @Override public Object deserialize(RemoteData remoteData) { - throw new UnexpectedException("gc metric data did not need send to remote worker."); - } - - @Override public RemoteData serialize(Object object) { - throw new UnexpectedException("gc metric data did not need send to remote worker."); - } - - public static class GCMetric implements Transform { - private String id; - private int instanceId; - private int phrase; - private long count; - private long time; - private long timeBucket; - - public GCMetric(String id, int instanceId, int phrase, long count, long time, long timeBucket) { - this.id = id; - this.instanceId = instanceId; - this.phrase = phrase; - this.count = count; - this.time = time; - this.timeBucket = timeBucket; - } - - public GCMetric() { - } - - @Override public Data toData() { - GCMetricDataDefine define = new GCMetricDataDefine(); - Data data = define.build(id); - data.setDataString(0, this.id); - data.setDataInteger(0, this.instanceId); - data.setDataInteger(1, this.phrase); - data.setDataLong(0, this.count); - data.setDataLong(1, this.time); - data.setDataLong(2, this.timeBucket); - return data; - } - - @Override public GCMetric toSelf(Data data) { - this.id = data.getDataString(0); - this.instanceId = data.getDataInteger(0); - this.phrase = data.getDataInteger(1); - this.count = data.getDataLong(0); - this.time = data.getDataLong(1); - this.timeBucket = data.getDataLong(2); - return this; - } - - public void setId(String id) { - this.id = id; - } - - public void setInstanceId(int instanceId) { - this.instanceId = instanceId; - } - - public void setTimeBucket(long timeBucket) { - this.timeBucket = timeBucket; - } - - public String getId() { - return id; - } - - public int getInstanceId() { - return instanceId; - } - - public long getTimeBucket() { - return timeBucket; - } - - public int getPhrase() { - return phrase; - } - - public long getCount() { - return count; - } - - public long getTime() { - return time; - } - - public void setPhrase(int phrase) { - this.phrase = phrase; - } - - public void setCount(long count) { - this.count = count; - } - - public void setTime(long time) { - this.time = time; - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/jvm/GCMetricTable.java b/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/jvm/GCMetricTable.java deleted file mode 100644 index f71618166a..0000000000 --- a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/jvm/GCMetricTable.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.storage.base.define.jvm; - -import org.skywalking.apm.collector.storage.base.define.CommonTable; - -/** - * @author peng-yongsheng - */ -public class GCMetricTable extends CommonTable { - public static final String TABLE = "gc_metric"; - public static final String COLUMN_INSTANCE_ID = "instance_id"; - public static final String COLUMN_PHRASE = "phrase"; - public static final String COLUMN_COUNT = "count"; - public static final String COLUMN_TIME = "time"; -} diff --git a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/jvm/MemoryMetricDataDefine.java b/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/jvm/MemoryMetricDataDefine.java deleted file mode 100644 index e38bbe8613..0000000000 --- a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/jvm/MemoryMetricDataDefine.java +++ /dev/null @@ -1,154 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.storage.base.define.jvm; - -import org.skywalking.apm.collector.core.framework.UnexpectedException; -import org.skywalking.apm.collector.core.stream.Data; -import org.skywalking.apm.collector.core.stream.Transform; -import org.skywalking.apm.collector.core.stream.operate.CoverOperation; -import org.skywalking.apm.collector.core.stream.operate.NonOperation; -import org.skywalking.apm.collector.remote.grpc.proto.RemoteData; -import org.skywalking.apm.collector.storage.base.define.Attribute; -import org.skywalking.apm.collector.storage.base.define.AttributeType; -import org.skywalking.apm.collector.storage.base.define.DataDefine; - -/** - * @author peng-yongsheng - */ -public class MemoryMetricDataDefine extends DataDefine { - - @Override protected int initialCapacity() { - return 8; - } - - @Override protected void attributeDefine() { - addAttribute(0, new Attribute(MemoryMetricTable.COLUMN_ID, AttributeType.STRING, new NonOperation())); - addAttribute(1, new Attribute(MemoryMetricTable.COLUMN_APPLICATION_INSTANCE_ID, AttributeType.INTEGER, new CoverOperation())); - addAttribute(2, new Attribute(MemoryMetricTable.COLUMN_IS_HEAP, AttributeType.BOOLEAN, new CoverOperation())); - addAttribute(3, new Attribute(MemoryMetricTable.COLUMN_INIT, AttributeType.LONG, new CoverOperation())); - addAttribute(4, new Attribute(MemoryMetricTable.COLUMN_MAX, AttributeType.LONG, new CoverOperation())); - addAttribute(5, new Attribute(MemoryMetricTable.COLUMN_USED, AttributeType.LONG, new CoverOperation())); - addAttribute(6, new Attribute(MemoryMetricTable.COLUMN_COMMITTED, AttributeType.LONG, new CoverOperation())); - addAttribute(7, new Attribute(MemoryMetricTable.COLUMN_TIME_BUCKET, AttributeType.LONG, new CoverOperation())); - } - - @Override public Object deserialize(RemoteData remoteData) { - throw new UnexpectedException("memory metric data did not need send to remote worker."); - } - - @Override public RemoteData serialize(Object object) { - throw new UnexpectedException("memory metric data did not need send to remote worker."); - } - - public static class MemoryMetric implements Transform { - private String id; - private int applicationInstanceId; - private boolean isHeap; - private long init; - private long max; - private long used; - private long committed; - private long timeBucket; - - public MemoryMetric(String id, int applicationInstanceId, boolean isHeap, long init, long max, long used, - long committed, long timeBucket) { - this.id = id; - this.applicationInstanceId = applicationInstanceId; - this.isHeap = isHeap; - this.init = init; - this.max = max; - this.used = used; - this.committed = committed; - this.timeBucket = timeBucket; - } - - public MemoryMetric() { - } - - @Override public Data toData() { - MemoryMetricDataDefine define = new MemoryMetricDataDefine(); - Data data = define.build(id); - data.setDataString(0, this.id); - data.setDataInteger(0, this.applicationInstanceId); - data.setDataBoolean(0, this.isHeap); - data.setDataLong(0, this.init); - data.setDataLong(1, this.max); - data.setDataLong(2, this.used); - data.setDataLong(3, this.committed); - data.setDataLong(4, this.timeBucket); - return data; - } - - @Override public MemoryMetric toSelf(Data data) { - this.id = data.getDataString(0); - this.applicationInstanceId = data.getDataInteger(0); - this.isHeap = data.getDataBoolean(0); - this.init = data.getDataLong(0); - this.max = data.getDataLong(1); - this.used = data.getDataLong(2); - this.committed = data.getDataLong(3); - this.timeBucket = data.getDataLong(4); - return this; - } - - public void setId(String id) { - this.id = id; - } - - public void setApplicationInstanceId(int applicationInstanceId) { - this.applicationInstanceId = applicationInstanceId; - } - - public void setHeap(boolean heap) { - isHeap = heap; - } - - public void setInit(long init) { - this.init = init; - } - - public void setMax(long max) { - this.max = max; - } - - public void setUsed(long used) { - this.used = used; - } - - public void setCommitted(long committed) { - this.committed = committed; - } - - public void setTimeBucket(long timeBucket) { - this.timeBucket = timeBucket; - } - - public String getId() { - return id; - } - - public int getApplicationInstanceId() { - return applicationInstanceId; - } - - public long getTimeBucket() { - return timeBucket; - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/jvm/MemoryMetricTable.java b/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/jvm/MemoryMetricTable.java deleted file mode 100644 index 42e8942d8a..0000000000 --- a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/jvm/MemoryMetricTable.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.storage.base.define.jvm; - -import org.skywalking.apm.collector.storage.base.define.CommonTable; - -/** - * @author peng-yongsheng - */ -public class MemoryMetricTable extends CommonTable { - public static final String TABLE = "memory_metric"; - public static final String COLUMN_APPLICATION_INSTANCE_ID = "application_instance_id"; - public static final String COLUMN_IS_HEAP = "is_heap"; - public static final String COLUMN_INIT = "init"; - public static final String COLUMN_MAX = "max"; - public static final String COLUMN_USED = "used"; - public static final String COLUMN_COMMITTED = "committed"; -} diff --git a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/jvm/MemoryPoolMetricDataDefine.java b/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/jvm/MemoryPoolMetricDataDefine.java deleted file mode 100644 index 36b71b7c49..0000000000 --- a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/jvm/MemoryPoolMetricDataDefine.java +++ /dev/null @@ -1,154 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.storage.base.define.jvm; - -import org.skywalking.apm.collector.core.framework.UnexpectedException; -import org.skywalking.apm.collector.core.stream.Data; -import org.skywalking.apm.collector.core.stream.Transform; -import org.skywalking.apm.collector.core.stream.operate.CoverOperation; -import org.skywalking.apm.collector.core.stream.operate.NonOperation; -import org.skywalking.apm.collector.remote.grpc.proto.RemoteData; -import org.skywalking.apm.collector.storage.base.define.Attribute; -import org.skywalking.apm.collector.storage.base.define.AttributeType; -import org.skywalking.apm.collector.storage.base.define.DataDefine; - -/** - * @author peng-yongsheng - */ -public class MemoryPoolMetricDataDefine extends DataDefine { - - @Override protected int initialCapacity() { - return 8; - } - - @Override protected void attributeDefine() { - addAttribute(0, new Attribute(MemoryPoolMetricTable.COLUMN_ID, AttributeType.STRING, new NonOperation())); - addAttribute(1, new Attribute(MemoryPoolMetricTable.COLUMN_INSTANCE_ID, AttributeType.INTEGER, new CoverOperation())); - addAttribute(2, new Attribute(MemoryPoolMetricTable.COLUMN_POOL_TYPE, AttributeType.INTEGER, new CoverOperation())); - addAttribute(3, new Attribute(MemoryPoolMetricTable.COLUMN_INIT, AttributeType.LONG, new CoverOperation())); - addAttribute(4, new Attribute(MemoryPoolMetricTable.COLUMN_MAX, AttributeType.LONG, new CoverOperation())); - addAttribute(5, new Attribute(MemoryPoolMetricTable.COLUMN_USED, AttributeType.LONG, new CoverOperation())); - addAttribute(6, new Attribute(MemoryPoolMetricTable.COLUMN_COMMITTED, AttributeType.LONG, new CoverOperation())); - addAttribute(7, new Attribute(MemoryPoolMetricTable.COLUMN_TIME_BUCKET, AttributeType.LONG, new CoverOperation())); - } - - @Override public Object deserialize(RemoteData remoteData) { - throw new UnexpectedException("memory pool metric data did not need send to remote worker."); - } - - @Override public RemoteData serialize(Object object) { - throw new UnexpectedException("memory pool metric data did not need send to remote worker."); - } - - public static class MemoryPoolMetric implements Transform { - private String id; - private int instanceId; - private int poolType; - private long init; - private long max; - private long used; - private long committed; - private long timeBucket; - - public MemoryPoolMetric(String id, int instanceId, int poolType, long init, long max, - long used, long committed, long timeBucket) { - this.id = id; - this.instanceId = instanceId; - this.poolType = poolType; - this.init = init; - this.max = max; - this.used = used; - this.committed = committed; - this.timeBucket = timeBucket; - } - - public MemoryPoolMetric() { - } - - @Override public Data toData() { - MemoryPoolMetricDataDefine define = new MemoryPoolMetricDataDefine(); - Data data = define.build(id); - data.setDataString(0, this.id); - data.setDataInteger(0, this.instanceId); - data.setDataInteger(1, this.poolType); - data.setDataLong(0, this.init); - data.setDataLong(1, this.max); - data.setDataLong(2, this.used); - data.setDataLong(3, this.committed); - data.setDataLong(4, this.timeBucket); - return data; - } - - @Override public MemoryPoolMetric toSelf(Data data) { - this.id = data.getDataString(0); - this.instanceId = data.getDataInteger(0); - this.poolType = data.getDataInteger(1); - this.init = data.getDataLong(0); - this.max = data.getDataLong(1); - this.used = data.getDataLong(2); - this.committed = data.getDataLong(3); - this.timeBucket = data.getDataLong(4); - return this; - } - - public void setId(String id) { - this.id = id; - } - - public void setInstanceId(int instanceId) { - this.instanceId = instanceId; - } - - public void setPoolType(int poolType) { - this.poolType = poolType; - } - - public void setInit(long init) { - this.init = init; - } - - public void setMax(long max) { - this.max = max; - } - - public void setUsed(long used) { - this.used = used; - } - - public void setCommitted(long committed) { - this.committed = committed; - } - - public void setTimeBucket(long timeBucket) { - this.timeBucket = timeBucket; - } - - public String getId() { - return id; - } - - public int getInstanceId() { - return instanceId; - } - - public long getTimeBucket() { - return timeBucket; - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/jvm/MemoryPoolMetricTable.java b/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/jvm/MemoryPoolMetricTable.java deleted file mode 100644 index e5e4c76106..0000000000 --- a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/jvm/MemoryPoolMetricTable.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.storage.base.define.jvm; - -import org.skywalking.apm.collector.storage.base.define.CommonTable; - -/** - * @author peng-yongsheng - */ -public class MemoryPoolMetricTable extends CommonTable { - public static final String TABLE = "memory_pool_metric"; - public static final String COLUMN_INSTANCE_ID = "instance_id"; - public static final String COLUMN_POOL_TYPE = "pool_type"; - public static final String COLUMN_INIT = "init"; - public static final String COLUMN_MAX = "max"; - public static final String COLUMN_USED = "used"; - public static final String COLUMN_COMMITTED = "committed"; -} diff --git a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/node/NodeComponentDataDefine.java b/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/node/NodeComponentDataDefine.java deleted file mode 100644 index 6cd5980eb9..0000000000 --- a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/node/NodeComponentDataDefine.java +++ /dev/null @@ -1,151 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.storage.base.define.node; - -import org.skywalking.apm.collector.core.stream.Data; -import org.skywalking.apm.collector.core.stream.Transform; -import org.skywalking.apm.collector.core.stream.operate.CoverOperation; -import org.skywalking.apm.collector.core.stream.operate.NonOperation; -import org.skywalking.apm.collector.remote.grpc.proto.RemoteData; -import org.skywalking.apm.collector.storage.base.define.Attribute; -import org.skywalking.apm.collector.storage.base.define.AttributeType; -import org.skywalking.apm.collector.storage.base.define.DataDefine; - -/** - * @author peng-yongsheng - */ -public class NodeComponentDataDefine extends DataDefine { - - @Override protected int initialCapacity() { - return 6; - } - - @Override protected void attributeDefine() { - addAttribute(0, new Attribute(NodeComponentTable.COLUMN_ID, AttributeType.STRING, new NonOperation())); - addAttribute(1, new Attribute(NodeComponentTable.COLUMN_COMPONENT_ID, AttributeType.INTEGER, new CoverOperation())); - addAttribute(2, new Attribute(NodeComponentTable.COLUMN_COMPONENT_NAME, AttributeType.STRING, new CoverOperation())); - addAttribute(3, new Attribute(NodeComponentTable.COLUMN_PEER_ID, AttributeType.INTEGER, new CoverOperation())); - addAttribute(4, new Attribute(NodeComponentTable.COLUMN_PEER, AttributeType.STRING, new CoverOperation())); - addAttribute(5, new Attribute(NodeComponentTable.COLUMN_TIME_BUCKET, AttributeType.LONG, new CoverOperation())); - } - - @Override public Object deserialize(RemoteData remoteData) { - Data data = build(remoteData.getDataStrings(0)); - data.setDataInteger(0, remoteData.getDataIntegers(0)); - data.setDataString(1, remoteData.getDataStrings(1)); - data.setDataInteger(1, remoteData.getDataIntegers(1)); - data.setDataString(2, remoteData.getDataStrings(2)); - data.setDataLong(0, remoteData.getDataLongs(0)); - return data; - } - - @Override public RemoteData serialize(Object object) { - Data data = (Data)object; - RemoteData.Builder builder = RemoteData.newBuilder(); - builder.addDataStrings(data.getDataString(0)); - builder.addDataIntegers(data.getDataInteger(0)); - builder.addDataStrings(data.getDataString(1)); - builder.addDataIntegers(data.getDataInteger(1)); - builder.addDataStrings(data.getDataString(2)); - builder.addDataLongs(data.getDataLong(0)); - return builder.build(); - } - - public static class NodeComponent implements Transform { - private String id; - private Integer componentId; - private String componentName; - private Integer peerId; - private String peer; - private long timeBucket; - - public NodeComponent() { - } - - @Override public Data toData() { - NodeComponentDataDefine define = new NodeComponentDataDefine(); - Data data = define.build(id); - data.setDataString(0, this.id); - data.setDataInteger(0, this.componentId); - data.setDataString(1, this.componentName); - data.setDataInteger(1, this.peerId); - data.setDataString(2, this.peer); - data.setDataLong(0, this.timeBucket); - return data; - } - - @Override public NodeComponent toSelf(Data data) { - this.id = data.getDataString(0); - this.componentId = data.getDataInteger(0); - this.componentName = data.getDataString(1); - this.peerId = data.getDataInteger(1); - this.peer = data.getDataString(2); - this.timeBucket = data.getDataLong(0); - return this; - } - - public String getId() { - return id; - } - - public long getTimeBucket() { - return timeBucket; - } - - public void setId(String id) { - this.id = id; - } - - public void setTimeBucket(long timeBucket) { - this.timeBucket = timeBucket; - } - - public Integer getComponentId() { - return componentId; - } - - public void setComponentId(Integer componentId) { - this.componentId = componentId; - } - - public String getComponentName() { - return componentName; - } - - public void setComponentName(String componentName) { - this.componentName = componentName; - } - - public Integer getPeerId() { - return peerId; - } - - public void setPeerId(Integer peerId) { - this.peerId = peerId; - } - - public String getPeer() { - return peer; - } - - public void setPeer(String peer) { - this.peer = peer; - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/node/NodeComponentTable.java b/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/node/NodeComponentTable.java deleted file mode 100644 index 66cd0550af..0000000000 --- a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/node/NodeComponentTable.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.storage.base.define.node; - -import org.skywalking.apm.collector.storage.base.define.CommonTable; - -/** - * @author peng-yongsheng - */ -public class NodeComponentTable extends CommonTable { - public static final String TABLE = "node_component"; - public static final String COLUMN_COMPONENT_ID = "component_id"; - public static final String COLUMN_COMPONENT_NAME = "component_name"; - public static final String COLUMN_PEER = "peer"; - public static final String COLUMN_PEER_ID = "peer_id"; -} diff --git a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/node/NodeMappingDataDefine.java b/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/node/NodeMappingDataDefine.java deleted file mode 100644 index 1afa7467ac..0000000000 --- a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/node/NodeMappingDataDefine.java +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.storage.base.define.node; - -import org.skywalking.apm.collector.core.stream.Data; -import org.skywalking.apm.collector.core.stream.Transform; -import org.skywalking.apm.collector.core.stream.operate.CoverOperation; -import org.skywalking.apm.collector.core.stream.operate.NonOperation; -import org.skywalking.apm.collector.remote.grpc.proto.RemoteData; -import org.skywalking.apm.collector.storage.base.define.Attribute; -import org.skywalking.apm.collector.storage.base.define.AttributeType; -import org.skywalking.apm.collector.storage.base.define.DataDefine; - -/** - * @author peng-yongsheng - */ -public class NodeMappingDataDefine extends DataDefine { - - @Override protected int initialCapacity() { - return 5; - } - - @Override protected void attributeDefine() { - addAttribute(0, new Attribute(NodeMappingTable.COLUMN_ID, AttributeType.STRING, new NonOperation())); - addAttribute(1, new Attribute(NodeMappingTable.COLUMN_APPLICATION_ID, AttributeType.INTEGER, new CoverOperation())); - addAttribute(2, new Attribute(NodeMappingTable.COLUMN_ADDRESS_ID, AttributeType.INTEGER, new CoverOperation())); - addAttribute(3, new Attribute(NodeMappingTable.COLUMN_ADDRESS, AttributeType.STRING, new CoverOperation())); - addAttribute(4, new Attribute(NodeMappingTable.COLUMN_TIME_BUCKET, AttributeType.LONG, new CoverOperation())); - } - - @Override public Object deserialize(RemoteData remoteData) { - Data data = build(remoteData.getDataStrings(0)); - data.setDataInteger(0, remoteData.getDataIntegers(0)); - data.setDataInteger(1, remoteData.getDataIntegers(1)); - data.setDataString(1, remoteData.getDataStrings(1)); - data.setDataLong(0, remoteData.getDataLongs(0)); - return data; - } - - @Override public RemoteData serialize(Object object) { - Data data = (Data)object; - RemoteData.Builder builder = RemoteData.newBuilder(); - builder.addDataStrings(data.getDataString(0)); - builder.addDataIntegers(data.getDataInteger(0)); - builder.addDataIntegers(data.getDataInteger(1)); - builder.addDataStrings(data.getDataString(1)); - builder.addDataLongs(data.getDataLong(0)); - return builder.build(); - } - - public static class NodeMapping implements Transform { - private String id; - private int applicationId; - private int addressId; - private String address; - private long timeBucket; - - public NodeMapping() { - } - - @Override public Data toData() { - NodeMappingDataDefine define = new NodeMappingDataDefine(); - Data data = define.build(id); - data.setDataString(0, this.id); - data.setDataInteger(0, this.applicationId); - data.setDataInteger(1, this.addressId); - data.setDataString(1, this.address); - data.setDataLong(0, this.timeBucket); - return data; - } - - @Override public NodeMapping toSelf(Data data) { - this.id = data.getDataString(0); - this.applicationId = data.getDataInteger(0); - this.addressId = data.getDataInteger(1); - this.address = data.getDataString(1); - this.timeBucket = data.getDataLong(0); - return this; - } - - public String getId() { - return id; - } - - public long getTimeBucket() { - return timeBucket; - } - - public void setId(String id) { - this.id = id; - } - - public void setTimeBucket(long timeBucket) { - this.timeBucket = timeBucket; - } - - public int getApplicationId() { - return applicationId; - } - - public void setApplicationId(int applicationId) { - this.applicationId = applicationId; - } - - public int getAddressId() { - return addressId; - } - - public void setAddressId(int addressId) { - this.addressId = addressId; - } - - public String getAddress() { - return address; - } - - public void setAddress(String address) { - this.address = address; - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/node/NodeMappingTable.java b/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/node/NodeMappingTable.java deleted file mode 100644 index 13a38e8048..0000000000 --- a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/node/NodeMappingTable.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.storage.base.define.node; - -import org.skywalking.apm.collector.storage.base.define.CommonTable; - -/** - * @author peng-yongsheng - */ -public class NodeMappingTable extends CommonTable { - public static final String TABLE = "node_mapping"; - public static final String COLUMN_APPLICATION_ID = "application_id"; - public static final String COLUMN_ADDRESS_ID = "address_id"; - public static final String COLUMN_ADDRESS = "address"; -} diff --git a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/noderef/NodeReferenceDataDefine.java b/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/noderef/NodeReferenceDataDefine.java deleted file mode 100644 index 6c672bd41d..0000000000 --- a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/noderef/NodeReferenceDataDefine.java +++ /dev/null @@ -1,210 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.storage.base.define.noderef; - -import org.skywalking.apm.collector.core.stream.Data; -import org.skywalking.apm.collector.core.stream.Transform; -import org.skywalking.apm.collector.core.stream.operate.AddOperation; -import org.skywalking.apm.collector.core.stream.operate.NonOperation; -import org.skywalking.apm.collector.remote.grpc.proto.RemoteData; -import org.skywalking.apm.collector.storage.base.define.Attribute; -import org.skywalking.apm.collector.storage.base.define.AttributeType; -import org.skywalking.apm.collector.storage.base.define.DataDefine; - -/** - * @author peng-yongsheng - */ -public class NodeReferenceDataDefine extends DataDefine { - - @Override protected int initialCapacity() { - return 11; - } - - @Override protected void attributeDefine() { - addAttribute(0, new Attribute(NodeReferenceTable.COLUMN_ID, AttributeType.STRING, new NonOperation())); - addAttribute(1, new Attribute(NodeReferenceTable.COLUMN_FRONT_APPLICATION_ID, AttributeType.INTEGER, new NonOperation())); - addAttribute(2, new Attribute(NodeReferenceTable.COLUMN_BEHIND_APPLICATION_ID, AttributeType.INTEGER, new NonOperation())); - addAttribute(3, new Attribute(NodeReferenceTable.COLUMN_BEHIND_PEER, AttributeType.STRING, new NonOperation())); - addAttribute(4, new Attribute(NodeReferenceTable.COLUMN_S1_LTE, AttributeType.INTEGER, new AddOperation())); - addAttribute(5, new Attribute(NodeReferenceTable.COLUMN_S3_LTE, AttributeType.INTEGER, new AddOperation())); - addAttribute(6, new Attribute(NodeReferenceTable.COLUMN_S5_LTE, AttributeType.INTEGER, new AddOperation())); - addAttribute(7, new Attribute(NodeReferenceTable.COLUMN_S5_GT, AttributeType.INTEGER, new AddOperation())); - addAttribute(8, new Attribute(NodeReferenceTable.COLUMN_SUMMARY, AttributeType.INTEGER, new AddOperation())); - addAttribute(9, new Attribute(NodeReferenceTable.COLUMN_ERROR, AttributeType.INTEGER, new AddOperation())); - addAttribute(10, new Attribute(NodeReferenceTable.COLUMN_TIME_BUCKET, AttributeType.LONG, new NonOperation())); - } - - @Override public Object deserialize(RemoteData remoteData) { - Data data = build(remoteData.getDataStrings(0)); - data.setDataInteger(0, remoteData.getDataIntegers(0)); - data.setDataInteger(1, remoteData.getDataIntegers(1)); - data.setDataString(1, remoteData.getDataStrings(1)); - data.setDataInteger(2, remoteData.getDataIntegers(2)); - data.setDataInteger(3, remoteData.getDataIntegers(3)); - data.setDataInteger(4, remoteData.getDataIntegers(4)); - data.setDataInteger(5, remoteData.getDataIntegers(5)); - data.setDataInteger(6, remoteData.getDataIntegers(6)); - data.setDataInteger(7, remoteData.getDataIntegers(7)); - data.setDataLong(0, remoteData.getDataLongs(0)); - return data; - } - - @Override public RemoteData serialize(Object object) { - Data data = (Data)object; - RemoteData.Builder builder = RemoteData.newBuilder(); - builder.addDataStrings(data.getDataString(0)); - builder.addDataIntegers(data.getDataInteger(0)); - builder.addDataIntegers(data.getDataInteger(1)); - builder.addDataStrings(data.getDataString(1)); - builder.addDataIntegers(data.getDataInteger(2)); - builder.addDataIntegers(data.getDataInteger(3)); - builder.addDataIntegers(data.getDataInteger(4)); - builder.addDataIntegers(data.getDataInteger(5)); - builder.addDataIntegers(data.getDataInteger(6)); - builder.addDataIntegers(data.getDataInteger(7)); - builder.addDataLongs(data.getDataLong(0)); - return builder.build(); - } - - public static class NodeReference implements Transform { - private String id; - private int frontApplicationId; - private int behindApplicationId; - private String behindPeer; - private int s1LTE = 0; - private int s3LTE = 0; - private int s5LTE = 0; - private int s5GT = 0; - private int summary = 0; - private int error = 0; - private long timeBucket; - - public NodeReference() { - } - - @Override public Data toData() { - NodeReferenceDataDefine define = new NodeReferenceDataDefine(); - Data data = define.build(id); - data.setDataString(0, this.id); - data.setDataInteger(0, this.frontApplicationId); - data.setDataInteger(1, this.behindApplicationId); - data.setDataString(1, this.behindPeer); - data.setDataInteger(2, this.s1LTE); - data.setDataInteger(3, this.s3LTE); - data.setDataInteger(4, this.s5LTE); - data.setDataInteger(5, this.s5GT); - data.setDataInteger(6, this.summary); - data.setDataInteger(7, this.error); - data.setDataLong(0, this.timeBucket); - return data; - } - - @Override public Object toSelf(Data data) { - return null; - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public int getFrontApplicationId() { - return frontApplicationId; - } - - public void setFrontApplicationId(int frontApplicationId) { - this.frontApplicationId = frontApplicationId; - } - - public int getBehindApplicationId() { - return behindApplicationId; - } - - public void setBehindApplicationId(int behindApplicationId) { - this.behindApplicationId = behindApplicationId; - } - - public String getBehindPeer() { - return behindPeer; - } - - public void setBehindPeer(String behindPeer) { - this.behindPeer = behindPeer; - } - - public int getS1LTE() { - return s1LTE; - } - - public void setS1LTE(int s1LTE) { - this.s1LTE = s1LTE; - } - - public int getS3LTE() { - return s3LTE; - } - - public void setS3LTE(int s3LTE) { - this.s3LTE = s3LTE; - } - - public int getS5LTE() { - return s5LTE; - } - - public void setS5LTE(int s5LTE) { - this.s5LTE = s5LTE; - } - - public int getS5GT() { - return s5GT; - } - - public void setS5GT(int s5GT) { - this.s5GT = s5GT; - } - - public int getError() { - return error; - } - - public void setError(int error) { - this.error = error; - } - - public int getSummary() { - return summary; - } - - public void setSummary(int summary) { - this.summary = summary; - } - - public long getTimeBucket() { - return timeBucket; - } - - public void setTimeBucket(long timeBucket) { - this.timeBucket = timeBucket; - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/noderef/NodeReferenceTable.java b/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/noderef/NodeReferenceTable.java deleted file mode 100644 index c62e64d592..0000000000 --- a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/noderef/NodeReferenceTable.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.storage.base.define.noderef; - -import org.skywalking.apm.collector.storage.base.define.CommonTable; - -/** - * @author peng-yongsheng - */ -public class NodeReferenceTable extends CommonTable { - public static final String TABLE = "node_reference"; - public static final String COLUMN_FRONT_APPLICATION_ID = "front_application_id"; - public static final String COLUMN_BEHIND_APPLICATION_ID = "behind_application_id"; - public static final String COLUMN_BEHIND_PEER = "behind_peer"; - public static final String COLUMN_S1_LTE = "s1_lte"; - public static final String COLUMN_S3_LTE = "s3_lte"; - public static final String COLUMN_S5_LTE = "s5_lte"; - public static final String COLUMN_S5_GT = "s5_gt"; - public static final String COLUMN_SUMMARY = "summary"; - public static final String COLUMN_ERROR = "error"; -} diff --git a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/register/ApplicationDataDefine.java b/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/register/ApplicationDataDefine.java deleted file mode 100644 index ff2cbe06c2..0000000000 --- a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/register/ApplicationDataDefine.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.storage.base.define.register; - -import org.skywalking.apm.collector.core.stream.operate.CoverOperation; -import org.skywalking.apm.collector.core.stream.operate.NonOperation; -import org.skywalking.apm.collector.remote.grpc.proto.RemoteData; -import org.skywalking.apm.collector.storage.base.define.Attribute; -import org.skywalking.apm.collector.storage.base.define.AttributeType; -import org.skywalking.apm.collector.storage.base.define.DataDefine; - -/** - * @author peng-yongsheng - */ -public class ApplicationDataDefine extends DataDefine { - - @Override protected int initialCapacity() { - return 3; - } - - @Override protected void attributeDefine() { - addAttribute(0, new Attribute(ApplicationTable.COLUMN_ID, AttributeType.STRING, new NonOperation())); - addAttribute(1, new Attribute(ApplicationTable.COLUMN_APPLICATION_CODE, AttributeType.STRING, new CoverOperation())); - addAttribute(2, new Attribute(ApplicationTable.COLUMN_APPLICATION_ID, AttributeType.INTEGER, new CoverOperation())); - } - - @Override public Object deserialize(RemoteData remoteData) { - String id = remoteData.getDataStrings(0); - String applicationCode = remoteData.getDataStrings(1); - int applicationId = remoteData.getDataIntegers(0); - return new Application(id, applicationCode, applicationId); - } - - @Override public RemoteData serialize(Object object) { - Application application = (Application)object; - RemoteData.Builder builder = RemoteData.newBuilder(); - builder.addDataStrings(application.getId()); - builder.addDataStrings(application.getApplicationCode()); - builder.addDataIntegers(application.getApplicationId()); - return builder.build(); - } - - public static class Application { - private String id; - private String applicationCode; - private int applicationId; - - public Application(String id, String applicationCode, int applicationId) { - this.id = id; - this.applicationCode = applicationCode; - this.applicationId = applicationId; - } - - public String getId() { - return id; - } - - public String getApplicationCode() { - return applicationCode; - } - - public int getApplicationId() { - return applicationId; - } - - public void setId(String id) { - this.id = id; - } - - public void setApplicationCode(String applicationCode) { - this.applicationCode = applicationCode; - } - - public void setApplicationId(int applicationId) { - this.applicationId = applicationId; - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/register/ApplicationTable.java b/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/register/ApplicationTable.java deleted file mode 100644 index 390c34e7a4..0000000000 --- a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/register/ApplicationTable.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.storage.base.define.register; - -import org.skywalking.apm.collector.storage.base.define.CommonTable; - -/** - * @author peng-yongsheng - */ -public class ApplicationTable extends CommonTable { - public static final String TABLE = "application"; - public static final String COLUMN_APPLICATION_CODE = "application_code"; - public static final String COLUMN_APPLICATION_ID = "application_id"; -} diff --git a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/register/InstanceDataDefine.java b/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/register/InstanceDataDefine.java deleted file mode 100644 index 05ade3aa84..0000000000 --- a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/register/InstanceDataDefine.java +++ /dev/null @@ -1,151 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.storage.base.define.register; - -import org.skywalking.apm.collector.core.stream.operate.CoverOperation; -import org.skywalking.apm.collector.core.stream.operate.NonOperation; -import org.skywalking.apm.collector.remote.grpc.proto.RemoteData; -import org.skywalking.apm.collector.storage.base.define.Attribute; -import org.skywalking.apm.collector.storage.base.define.AttributeType; -import org.skywalking.apm.collector.storage.base.define.DataDefine; - -/** - * @author peng-yongsheng - */ -public class InstanceDataDefine extends DataDefine { - - @Override protected int initialCapacity() { - return 7; - } - - @Override protected void attributeDefine() { - addAttribute(0, new Attribute(InstanceTable.COLUMN_ID, AttributeType.STRING, new NonOperation())); - addAttribute(1, new Attribute(InstanceTable.COLUMN_APPLICATION_ID, AttributeType.INTEGER, new CoverOperation())); - addAttribute(2, new Attribute(InstanceTable.COLUMN_AGENT_UUID, AttributeType.STRING, new CoverOperation())); - addAttribute(3, new Attribute(InstanceTable.COLUMN_REGISTER_TIME, AttributeType.LONG, new CoverOperation())); - addAttribute(4, new Attribute(InstanceTable.COLUMN_INSTANCE_ID, AttributeType.INTEGER, new CoverOperation())); - addAttribute(5, new Attribute(InstanceTable.COLUMN_HEARTBEAT_TIME, AttributeType.LONG, new CoverOperation())); - addAttribute(6, new Attribute(InstanceTable.COLUMN_OS_INFO, AttributeType.STRING, new CoverOperation())); - } - - @Override public Object deserialize(RemoteData remoteData) { - String id = remoteData.getDataStrings(0); - int applicationId = remoteData.getDataIntegers(0); - String agentUUID = remoteData.getDataStrings(1); - int instanceId = remoteData.getDataIntegers(1); - long registerTime = remoteData.getDataLongs(0); - long heartBeatTime = remoteData.getDataLongs(1); - String osInfo = remoteData.getDataStrings(2); - return new Instance(id, applicationId, agentUUID, registerTime, instanceId, heartBeatTime, osInfo); - } - - @Override public RemoteData serialize(Object object) { - Instance instance = (Instance)object; - RemoteData.Builder builder = RemoteData.newBuilder(); - builder.addDataStrings(instance.getId()); - builder.addDataIntegers(instance.getApplicationId()); - builder.addDataStrings(instance.getAgentUUID()); - builder.addDataIntegers(instance.getInstanceId()); - builder.addDataLongs(instance.getRegisterTime()); - builder.addDataLongs(instance.getHeartBeatTime()); - builder.addDataStrings(instance.getOsInfo()); - return builder.build(); - } - - public static class Instance { - private String id; - private int applicationId; - private String agentUUID; - private long registerTime; - private int instanceId; - private long heartBeatTime; - private String osInfo; - - public Instance(String id, int applicationId, String agentUUID, long registerTime, int instanceId, - long heartBeatTime, - String osInfo) { - this.id = id; - this.applicationId = applicationId; - this.agentUUID = agentUUID; - this.registerTime = registerTime; - this.instanceId = instanceId; - this.heartBeatTime = heartBeatTime; - this.osInfo = osInfo; - } - - public Instance() { - } - - public String getId() { - return id; - } - - public int getApplicationId() { - return applicationId; - } - - public String getAgentUUID() { - return agentUUID; - } - - public long getRegisterTime() { - return registerTime; - } - - public int getInstanceId() { - return instanceId; - } - - public void setId(String id) { - this.id = id; - } - - public void setApplicationId(int applicationId) { - this.applicationId = applicationId; - } - - public void setAgentUUID(String agentUUID) { - this.agentUUID = agentUUID; - } - - public void setRegisterTime(long registerTime) { - this.registerTime = registerTime; - } - - public void setInstanceId(int instanceId) { - this.instanceId = instanceId; - } - - public long getHeartBeatTime() { - return heartBeatTime; - } - - public void setHeartBeatTime(long heartBeatTime) { - this.heartBeatTime = heartBeatTime; - } - - public String getOsInfo() { - return osInfo; - } - - public void setOsInfo(String osInfo) { - this.osInfo = osInfo; - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/register/InstanceTable.java b/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/register/InstanceTable.java deleted file mode 100644 index a4266cb898..0000000000 --- a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/register/InstanceTable.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.storage.base.define.register; - -import org.skywalking.apm.collector.storage.base.define.CommonTable; - -/** - * @author peng-yongsheng - */ -public class InstanceTable extends CommonTable { - public static final String TABLE = "instance"; - public static final String COLUMN_APPLICATION_ID = "application_id"; - public static final String COLUMN_AGENT_UUID = "agent_uuid"; - public static final String COLUMN_REGISTER_TIME = "register_time"; - public static final String COLUMN_INSTANCE_ID = "instance_id"; - public static final String COLUMN_HEARTBEAT_TIME = "heartbeat_time"; - public static final String COLUMN_OS_INFO = "os_info"; -} diff --git a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/register/ServiceNameDataDefine.java b/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/register/ServiceNameDataDefine.java deleted file mode 100644 index 2fcb24dcc1..0000000000 --- a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/register/ServiceNameDataDefine.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.storage.base.define.register; - -import org.skywalking.apm.collector.core.stream.operate.CoverOperation; -import org.skywalking.apm.collector.core.stream.operate.NonOperation; -import org.skywalking.apm.collector.remote.grpc.proto.RemoteData; -import org.skywalking.apm.collector.storage.base.define.Attribute; -import org.skywalking.apm.collector.storage.base.define.AttributeType; -import org.skywalking.apm.collector.storage.base.define.DataDefine; - -/** - * @author peng-yongsheng - */ -public class ServiceNameDataDefine extends DataDefine { - - @Override protected int initialCapacity() { - return 4; - } - - @Override protected void attributeDefine() { - addAttribute(0, new Attribute(ServiceNameTable.COLUMN_ID, AttributeType.STRING, new NonOperation())); - addAttribute(1, new Attribute(ServiceNameTable.COLUMN_SERVICE_NAME, AttributeType.STRING, new CoverOperation())); - addAttribute(2, new Attribute(ServiceNameTable.COLUMN_APPLICATION_ID, AttributeType.INTEGER, new CoverOperation())); - addAttribute(3, new Attribute(ServiceNameTable.COLUMN_SERVICE_ID, AttributeType.INTEGER, new CoverOperation())); - } - - @Override public Object deserialize(RemoteData remoteData) { - String id = remoteData.getDataStrings(0); - String serviceName = remoteData.getDataStrings(1); - int applicationId = remoteData.getDataIntegers(0); - int serviceId = remoteData.getDataIntegers(1); - return new ServiceName(id, serviceName, applicationId, serviceId); - } - - @Override public RemoteData serialize(Object object) { - ServiceName serviceName = (ServiceName)object; - RemoteData.Builder builder = RemoteData.newBuilder(); - builder.addDataStrings(serviceName.getId()); - builder.addDataStrings(serviceName.getServiceName()); - builder.addDataIntegers(serviceName.getApplicationId()); - builder.addDataIntegers(serviceName.getServiceId()); - return builder.build(); - } - - public static class ServiceName { - private String id; - private String serviceName; - private int applicationId; - private int serviceId; - - public ServiceName(String id, String serviceName, int applicationId, int serviceId) { - this.id = id; - this.serviceName = serviceName; - this.applicationId = applicationId; - this.serviceId = serviceId; - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getServiceName() { - return serviceName; - } - - public void setServiceName(String serviceName) { - this.serviceName = serviceName; - } - - public int getApplicationId() { - return applicationId; - } - - public void setApplicationId(int applicationId) { - this.applicationId = applicationId; - } - - public int getServiceId() { - return serviceId; - } - - public void setServiceId(int serviceId) { - this.serviceId = serviceId; - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/register/ServiceNameTable.java b/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/register/ServiceNameTable.java deleted file mode 100644 index 2c04d32d12..0000000000 --- a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/register/ServiceNameTable.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.storage.base.define.register; - -import org.skywalking.apm.collector.storage.base.define.CommonTable; - -/** - * @author peng-yongsheng - */ -public class ServiceNameTable extends CommonTable { - public static final String TABLE = "service_name"; - public static final String COLUMN_SERVICE_NAME = "service_name"; - public static final String COLUMN_APPLICATION_ID = "application_id"; - public static final String COLUMN_SERVICE_ID = "service_id"; -} diff --git a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/segment/SegmentCostDataDefine.java b/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/segment/SegmentCostDataDefine.java deleted file mode 100644 index acbf570dba..0000000000 --- a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/segment/SegmentCostDataDefine.java +++ /dev/null @@ -1,164 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.storage.base.define.segment; - -import org.skywalking.apm.collector.core.stream.Data; -import org.skywalking.apm.collector.core.stream.Transform; -import org.skywalking.apm.collector.core.stream.operate.CoverOperation; -import org.skywalking.apm.collector.core.stream.operate.NonOperation; -import org.skywalking.apm.collector.remote.grpc.proto.RemoteData; -import org.skywalking.apm.collector.storage.base.define.Attribute; -import org.skywalking.apm.collector.storage.base.define.AttributeType; -import org.skywalking.apm.collector.storage.base.define.DataDefine; - -/** - * @author peng-yongsheng - */ -public class SegmentCostDataDefine extends DataDefine { - - @Override protected int initialCapacity() { - return 9; - } - - @Override protected void attributeDefine() { - addAttribute(0, new Attribute(SegmentCostTable.COLUMN_ID, AttributeType.STRING, new NonOperation())); - addAttribute(1, new Attribute(SegmentCostTable.COLUMN_SEGMENT_ID, AttributeType.STRING, new CoverOperation())); - addAttribute(2, new Attribute(SegmentCostTable.COLUMN_APPLICATION_ID, AttributeType.INTEGER, new CoverOperation())); - addAttribute(3, new Attribute(SegmentCostTable.COLUMN_SERVICE_NAME, AttributeType.STRING, new CoverOperation())); - addAttribute(4, new Attribute(SegmentCostTable.COLUMN_COST, AttributeType.LONG, new CoverOperation())); - addAttribute(5, new Attribute(SegmentCostTable.COLUMN_START_TIME, AttributeType.LONG, new CoverOperation())); - addAttribute(6, new Attribute(SegmentCostTable.COLUMN_END_TIME, AttributeType.LONG, new CoverOperation())); - addAttribute(7, new Attribute(SegmentCostTable.COLUMN_IS_ERROR, AttributeType.BOOLEAN, new CoverOperation())); - addAttribute(8, new Attribute(SegmentCostTable.COLUMN_TIME_BUCKET, AttributeType.LONG, new NonOperation())); - } - - @Override public Object deserialize(RemoteData remoteData) { - return null; - } - - @Override public RemoteData serialize(Object object) { - return null; - } - - public static class SegmentCost implements Transform { - private String id; - private int applicationId; - private String segmentId; - private String serviceName; - private Long cost; - private Long startTime; - private Long endTime; - private boolean isError; - private long timeBucket; - - public SegmentCost() { - } - - @Override public Data toData() { - SegmentCostDataDefine define = new SegmentCostDataDefine(); - Data data = define.build(id); - data.setDataString(0, this.id); - data.setDataString(1, this.segmentId); - data.setDataString(2, this.serviceName); - data.setDataInteger(0, this.applicationId); - data.setDataLong(0, this.cost); - data.setDataLong(1, this.startTime); - data.setDataLong(2, this.endTime); - data.setDataBoolean(0, this.isError); - data.setDataLong(3, this.timeBucket); - return data; - } - - @Override public Object toSelf(Data data) { - return null; - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getSegmentId() { - return segmentId; - } - - public void setSegmentId(String segmentId) { - this.segmentId = segmentId; - } - - public String getServiceName() { - return serviceName; - } - - public void setServiceName(String serviceName) { - this.serviceName = serviceName; - } - - public Long getCost() { - return cost; - } - - public void setCost(Long cost) { - this.cost = cost; - } - - public Long getStartTime() { - return startTime; - } - - public void setStartTime(Long startTime) { - this.startTime = startTime; - } - - public Long getEndTime() { - return endTime; - } - - public void setEndTime(Long endTime) { - this.endTime = endTime; - } - - public boolean isError() { - return isError; - } - - public void setError(boolean error) { - isError = error; - } - - public long getTimeBucket() { - return timeBucket; - } - - public void setTimeBucket(long timeBucket) { - this.timeBucket = timeBucket; - } - - public int getApplicationId() { - return applicationId; - } - - public void setApplicationId(int applicationId) { - this.applicationId = applicationId; - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/segment/SegmentCostTable.java b/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/segment/SegmentCostTable.java deleted file mode 100644 index 3f17163412..0000000000 --- a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/segment/SegmentCostTable.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.storage.base.define.segment; - -import org.skywalking.apm.collector.storage.base.define.CommonTable; - -/** - * @author peng-yongsheng - */ -public class SegmentCostTable extends CommonTable { - public static final String TABLE = "segment_cost"; - public static final String COLUMN_SEGMENT_ID = "segment_id"; - public static final String COLUMN_APPLICATION_ID = "application_id"; - public static final String COLUMN_START_TIME = "start_time"; - public static final String COLUMN_END_TIME = "end_time"; - public static final String COLUMN_SERVICE_NAME = "service_name"; - public static final String COLUMN_COST = "cost"; - public static final String COLUMN_IS_ERROR = "is_error"; -} diff --git a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/segment/SegmentDataDefine.java b/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/segment/SegmentDataDefine.java deleted file mode 100644 index 2033410029..0000000000 --- a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/segment/SegmentDataDefine.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.storage.base.define.segment; - -import org.skywalking.apm.collector.core.stream.Data; -import org.skywalking.apm.collector.core.stream.Transform; -import org.skywalking.apm.collector.core.stream.operate.CoverOperation; -import org.skywalking.apm.collector.core.stream.operate.NonOperation; -import org.skywalking.apm.collector.remote.grpc.proto.RemoteData; -import org.skywalking.apm.collector.storage.base.define.Attribute; -import org.skywalking.apm.collector.storage.base.define.AttributeType; -import org.skywalking.apm.collector.storage.base.define.DataDefine; - -/** - * @author peng-yongsheng - */ -public class SegmentDataDefine extends DataDefine { - - @Override protected int initialCapacity() { - return 2; - } - - @Override protected void attributeDefine() { - addAttribute(0, new Attribute(SegmentTable.COLUMN_ID, AttributeType.STRING, new NonOperation())); - addAttribute(1, new Attribute(SegmentTable.COLUMN_DATA_BINARY, AttributeType.BYTE, new CoverOperation())); - } - - @Override public Object deserialize(RemoteData remoteData) { - return null; - } - - @Override public RemoteData serialize(Object object) { - return null; - } - - public static class Segment implements Transform { - private String id; - private byte[] dataBinary; - - public Segment() { - } - - @Override public Data toData() { - SegmentDataDefine define = new SegmentDataDefine(); - Data data = define.build(id); - data.setDataString(0, this.id); - data.setDataBytes(0, this.dataBinary); - return data; - } - - @Override public Object toSelf(Data data) { - return null; - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public byte[] getDataBinary() { - return dataBinary; - } - - public void setDataBinary(byte[] dataBinary) { - this.dataBinary = dataBinary; - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/segment/SegmentTable.java b/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/segment/SegmentTable.java deleted file mode 100644 index 74e305c22e..0000000000 --- a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/segment/SegmentTable.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.storage.base.define.segment; - -import org.skywalking.apm.collector.storage.base.define.CommonTable; - -/** - * @author peng-yongsheng - */ -public class SegmentTable extends CommonTable { - public static final String TABLE = "segment"; - public static final String COLUMN_DATA_BINARY = "data_binary"; -} diff --git a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/service/ServiceEntryDataDefine.java b/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/service/ServiceEntryDataDefine.java deleted file mode 100644 index e461983f89..0000000000 --- a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/service/ServiceEntryDataDefine.java +++ /dev/null @@ -1,162 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.storage.base.define.service; - -import org.skywalking.apm.collector.core.stream.Data; -import org.skywalking.apm.collector.core.stream.Transform; -import org.skywalking.apm.collector.core.stream.operate.CoverOperation; -import org.skywalking.apm.collector.core.stream.operate.NonOperation; -import org.skywalking.apm.collector.remote.grpc.proto.RemoteData; -import org.skywalking.apm.collector.storage.base.define.Attribute; -import org.skywalking.apm.collector.storage.base.define.AttributeType; -import org.skywalking.apm.collector.storage.base.define.DataDefine; - -/** - * @author peng-yongsheng - */ -public class ServiceEntryDataDefine extends DataDefine { - - @Override protected int initialCapacity() { - return 6; - } - - @Override protected void attributeDefine() { - addAttribute(0, new Attribute(ServiceEntryTable.COLUMN_ID, AttributeType.STRING, new NonOperation())); - addAttribute(1, new Attribute(ServiceEntryTable.COLUMN_APPLICATION_ID, AttributeType.INTEGER, new CoverOperation())); - addAttribute(2, new Attribute(ServiceEntryTable.COLUMN_ENTRY_SERVICE_ID, AttributeType.INTEGER, new CoverOperation())); - addAttribute(3, new Attribute(ServiceEntryTable.COLUMN_ENTRY_SERVICE_NAME, AttributeType.STRING, new CoverOperation())); - addAttribute(4, new Attribute(ServiceEntryTable.COLUMN_REGISTER_TIME, AttributeType.LONG, new NonOperation())); - addAttribute(5, new Attribute(ServiceEntryTable.COLUMN_NEWEST_TIME, AttributeType.LONG, new CoverOperation())); - } - - @Override public Object deserialize(RemoteData remoteData) { - Data data = build(remoteData.getDataStrings(0)); - data.setDataInteger(0, remoteData.getDataIntegers(0)); - data.setDataInteger(1, remoteData.getDataIntegers(1)); - data.setDataString(1, remoteData.getDataStrings(1)); - data.setDataLong(0, remoteData.getDataLongs(0)); - data.setDataLong(1, remoteData.getDataLongs(1)); - return data; - } - - @Override public RemoteData serialize(Object object) { - Data data = (Data)object; - RemoteData.Builder builder = RemoteData.newBuilder(); - builder.addDataStrings(data.getDataString(0)); - builder.addDataIntegers(data.getDataInteger(0)); - builder.addDataIntegers(data.getDataInteger(1)); - builder.addDataStrings(data.getDataString(1)); - builder.addDataLongs(data.getDataLong(0)); - builder.addDataLongs(data.getDataLong(1)); - return builder.build(); - } - - public static class ServiceEntry implements Transform { - private String id; - private int applicationId; - private int entryServiceId; - private String entryServiceName; - private long registerTime; - private long newestTime; - - public ServiceEntry(String id, int applicationId, int entryServiceId, String entryServiceName, - long registerTime, - long newestTime) { - this.id = id; - this.applicationId = applicationId; - this.entryServiceId = entryServiceId; - this.entryServiceName = entryServiceName; - this.registerTime = registerTime; - this.newestTime = newestTime; - } - - public ServiceEntry() { - } - - @Override public Data toData() { - ServiceEntryDataDefine define = new ServiceEntryDataDefine(); - Data data = define.build(id); - data.setDataString(0, this.id); - data.setDataInteger(0, this.applicationId); - data.setDataInteger(1, this.entryServiceId); - data.setDataString(1, this.entryServiceName); - data.setDataLong(0, this.registerTime); - data.setDataLong(1, this.newestTime); - return data; - } - - @Override public ServiceEntry toSelf(Data data) { - this.id = data.getDataString(0); - this.applicationId = data.getDataInteger(0); - this.entryServiceId = data.getDataInteger(1); - this.entryServiceName = data.getDataString(1); - this.registerTime = data.getDataLong(0); - this.newestTime = data.getDataLong(1); - return this; - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public int getEntryServiceId() { - return entryServiceId; - } - - public void setEntryServiceId(int entryServiceId) { - this.entryServiceId = entryServiceId; - } - - public String getEntryServiceName() { - return entryServiceName; - } - - public void setEntryServiceName(String entryServiceName) { - this.entryServiceName = entryServiceName; - } - - public int getApplicationId() { - return applicationId; - } - - public void setApplicationId(int applicationId) { - this.applicationId = applicationId; - } - - public long getRegisterTime() { - return registerTime; - } - - public void setRegisterTime(long registerTime) { - this.registerTime = registerTime; - } - - public long getNewestTime() { - return newestTime; - } - - public void setNewestTime(long newestTime) { - this.newestTime = newestTime; - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/service/ServiceEntryTable.java b/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/service/ServiceEntryTable.java deleted file mode 100644 index 456cb491dd..0000000000 --- a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/service/ServiceEntryTable.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.storage.base.define.service; - -import org.skywalking.apm.collector.storage.base.define.CommonTable; - -/** - * @author peng-yongsheng - */ -public class ServiceEntryTable extends CommonTable { - public static final String TABLE = "service_entry"; - public static final String COLUMN_APPLICATION_ID = "application_id"; - public static final String COLUMN_ENTRY_SERVICE_ID = "entry_service_id"; - public static final String COLUMN_ENTRY_SERVICE_NAME = "entry_service_name"; - public static final String COLUMN_REGISTER_TIME = "register_time"; - public static final String COLUMN_NEWEST_TIME = "newest_time"; -} diff --git a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/serviceref/ServiceReferenceDataDefine.java b/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/serviceref/ServiceReferenceDataDefine.java deleted file mode 100644 index 0f54188091..0000000000 --- a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/serviceref/ServiceReferenceDataDefine.java +++ /dev/null @@ -1,277 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.storage.base.define.serviceref; - -import org.skywalking.apm.collector.core.stream.Data; -import org.skywalking.apm.collector.core.stream.Transform; -import org.skywalking.apm.collector.core.stream.operate.AddOperation; -import org.skywalking.apm.collector.core.stream.operate.NonOperation; -import org.skywalking.apm.collector.remote.grpc.proto.RemoteData; -import org.skywalking.apm.collector.storage.base.define.Attribute; -import org.skywalking.apm.collector.storage.base.define.AttributeType; -import org.skywalking.apm.collector.storage.base.define.DataDefine; - -/** - * @author peng-yongsheng - */ -public class ServiceReferenceDataDefine extends DataDefine { - - @Override protected int initialCapacity() { - return 15; - } - - @Override protected void attributeDefine() { - addAttribute(0, new Attribute(ServiceReferenceTable.COLUMN_ID, AttributeType.STRING, new NonOperation())); - addAttribute(1, new Attribute(ServiceReferenceTable.COLUMN_ENTRY_SERVICE_ID, AttributeType.INTEGER, new NonOperation())); - addAttribute(2, new Attribute(ServiceReferenceTable.COLUMN_ENTRY_SERVICE_NAME, AttributeType.STRING, new NonOperation())); - addAttribute(3, new Attribute(ServiceReferenceTable.COLUMN_FRONT_SERVICE_ID, AttributeType.INTEGER, new NonOperation())); - addAttribute(4, new Attribute(ServiceReferenceTable.COLUMN_FRONT_SERVICE_NAME, AttributeType.STRING, new NonOperation())); - addAttribute(5, new Attribute(ServiceReferenceTable.COLUMN_BEHIND_SERVICE_ID, AttributeType.INTEGER, new NonOperation())); - addAttribute(6, new Attribute(ServiceReferenceTable.COLUMN_BEHIND_SERVICE_NAME, AttributeType.STRING, new NonOperation())); - addAttribute(7, new Attribute(ServiceReferenceTable.COLUMN_S1_LTE, AttributeType.LONG, new AddOperation())); - addAttribute(8, new Attribute(ServiceReferenceTable.COLUMN_S3_LTE, AttributeType.LONG, new AddOperation())); - addAttribute(9, new Attribute(ServiceReferenceTable.COLUMN_S5_LTE, AttributeType.LONG, new AddOperation())); - addAttribute(10, new Attribute(ServiceReferenceTable.COLUMN_S5_GT, AttributeType.LONG, new AddOperation())); - addAttribute(11, new Attribute(ServiceReferenceTable.COLUMN_SUMMARY, AttributeType.LONG, new AddOperation())); - addAttribute(12, new Attribute(ServiceReferenceTable.COLUMN_ERROR, AttributeType.LONG, new AddOperation())); - addAttribute(13, new Attribute(ServiceReferenceTable.COLUMN_COST_SUMMARY, AttributeType.LONG, new AddOperation())); - addAttribute(14, new Attribute(ServiceReferenceTable.COLUMN_TIME_BUCKET, AttributeType.LONG, new NonOperation())); - } - - @Override public Object deserialize(RemoteData remoteData) { - Data data = build(remoteData.getDataStrings(0)); - data.setDataInteger(0, remoteData.getDataIntegers(0)); - data.setDataString(1, remoteData.getDataStrings(1)); - data.setDataInteger(1, remoteData.getDataIntegers(1)); - data.setDataString(2, remoteData.getDataStrings(2)); - data.setDataInteger(2, remoteData.getDataIntegers(2)); - data.setDataString(3, remoteData.getDataStrings(3)); - data.setDataLong(0, remoteData.getDataLongs(0)); - data.setDataLong(1, remoteData.getDataLongs(1)); - data.setDataLong(2, remoteData.getDataLongs(2)); - data.setDataLong(3, remoteData.getDataLongs(3)); - data.setDataLong(4, remoteData.getDataLongs(4)); - data.setDataLong(5, remoteData.getDataLongs(5)); - data.setDataLong(6, remoteData.getDataLongs(6)); - data.setDataLong(7, remoteData.getDataLongs(7)); - return data; - } - - @Override public RemoteData serialize(Object object) { - Data data = (Data)object; - RemoteData.Builder builder = RemoteData.newBuilder(); - builder.addDataStrings(data.getDataString(0)); - builder.addDataIntegers(data.getDataInteger(0)); - builder.addDataStrings(data.getDataString(1)); - builder.addDataIntegers(data.getDataInteger(1)); - builder.addDataStrings(data.getDataString(2)); - builder.addDataIntegers(data.getDataInteger(2)); - builder.addDataStrings(data.getDataString(3)); - builder.addDataLongs(data.getDataLong(0)); - builder.addDataLongs(data.getDataLong(1)); - builder.addDataLongs(data.getDataLong(2)); - builder.addDataLongs(data.getDataLong(3)); - builder.addDataLongs(data.getDataLong(4)); - builder.addDataLongs(data.getDataLong(5)); - builder.addDataLongs(data.getDataLong(6)); - builder.addDataLongs(data.getDataLong(7)); - return builder.build(); - } - - public static class ServiceReference implements Transform { - private String id; - private int entryServiceId; - private String entryServiceName; - private int frontServiceId; - private String frontServiceName; - private int behindServiceId; - private String behindServiceName; - private long s1Lte; - private long s3Lte; - private long s5Lte; - private long s5Gt; - private long summary; - private long error; - private long costSummary; - private long timeBucket; - - public ServiceReference() { - } - - @Override public Data toData() { - ServiceReferenceDataDefine define = new ServiceReferenceDataDefine(); - Data data = define.build(id); - data.setDataString(0, this.id); - data.setDataInteger(0, this.entryServiceId); - data.setDataString(1, this.entryServiceName); - data.setDataInteger(1, this.frontServiceId); - data.setDataString(2, this.frontServiceName); - data.setDataInteger(2, this.behindServiceId); - data.setDataString(3, this.behindServiceName); - data.setDataLong(0, this.s1Lte); - data.setDataLong(1, this.s3Lte); - data.setDataLong(2, this.s5Lte); - data.setDataLong(3, this.s5Gt); - data.setDataLong(4, this.summary); - data.setDataLong(5, this.error); - data.setDataLong(6, this.costSummary); - data.setDataLong(7, this.timeBucket); - return data; - } - - @Override public Object toSelf(Data data) { - this.id = data.getDataString(0); - this.entryServiceId = data.getDataInteger(0); - this.entryServiceName = data.getDataString(1); - this.frontServiceId = data.getDataInteger(1); - this.frontServiceName = data.getDataString(2); - this.behindServiceId = data.getDataInteger(2); - this.behindServiceName = data.getDataString(3); - this.s1Lte = data.getDataLong(0); - this.s3Lte = data.getDataLong(1); - this.s5Lte = data.getDataLong(2); - this.s5Gt = data.getDataLong(3); - this.summary = data.getDataLong(4); - this.error = data.getDataLong(5); - this.costSummary = data.getDataLong(6); - this.timeBucket = data.getDataLong(7); - return this; - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public int getEntryServiceId() { - return entryServiceId; - } - - public void setEntryServiceId(int entryServiceId) { - this.entryServiceId = entryServiceId; - } - - public String getEntryServiceName() { - return entryServiceName; - } - - public void setEntryServiceName(String entryServiceName) { - this.entryServiceName = entryServiceName; - } - - public int getFrontServiceId() { - return frontServiceId; - } - - public void setFrontServiceId(int frontServiceId) { - this.frontServiceId = frontServiceId; - } - - public String getFrontServiceName() { - return frontServiceName; - } - - public void setFrontServiceName(String frontServiceName) { - this.frontServiceName = frontServiceName; - } - - public int getBehindServiceId() { - return behindServiceId; - } - - public void setBehindServiceId(int behindServiceId) { - this.behindServiceId = behindServiceId; - } - - public String getBehindServiceName() { - return behindServiceName; - } - - public void setBehindServiceName(String behindServiceName) { - this.behindServiceName = behindServiceName; - } - - public long getS1Lte() { - return s1Lte; - } - - public void setS1Lte(long s1Lte) { - this.s1Lte = s1Lte; - } - - public long getS3Lte() { - return s3Lte; - } - - public void setS3Lte(long s3Lte) { - this.s3Lte = s3Lte; - } - - public long getS5Lte() { - return s5Lte; - } - - public void setS5Lte(long s5Lte) { - this.s5Lte = s5Lte; - } - - public long getS5Gt() { - return s5Gt; - } - - public void setS5Gt(long s5Gt) { - this.s5Gt = s5Gt; - } - - public long getSummary() { - return summary; - } - - public void setSummary(long summary) { - this.summary = summary; - } - - public long getError() { - return error; - } - - public void setError(long error) { - this.error = error; - } - - public long getCostSummary() { - return costSummary; - } - - public void setCostSummary(long costSummary) { - this.costSummary = costSummary; - } - - public long getTimeBucket() { - return timeBucket; - } - - public void setTimeBucket(long timeBucket) { - this.timeBucket = timeBucket; - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/serviceref/ServiceReferenceTable.java b/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/serviceref/ServiceReferenceTable.java deleted file mode 100644 index bb959436af..0000000000 --- a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/define/serviceref/ServiceReferenceTable.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.storage.base.define.serviceref; - -import org.skywalking.apm.collector.storage.base.define.CommonTable; - -/** - * @author peng-yongsheng - */ -public class ServiceReferenceTable extends CommonTable { - public static final String TABLE = "service_reference"; - public static final String COLUMN_ENTRY_SERVICE_ID = "entry_service_id"; - public static final String COLUMN_ENTRY_SERVICE_NAME = "entry_service_name"; - public static final String COLUMN_FRONT_SERVICE_ID = "front_service_id"; - public static final String COLUMN_FRONT_SERVICE_NAME = "front_service_name"; - public static final String COLUMN_BEHIND_SERVICE_ID = "behind_service_id"; - public static final String COLUMN_BEHIND_SERVICE_NAME = "behind_service_name"; - public static final String COLUMN_S1_LTE = "s1_lte"; - public static final String COLUMN_S3_LTE = "s3_lte"; - public static final String COLUMN_S5_LTE = "s5_lte"; - public static final String COLUMN_S5_GT = "s5_gt"; - public static final String COLUMN_SUMMARY = "summary"; - public static final String COLUMN_COST_SUMMARY = "cost_summary"; - public static final String COLUMN_ERROR = "error"; -} diff --git a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/elasticsearch/ElasticSearchStorageException.java b/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/elasticsearch/ElasticSearchStorageException.java deleted file mode 100644 index ca926492e8..0000000000 --- a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/elasticsearch/ElasticSearchStorageException.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.storage.elasticsearch; - -import org.skywalking.apm.collector.core.storage.StorageException; - -/** - * @author peng-yongsheng - */ -public class ElasticSearchStorageException extends StorageException { - public ElasticSearchStorageException(String message) { - super(message); - } - - public ElasticSearchStorageException(String message, Throwable cause) { - super(message, cause); - } -} diff --git a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/elasticsearch/StorageElasticSearchConfig.java b/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/elasticsearch/StorageElasticSearchConfig.java deleted file mode 100644 index 9b41cadbfd..0000000000 --- a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/elasticsearch/StorageElasticSearchConfig.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.storage.elasticsearch; - -/** - * @author peng-yongsheng - */ -public class StorageElasticSearchConfig { - public static String CLUSTER_NAME; - public static Boolean CLUSTER_TRANSPORT_SNIFFER; - public static String CLUSTER_NODES; - public static Integer INDEX_SHARDS_NUMBER; - public static Integer INDEX_REPLICAS_NUMBER; -} diff --git a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/elasticsearch/StorageElasticSearchConfigParser.java b/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/elasticsearch/StorageElasticSearchConfigParser.java deleted file mode 100644 index d33a2ae9c5..0000000000 --- a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/elasticsearch/StorageElasticSearchConfigParser.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.storage.elasticsearch; - -import java.util.Map; -import org.skywalking.apm.collector.core.config.ConfigParseException; -import org.skywalking.apm.collector.core.module.ModuleConfigParser; -import org.skywalking.apm.collector.core.util.ObjectUtils; -import org.skywalking.apm.collector.core.util.StringUtils; - -/** - * @author peng-yongsheng - */ -public class StorageElasticSearchConfigParser implements ModuleConfigParser { - - private static final String CLUSTER_NAME = "cluster_name"; - private static final String CLUSTER_TRANSPORT_SNIFFER = "cluster_transport_sniffer"; - private static final String CLUSTER_NODES = "cluster_nodes"; - private static final String INDEX_SHARDS_NUMBER = "index_shards_number"; - private static final String INDEX_REPLICAS_NUMBER = "index_replicas_number"; - - @Override public void parse(Map config) throws ConfigParseException { - if (ObjectUtils.isNotEmpty(config) && StringUtils.isNotEmpty(config.get(CLUSTER_NAME))) { - StorageElasticSearchConfig.CLUSTER_NAME = (String)config.get(CLUSTER_NAME); - } - if (ObjectUtils.isNotEmpty(config) && StringUtils.isNotEmpty(config.get(CLUSTER_TRANSPORT_SNIFFER))) { - StorageElasticSearchConfig.CLUSTER_TRANSPORT_SNIFFER = (Boolean)config.get(CLUSTER_TRANSPORT_SNIFFER); - } - if (ObjectUtils.isNotEmpty(config) && StringUtils.isNotEmpty(config.get(CLUSTER_NODES))) { - StorageElasticSearchConfig.CLUSTER_NODES = (String)config.get(CLUSTER_NODES); - } - if (ObjectUtils.isNotEmpty(config) && StringUtils.isNotEmpty(config.get(INDEX_SHARDS_NUMBER))) { - StorageElasticSearchConfig.INDEX_SHARDS_NUMBER = (Integer)config.get(INDEX_SHARDS_NUMBER); - } else { - StorageElasticSearchConfig.INDEX_SHARDS_NUMBER = 2; - } - if (ObjectUtils.isNotEmpty(config) && StringUtils.isNotEmpty(config.get(INDEX_REPLICAS_NUMBER))) { - StorageElasticSearchConfig.INDEX_REPLICAS_NUMBER = (Integer)config.get(INDEX_REPLICAS_NUMBER); - } else { - StorageElasticSearchConfig.INDEX_REPLICAS_NUMBER = 0; - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/elasticsearch/StorageElasticSearchModuleDefine.java b/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/elasticsearch/StorageElasticSearchModuleDefine.java deleted file mode 100644 index 4d38f32410..0000000000 --- a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/elasticsearch/StorageElasticSearchModuleDefine.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.storage.elasticsearch; - -import java.util.List; -import org.skywalking.apm.collector.client.elasticsearch.ElasticSearchClient; -import org.skywalking.apm.collector.core.client.Client; -import org.skywalking.apm.collector.core.framework.DefineException; -import org.skywalking.apm.collector.core.module.ModuleConfigParser; -import org.skywalking.apm.collector.core.storage.StorageInstaller; -import org.skywalking.apm.collector.storage.StorageModuleDefine; -import org.skywalking.apm.collector.storage.StorageModuleGroupDefine; -import org.skywalking.apm.collector.storage.base.dao.DAOContainer; -import org.skywalking.apm.collector.storage.elasticsearch.dao.EsDAO; -import org.skywalking.apm.collector.storage.elasticsearch.dao.EsDAODefineLoader; -import org.skywalking.apm.collector.storage.elasticsearch.define.ElasticSearchStorageInstaller; - -/** - * @author peng-yongsheng - */ -public class StorageElasticSearchModuleDefine extends StorageModuleDefine { - - public static final String MODULE_NAME = "elasticsearch"; - - @Override protected String group() { - return StorageModuleGroupDefine.GROUP_NAME; - } - - @Override public String name() { - return MODULE_NAME; - } - - @Override public final boolean defaultModule() { - return false; - } - - @Override protected ModuleConfigParser configParser() { - return new StorageElasticSearchConfigParser(); - } - - @Override protected Client createClient() { - return new ElasticSearchClient(StorageElasticSearchConfig.CLUSTER_NAME, StorageElasticSearchConfig.CLUSTER_TRANSPORT_SNIFFER, StorageElasticSearchConfig.CLUSTER_NODES); - } - - @Override public StorageInstaller storageInstaller() { - return new ElasticSearchStorageInstaller(); - } - - @Override public void injectClientIntoDAO(Client client) throws DefineException { - EsDAODefineLoader loader = new EsDAODefineLoader(); - List esDAOs = loader.load(); - esDAOs.forEach(esDAO -> { - esDAO.setClient((ElasticSearchClient)client); - String interFaceName = esDAO.getClass().getInterfaces()[0].getName(); - DAOContainer.INSTANCE.put(interFaceName, esDAO); - }); - } -} diff --git a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/elasticsearch/dao/BatchEsDAO.java b/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/elasticsearch/dao/BatchEsDAO.java deleted file mode 100644 index a55a93f9b9..0000000000 --- a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/elasticsearch/dao/BatchEsDAO.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.storage.elasticsearch.dao; - -import java.util.List; -import org.elasticsearch.action.bulk.BulkRequestBuilder; -import org.elasticsearch.action.bulk.BulkResponse; -import org.elasticsearch.action.index.IndexRequestBuilder; -import org.elasticsearch.action.update.UpdateRequestBuilder; -import org.skywalking.apm.collector.core.util.CollectionUtils; -import org.skywalking.apm.collector.storage.base.dao.IBatchDAO; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class BatchEsDAO extends EsDAO implements IBatchDAO { - - private final Logger logger = LoggerFactory.getLogger(BatchEsDAO.class); - - @Override public void batchPersistence(List batchCollection) { - BulkRequestBuilder bulkRequest = getClient().prepareBulk(); - - logger.debug("bulk data size: {}", batchCollection.size()); - if (CollectionUtils.isNotEmpty(batchCollection)) { - for (int i = 0; i < batchCollection.size(); i++) { - Object builder = batchCollection.get(i); - if (builder instanceof IndexRequestBuilder) { - bulkRequest.add((IndexRequestBuilder)builder); - } - if (builder instanceof UpdateRequestBuilder) { - bulkRequest.add((UpdateRequestBuilder)builder); - } - } - - BulkResponse bulkResponse = bulkRequest.execute().actionGet(); - if (bulkResponse.hasFailures()) { - logger.error(bulkResponse.buildFailureMessage()); - } - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/elasticsearch/dao/EsDAO.java b/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/elasticsearch/dao/EsDAO.java deleted file mode 100644 index 3ac9b87170..0000000000 --- a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/elasticsearch/dao/EsDAO.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.storage.elasticsearch.dao; - -import org.elasticsearch.action.search.SearchRequestBuilder; -import org.elasticsearch.action.search.SearchResponse; -import org.elasticsearch.search.aggregations.AggregationBuilders; -import org.elasticsearch.search.aggregations.metrics.max.Max; -import org.elasticsearch.search.aggregations.metrics.max.MaxAggregationBuilder; -import org.elasticsearch.search.aggregations.metrics.min.Min; -import org.elasticsearch.search.aggregations.metrics.min.MinAggregationBuilder; -import org.skywalking.apm.collector.client.elasticsearch.ElasticSearchClient; -import org.skywalking.apm.collector.storage.base.dao.DAO; - -/** - * @author peng-yongsheng - */ -public abstract class EsDAO extends DAO { - - public final int getMaxId(String indexName, String columnName) { - ElasticSearchClient client = getClient(); - SearchRequestBuilder searchRequestBuilder = client.prepareSearch(indexName); - searchRequestBuilder.setTypes("type"); - searchRequestBuilder.setSize(0); - MaxAggregationBuilder aggregation = AggregationBuilders.max("agg").field(columnName); - searchRequestBuilder.addAggregation(aggregation); - - SearchResponse searchResponse = searchRequestBuilder.execute().actionGet(); - Max agg = searchResponse.getAggregations().get("agg"); - - int id = (int)agg.getValue(); - if (id == Integer.MAX_VALUE || id == Integer.MIN_VALUE) { - return 0; - } else { - return id; - } - } - - public final int getMinId(String indexName, String columnName) { - ElasticSearchClient client = getClient(); - SearchRequestBuilder searchRequestBuilder = client.prepareSearch(indexName); - searchRequestBuilder.setTypes("type"); - searchRequestBuilder.setSize(0); - MinAggregationBuilder aggregation = AggregationBuilders.min("agg").field(columnName); - searchRequestBuilder.addAggregation(aggregation); - - SearchResponse searchResponse = searchRequestBuilder.execute().actionGet(); - Min agg = searchResponse.getAggregations().get("agg"); - - int id = (int)agg.getValue(); - if (id == Integer.MAX_VALUE || id == Integer.MIN_VALUE) { - return 0; - } else { - return id; - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/elasticsearch/dao/EsDAODefineLoader.java b/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/elasticsearch/dao/EsDAODefineLoader.java deleted file mode 100644 index ef8712cf8a..0000000000 --- a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/elasticsearch/dao/EsDAODefineLoader.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.storage.elasticsearch.dao; - -import java.util.ArrayList; -import java.util.List; -import org.skywalking.apm.collector.core.framework.DefineException; -import org.skywalking.apm.collector.core.framework.Loader; -import org.skywalking.apm.collector.core.util.DefinitionLoader; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class EsDAODefineLoader implements Loader> { - - private final Logger logger = LoggerFactory.getLogger(EsDAODefineLoader.class); - - @Override public List load() throws DefineException { - List esDAOs = new ArrayList<>(); - - EsDAODefinitionFile definitionFile = new EsDAODefinitionFile(); - logger.info("elasticsearch dao definition file name: {}", definitionFile.fileName()); - DefinitionLoader definitionLoader = DefinitionLoader.load(EsDAO.class, definitionFile); - for (EsDAO dao : definitionLoader) { - logger.info("loaded elasticsearch dao definition class: {}", dao.getClass().getName()); - esDAOs.add(dao); - } - return esDAOs; - } -} diff --git a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/elasticsearch/dao/EsDAODefinitionFile.java b/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/elasticsearch/dao/EsDAODefinitionFile.java deleted file mode 100644 index cf6b088c56..0000000000 --- a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/elasticsearch/dao/EsDAODefinitionFile.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.storage.elasticsearch.dao; - -import org.skywalking.apm.collector.core.framework.DefinitionFile; - -/** - * @author peng-yongsheng - */ -public class EsDAODefinitionFile extends DefinitionFile { - - @Override protected String fileName() { - return "es_dao.define"; - } -} diff --git a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/elasticsearch/define/ElasticSearchColumnDefine.java b/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/elasticsearch/define/ElasticSearchColumnDefine.java deleted file mode 100644 index 7f18932774..0000000000 --- a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/elasticsearch/define/ElasticSearchColumnDefine.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.storage.elasticsearch.define; - -import org.skywalking.apm.collector.core.storage.ColumnDefine; - -/** - * @author peng-yongsheng - */ -public class ElasticSearchColumnDefine extends ColumnDefine { - public ElasticSearchColumnDefine(String name, String type) { - super(name, type); - } - - public enum Type { - Binary, Boolean, Keyword, Long, Integer, Double, Text - } -} diff --git a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/elasticsearch/define/ElasticSearchStorageInstaller.java b/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/elasticsearch/define/ElasticSearchStorageInstaller.java deleted file mode 100644 index b5bf11a5f5..0000000000 --- a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/elasticsearch/define/ElasticSearchStorageInstaller.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.storage.elasticsearch.define; - -import java.io.IOException; -import java.util.List; -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentFactory; -import org.elasticsearch.index.IndexNotFoundException; -import org.skywalking.apm.collector.client.elasticsearch.ElasticSearchClient; -import org.skywalking.apm.collector.core.client.Client; -import org.skywalking.apm.collector.core.storage.ColumnDefine; -import org.skywalking.apm.collector.core.storage.StorageInstaller; -import org.skywalking.apm.collector.core.storage.TableDefine; -import org.skywalking.apm.collector.storage.elasticsearch.StorageElasticSearchConfig; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class ElasticSearchStorageInstaller extends StorageInstaller { - - private final Logger logger = LoggerFactory.getLogger(ElasticSearchStorageInstaller.class); - - @Override protected void defineFilter(List tableDefines) { - int size = tableDefines.size(); - for (int i = size - 1; i >= 0; i--) { - if (!(tableDefines.get(i) instanceof ElasticSearchTableDefine)) { - tableDefines.remove(i); - } - } - } - - @Override protected boolean createTable(Client client, TableDefine tableDefine) { - ElasticSearchClient esClient = (ElasticSearchClient)client; - ElasticSearchTableDefine esTableDefine = (ElasticSearchTableDefine)tableDefine; - // mapping - XContentBuilder mappingBuilder = null; - - Settings settings = createSettingBuilder(esTableDefine); - try { - mappingBuilder = createMappingBuilder(esTableDefine); - logger.info("mapping builder str: {}", mappingBuilder.string()); - } catch (Exception e) { - logger.error("create {} index mapping builder error", esTableDefine.getName()); - } - - boolean isAcknowledged = esClient.createIndex(esTableDefine.getName(), esTableDefine.type(), settings, mappingBuilder); - logger.info("create {} index with type of {} finished, isAcknowledged: {}", esTableDefine.getName(), esTableDefine.type(), isAcknowledged); - return isAcknowledged; - } - - private Settings createSettingBuilder(ElasticSearchTableDefine tableDefine) { - return Settings.builder() - .put("index.number_of_shards", StorageElasticSearchConfig.INDEX_SHARDS_NUMBER) - .put("index.number_of_replicas", StorageElasticSearchConfig.INDEX_REPLICAS_NUMBER) - .put("index.refresh_interval", String.valueOf(tableDefine.refreshInterval()) + "s") - - .put("analysis.analyzer.collector_analyzer.tokenizer", "collector_tokenizer") - .put("analysis.tokenizer.collector_tokenizer.type", "standard") - .put("analysis.tokenizer.collector_tokenizer.max_token_length", 5) - .build(); - } - - private XContentBuilder createMappingBuilder(ElasticSearchTableDefine tableDefine) throws IOException { - XContentBuilder mappingBuilder = XContentFactory.jsonBuilder() - .startObject() - .startObject("properties"); - - for (ColumnDefine columnDefine : tableDefine.getColumnDefines()) { - ElasticSearchColumnDefine elasticSearchColumnDefine = (ElasticSearchColumnDefine)columnDefine; - - if (ElasticSearchColumnDefine.Type.Text.name().toLowerCase().equals(elasticSearchColumnDefine.getType().toLowerCase())) { - mappingBuilder - .startObject(elasticSearchColumnDefine.getName()) - .field("type", elasticSearchColumnDefine.getType().toLowerCase()) - .field("fielddata", true) - .endObject(); - } else { - mappingBuilder - .startObject(elasticSearchColumnDefine.getName()) - .field("type", elasticSearchColumnDefine.getType().toLowerCase()) - .endObject(); - } - } - - mappingBuilder - .endObject() - .endObject(); - logger.debug("create elasticsearch index: {}", mappingBuilder.string()); - return mappingBuilder; - } - - @Override protected boolean deleteTable(Client client, TableDefine tableDefine) { - ElasticSearchClient esClient = (ElasticSearchClient)client; - try { - return esClient.deleteIndex(tableDefine.getName()); - } catch (IndexNotFoundException e) { - logger.info("{} index not found", tableDefine.getName()); - } - return false; - } - - @Override protected boolean isExists(Client client, TableDefine tableDefine) { - ElasticSearchClient esClient = (ElasticSearchClient)client; - return esClient.isExistsIndex(tableDefine.getName()); - } -} diff --git a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/elasticsearch/define/ElasticSearchTableDefine.java b/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/elasticsearch/define/ElasticSearchTableDefine.java deleted file mode 100644 index d7c5c797a2..0000000000 --- a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/elasticsearch/define/ElasticSearchTableDefine.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.storage.elasticsearch.define; - -import org.skywalking.apm.collector.core.storage.TableDefine; - -/** - * @author peng-yongsheng - */ -public abstract class ElasticSearchTableDefine extends TableDefine { - - public ElasticSearchTableDefine(String name) { - super(name); - } - - public final String type() { - return "type"; - } - - public abstract int refreshInterval(); -} diff --git a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/h2/SqlBuilder.java b/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/h2/SqlBuilder.java deleted file mode 100644 index 5d361537ee..0000000000 --- a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/h2/SqlBuilder.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.storage.h2; - -import java.text.MessageFormat; -import java.util.List; -import java.util.Set; - -public class SqlBuilder { - public static String buildSql(String sql, Object... args) { - return MessageFormat.format(sql, args); - } - - public static String buildSql(String sql, List args) { - MessageFormat messageFormat = new MessageFormat(sql); - return messageFormat.format(args.toArray(new Object[0])); - } - - public static String buildBatchInsertSql(String tableName, Set columnNames) { - StringBuilder sb = new StringBuilder("insert into "); - sb.append(tableName).append("("); - columnNames.forEach((columnName) -> sb.append(columnName).append(",")); - sb.delete(sb.length() - 1, sb.length()); - sb.append(") values("); - for (int i = 0; i < columnNames.size(); i++) { - sb.append("?,"); - } - sb.delete(sb.length() - 1, sb.length()); - sb.append(")"); - return sb.toString(); - } - - public static String buildBatchUpdateSql(String tableName, Set columnNames, String whereClauseName) { - StringBuilder sb = new StringBuilder("update "); - sb.append(tableName).append(" set "); - columnNames.forEach((columnName) -> sb.append(columnName).append("=?,")); - sb.delete(sb.length() - 1, sb.length()); - sb.append(" where ").append(whereClauseName).append("=?"); - return sb.toString(); - } -} diff --git a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/h2/StorageH2Config.java b/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/h2/StorageH2Config.java deleted file mode 100644 index a467b9cf41..0000000000 --- a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/h2/StorageH2Config.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.storage.h2; - -/** - * @author clevertension - */ -public class StorageH2Config { - public static String URL; - public static String USER_NAME; - public static String PASSWORD; -} diff --git a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/h2/StorageH2ConfigParser.java b/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/h2/StorageH2ConfigParser.java deleted file mode 100644 index c9685430e0..0000000000 --- a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/h2/StorageH2ConfigParser.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.storage.h2; - -import java.util.Map; -import org.skywalking.apm.collector.core.config.ConfigParseException; -import org.skywalking.apm.collector.core.config.SystemConfig; -import org.skywalking.apm.collector.core.module.ModuleConfigParser; -import org.skywalking.apm.collector.core.util.ObjectUtils; -import org.skywalking.apm.collector.core.util.StringUtils; - -/** - * @author peng-yongsheng - */ -public class StorageH2ConfigParser implements ModuleConfigParser { - private static final String URL = "url"; - public static final String USER_NAME = "user_name"; - public static final String PASSWORD = "password"; - - @Override public void parse(Map config) throws ConfigParseException { - if (ObjectUtils.isNotEmpty(config) && StringUtils.isNotEmpty(config.get(URL))) { - StorageH2Config.URL = (String)config.get(URL); - } else { - StorageH2Config.URL = "jdbc:h2:" + SystemConfig.DATA_PATH + "/h2"; - } - if (ObjectUtils.isNotEmpty(config) && StringUtils.isNotEmpty(config.get(USER_NAME))) { - StorageH2Config.USER_NAME = (String)config.get(USER_NAME); - } else { - StorageH2Config.USER_NAME = "sa"; - } - if (ObjectUtils.isNotEmpty(config) && StringUtils.isNotEmpty(config.get(PASSWORD))) { - StorageH2Config.PASSWORD = (String)config.get(PASSWORD); - } - } -} \ No newline at end of file diff --git a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/h2/StorageH2ModuleDefine.java b/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/h2/StorageH2ModuleDefine.java deleted file mode 100644 index efab1ba6b9..0000000000 --- a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/h2/StorageH2ModuleDefine.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.storage.h2; - -import java.util.List; -import org.skywalking.apm.collector.client.h2.H2Client; -import org.skywalking.apm.collector.core.client.Client; -import org.skywalking.apm.collector.core.framework.DefineException; -import org.skywalking.apm.collector.core.module.ModuleConfigParser; -import org.skywalking.apm.collector.core.storage.StorageInstaller; -import org.skywalking.apm.collector.storage.StorageModuleDefine; -import org.skywalking.apm.collector.storage.StorageModuleGroupDefine; -import org.skywalking.apm.collector.storage.base.dao.DAOContainer; -import org.skywalking.apm.collector.storage.h2.base.dao.H2DAO; -import org.skywalking.apm.collector.storage.h2.base.dao.H2DAODefineLoader; -import org.skywalking.apm.collector.storage.h2.base.define.H2StorageInstaller; - -/** - * @author peng-yongsheng - */ -public class StorageH2ModuleDefine extends StorageModuleDefine { - - public static final String MODULE_NAME = "h2"; - - @Override protected String group() { - return StorageModuleGroupDefine.GROUP_NAME; - } - - @Override public String name() { - return MODULE_NAME; - } - - @Override public final boolean defaultModule() { - return true; - } - - @Override protected ModuleConfigParser configParser() { - return new StorageH2ConfigParser(); - } - - @Override protected Client createClient() { - return new H2Client(StorageH2Config.URL, StorageH2Config.USER_NAME, StorageH2Config.PASSWORD); - } - - @Override public StorageInstaller storageInstaller() { - return new H2StorageInstaller(); - } - - @Override public void injectClientIntoDAO(Client client) throws DefineException { - H2DAODefineLoader loader = new H2DAODefineLoader(); - List h2DAOs = loader.load(); - h2DAOs.forEach(h2DAO -> { - h2DAO.setClient((H2Client)client); - String interFaceName = h2DAO.getClass().getInterfaces()[0].getName(); - DAOContainer.INSTANCE.put(interFaceName, h2DAO); - }); - } -} diff --git a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/h2/dao/BatchH2DAO.java b/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/h2/dao/BatchH2DAO.java deleted file mode 100644 index d921b1d904..0000000000 --- a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/h2/dao/BatchH2DAO.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.storage.h2.base.dao; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.SQLException; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import org.skywalking.apm.collector.client.h2.H2ClientException; -import org.skywalking.apm.collector.storage.base.dao.IBatchDAO; -import org.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class BatchH2DAO extends H2DAO implements IBatchDAO { - private final Logger logger = LoggerFactory.getLogger(BatchH2DAO.class); - - @Override - public void batchPersistence(List batchCollection) { - if (batchCollection != null && batchCollection.size() > 0) { - logger.debug("the batch collection size is {}", batchCollection.size()); - Connection conn; - final Map batchSqls = new HashMap<>(); - try { - conn = getClient().getConnection(); - conn.setAutoCommit(true); - PreparedStatement ps; - for (Object entity : batchCollection) { - H2SqlEntity e = getH2SqlEntity(entity); - String sql = e.getSql(); - if (batchSqls.containsKey(sql)) { - ps = batchSqls.get(sql); - } else { - ps = conn.prepareStatement(sql); - batchSqls.put(sql, ps); - } - - Object[] params = e.getParams(); - if (params != null) { - logger.debug("the sql is {}, params size is {}, params: {}", e.getSql(), params.length, params); - for (int i = 0; i < params.length; i++) { - ps.setObject(i + 1, params[i]); - } - } - ps.addBatch(); - } - - for (String k : batchSqls.keySet()) { - batchSqls.get(k).executeBatch(); - } - } catch (SQLException | H2ClientException e) { - logger.error(e.getMessage(), e); - } - batchSqls.clear(); - } - } - - private H2SqlEntity getH2SqlEntity(Object entity) { - if (entity instanceof H2SqlEntity) { - return (H2SqlEntity)entity; - } - return null; - } -} diff --git a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/h2/dao/H2DAO.java b/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/h2/dao/H2DAO.java deleted file mode 100644 index b73bfa8020..0000000000 --- a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/h2/dao/H2DAO.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.storage.h2.base.dao; - -import java.sql.ResultSet; -import java.sql.SQLException; -import org.skywalking.apm.collector.client.h2.H2Client; -import org.skywalking.apm.collector.client.h2.H2ClientException; -import org.skywalking.apm.collector.storage.base.dao.DAO; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public abstract class H2DAO extends DAO { - private final Logger logger = LoggerFactory.getLogger(H2DAO.class); - - protected final int getMaxId(String tableName, String columnName) { - String sql = "select max(" + columnName + ") from " + tableName; - return getIntValueBySQL(sql); - } - - protected final int getMinId(String tableName, String columnName) { - String sql = "select min(" + columnName + ") from " + tableName; - return getIntValueBySQL(sql); - } - - private int getIntValueBySQL(String sql) { - H2Client client = getClient(); - try (ResultSet rs = client.executeQuery(sql, null)) { - if (rs.next()) { - int id = rs.getInt(1); - if (id == Integer.MAX_VALUE || id == Integer.MIN_VALUE) { - return 0; - } else { - return id; - } - } - } catch (SQLException | H2ClientException e) { - logger.error(e.getMessage(), e); - } - return 0; - } -} diff --git a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/h2/dao/H2DAODefineLoader.java b/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/h2/dao/H2DAODefineLoader.java deleted file mode 100644 index d9495ddede..0000000000 --- a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/h2/dao/H2DAODefineLoader.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.storage.h2.base.dao; - -import java.util.ArrayList; -import java.util.List; -import org.skywalking.apm.collector.core.framework.DefineException; -import org.skywalking.apm.collector.core.framework.Loader; -import org.skywalking.apm.collector.core.util.DefinitionLoader; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class H2DAODefineLoader implements Loader> { - - private final Logger logger = LoggerFactory.getLogger(H2DAODefineLoader.class); - - @Override public List load() throws DefineException { - List h2DAOs = new ArrayList<>(); - - H2DAODefinitionFile definitionFile = new H2DAODefinitionFile(); - logger.info("h2 dao definition file name: {}", definitionFile.fileName()); - DefinitionLoader definitionLoader = DefinitionLoader.load(H2DAO.class, definitionFile); - for (H2DAO dao : definitionLoader) { - logger.info("loaded h2 dao definition class: {}", dao.getClass().getName()); - h2DAOs.add(dao); - } - return h2DAOs; - } -} diff --git a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/h2/dao/H2DAODefinitionFile.java b/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/h2/dao/H2DAODefinitionFile.java deleted file mode 100644 index 9fbbb74642..0000000000 --- a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/h2/dao/H2DAODefinitionFile.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.storage.h2.base.dao; - -import org.skywalking.apm.collector.core.framework.DefinitionFile; - -/** - * @author peng-yongsheng - */ -public class H2DAODefinitionFile extends DefinitionFile { - - @Override protected String fileName() { - return "h2_dao.define"; - } -} diff --git a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/h2/define/H2ColumnDefine.java b/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/h2/define/H2ColumnDefine.java deleted file mode 100644 index 8518316563..0000000000 --- a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/h2/define/H2ColumnDefine.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.storage.h2.base.define; - -import org.skywalking.apm.collector.core.storage.ColumnDefine; - -/** - * @author peng-yongsheng - */ -public class H2ColumnDefine extends ColumnDefine { - - public H2ColumnDefine(String name, String type) { - super(name, type); - } - - public enum Type { - Boolean, Varchar, Int, Bigint, BINARY, Double - } -} diff --git a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/h2/define/H2SqlEntity.java b/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/h2/define/H2SqlEntity.java deleted file mode 100644 index 0818bf9f98..0000000000 --- a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/h2/define/H2SqlEntity.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.storage.h2.base.define; - -/** - * @author clevertension - */ -public class H2SqlEntity { - private String sql; - private Object[] params; - - public String getSql() { - return sql; - } - - public void setSql(String sql) { - this.sql = sql; - } - - public Object[] getParams() { - return params; - } - - public void setParams(Object[] params) { - this.params = params; - } -} diff --git a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/h2/define/H2StorageInstaller.java b/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/h2/define/H2StorageInstaller.java deleted file mode 100644 index 560b16900b..0000000000 --- a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/h2/define/H2StorageInstaller.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.storage.h2.base.define; - -import org.skywalking.apm.collector.client.h2.H2Client; -import org.skywalking.apm.collector.client.h2.H2ClientException; -import org.skywalking.apm.collector.core.client.Client; -import org.skywalking.apm.collector.core.storage.StorageException; -import org.skywalking.apm.collector.core.storage.StorageInstallException; -import org.skywalking.apm.collector.core.storage.StorageInstaller; -import org.skywalking.apm.collector.core.storage.TableDefine; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.List; - -/** - * @author peng-yongsheng - */ -public class H2StorageInstaller extends StorageInstaller { - - private final Logger logger = LoggerFactory.getLogger(H2StorageInstaller.class); - - @Override protected void defineFilter(List tableDefines) { - int size = tableDefines.size(); - for (int i = size - 1; i >= 0; i--) { - if (!(tableDefines.get(i) instanceof H2TableDefine)) { - tableDefines.remove(i); - } - } - } - - @Override protected boolean isExists(Client client, TableDefine tableDefine) throws StorageException { - H2Client h2Client = (H2Client)client; - ResultSet rs = null; - try { - logger.info("check if table {} exist ", tableDefine.getName()); - rs = h2Client.getConnection().getMetaData().getTables(null, null, tableDefine.getName().toUpperCase(), null); - if (rs.next()) { - return true; - } - } catch (SQLException | H2ClientException e) { - throw new StorageInstallException(e.getMessage(), e); - } finally { - try { - if (rs != null) { - rs.close(); - } - } catch (SQLException e) { - throw new StorageInstallException(e.getMessage(), e); - } - } - return false; - } - - @Override protected boolean deleteTable(Client client, TableDefine tableDefine) throws StorageException { - H2Client h2Client = (H2Client)client; - try { - h2Client.execute("drop table if exists " + tableDefine.getName()); - return true; - } catch (H2ClientException e) { - throw new StorageInstallException(e.getMessage(), e); - } - } - - @Override protected boolean createTable(Client client, TableDefine tableDefine) throws StorageException { - H2Client h2Client = (H2Client)client; - H2TableDefine h2TableDefine = (H2TableDefine)tableDefine; - - StringBuilder sqlBuilder = new StringBuilder(); - sqlBuilder.append("CREATE TABLE ").append(h2TableDefine.getName()).append(" ("); - - h2TableDefine.getColumnDefines().forEach(columnDefine -> { - H2ColumnDefine h2ColumnDefine = (H2ColumnDefine)columnDefine; - if (h2ColumnDefine.getType().equals(H2ColumnDefine.Type.Varchar.name())) { - sqlBuilder.append(h2ColumnDefine.getName()).append(" ").append(h2ColumnDefine.getType()).append("(255),"); - } else { - sqlBuilder.append(h2ColumnDefine.getName()).append(" ").append(h2ColumnDefine.getType()).append(","); - } - }); - //remove last comma - sqlBuilder.delete(sqlBuilder.length() - 1, sqlBuilder.length()); - sqlBuilder.append(")"); - try { - logger.info("create h2 table with sql {}", sqlBuilder); - h2Client.execute(sqlBuilder.toString()); - } catch (H2ClientException e) { - throw new StorageInstallException(e.getMessage(), e); - } - return true; - } -} diff --git a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/h2/define/H2TableDefine.java b/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/h2/define/H2TableDefine.java deleted file mode 100644 index 50aefb6f69..0000000000 --- a/apm-collector-3.2.3/apm-collector-storage/src/main/java/org/skywalking/apm/collector/storage/h2/define/H2TableDefine.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.storage.h2.base.define; - -import org.skywalking.apm.collector.core.storage.TableDefine; - -/** - * @author peng-yongsheng - */ -public abstract class H2TableDefine extends TableDefine { - - public H2TableDefine(String name) { - super(name); - } -} diff --git a/apm-collector-3.2.3/apm-collector-storage/src/main/resources/META-INF/defines/es_dao.define b/apm-collector-3.2.3/apm-collector-storage/src/main/resources/META-INF/defines/es_dao.define deleted file mode 100644 index 1fcbc9a034..0000000000 --- a/apm-collector-3.2.3/apm-collector-storage/src/main/resources/META-INF/defines/es_dao.define +++ /dev/null @@ -1 +0,0 @@ -org.skywalking.apm.collector.storage.elasticsearch.dao.BatchEsDAO \ No newline at end of file diff --git a/apm-collector-3.2.3/apm-collector-storage/src/main/resources/META-INF/defines/group.define b/apm-collector-3.2.3/apm-collector-storage/src/main/resources/META-INF/defines/group.define deleted file mode 100644 index 8627ade6b9..0000000000 --- a/apm-collector-3.2.3/apm-collector-storage/src/main/resources/META-INF/defines/group.define +++ /dev/null @@ -1 +0,0 @@ -org.skywalking.apm.collector.storage.StorageModuleGroupDefine \ No newline at end of file diff --git a/apm-collector-3.2.3/apm-collector-storage/src/main/resources/META-INF/defines/h2_dao.define b/apm-collector-3.2.3/apm-collector-storage/src/main/resources/META-INF/defines/h2_dao.define deleted file mode 100644 index 719ee53294..0000000000 --- a/apm-collector-3.2.3/apm-collector-storage/src/main/resources/META-INF/defines/h2_dao.define +++ /dev/null @@ -1 +0,0 @@ -org.skywalking.apm.collector.storage.h2.base.dao.BatchH2DAO \ No newline at end of file diff --git a/apm-collector-3.2.3/apm-collector-storage/src/main/resources/META-INF/defines/module.define b/apm-collector-3.2.3/apm-collector-storage/src/main/resources/META-INF/defines/module.define deleted file mode 100644 index a5844ab39d..0000000000 --- a/apm-collector-3.2.3/apm-collector-storage/src/main/resources/META-INF/defines/module.define +++ /dev/null @@ -1,2 +0,0 @@ -org.skywalking.apm.collector.storage.elasticsearch.StorageElasticSearchModuleDefine -org.skywalking.apm.collector.storage.h2.StorageH2ModuleDefine \ No newline at end of file diff --git a/apm-collector-3.2.3/apm-collector-stream/pom.xml b/apm-collector-3.2.3/apm-collector-stream/pom.xml deleted file mode 100644 index d34062e17c..0000000000 --- a/apm-collector-3.2.3/apm-collector-stream/pom.xml +++ /dev/null @@ -1,65 +0,0 @@ - - - - - - apm-collector-3.2.3 - org.skywalking - 3.2.4-2017 - - 4.0.0 - - apm-collector-3.2.3-stream - jar - - - - org.skywalking - apm-collector-3.2.3-core - ${project.version} - - - org.skywalking - apm-collector-3.2.3-cluster - ${project.version} - - - org.skywalking - apm-collector-3.2.3-queue - ${project.version} - - - org.skywalking - apm-collector-3.2.3-server - ${project.version} - - - org.skywalking - apm-collector-3.2.3-remote - ${project.version} - - - org.skywalking - apm-collector-3.2.3-storage - ${project.version} - - - diff --git a/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/StreamModuleContext.java b/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/StreamModuleContext.java deleted file mode 100644 index a46f291dd2..0000000000 --- a/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/StreamModuleContext.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.stream; - -import java.util.HashMap; -import java.util.Map; -import org.skywalking.apm.collector.core.framework.Context; -import org.skywalking.apm.collector.storage.base.define.DataDefine; -import org.skywalking.apm.collector.stream.worker.ClusterWorkerContext; - -/** - * @author peng-yongsheng - */ -public class StreamModuleContext extends Context { - - private Map dataDefineMap; - private ClusterWorkerContext clusterWorkerContext; - - public StreamModuleContext(String groupName) { - super(groupName); - dataDefineMap = new HashMap<>(); - } - - public void putAllDataDefine(Map dataDefineMap) { - this.dataDefineMap.putAll(dataDefineMap); - } - - public DataDefine getDataDefine(int dataDefineId) { - return this.dataDefineMap.get(dataDefineId); - } - - public ClusterWorkerContext getClusterWorkerContext() { - return clusterWorkerContext; - } - - public void setClusterWorkerContext(ClusterWorkerContext clusterWorkerContext) { - this.clusterWorkerContext = clusterWorkerContext; - } -} diff --git a/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/StreamModuleDefine.java b/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/StreamModuleDefine.java deleted file mode 100644 index 61b8c2a360..0000000000 --- a/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/StreamModuleDefine.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.stream; - -import org.skywalking.apm.collector.core.cluster.ClusterDataListenerDefine; -import org.skywalking.apm.collector.core.module.ModuleDefine; - -/** - * @author peng-yongsheng - */ -public abstract class StreamModuleDefine extends ModuleDefine implements ClusterDataListenerDefine { - - @Override public final boolean defaultModule() { - return true; - } - - @Override protected final void initializeOtherContext() { - - } -} diff --git a/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/StreamModuleException.java b/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/StreamModuleException.java deleted file mode 100644 index bef4d026ff..0000000000 --- a/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/StreamModuleException.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.stream; - -import org.skywalking.apm.collector.core.module.ModuleException; - -/** - * @author peng-yongsheng - */ -public class StreamModuleException extends ModuleException { - - public StreamModuleException(String message) { - super(message); - } - - public StreamModuleException(String message, Throwable cause) { - super(message, cause); - } -} diff --git a/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/StreamModuleGroupDefine.java b/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/StreamModuleGroupDefine.java deleted file mode 100644 index df5dccac7d..0000000000 --- a/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/StreamModuleGroupDefine.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.stream; - -import org.skywalking.apm.collector.core.config.GroupConfigParser; -import org.skywalking.apm.collector.core.framework.Context; -import org.skywalking.apm.collector.core.module.ModuleGroupDefine; -import org.skywalking.apm.collector.core.module.ModuleInstaller; - -/** - * @author peng-yongsheng - */ -public class StreamModuleGroupDefine implements ModuleGroupDefine { - - public static final String GROUP_NAME = "collector_inside"; - private final StreamModuleInstaller installer; - - public StreamModuleGroupDefine() { - installer = new StreamModuleInstaller(); - } - - @Override public String name() { - return GROUP_NAME; - } - - @Override public Context groupContext() { - return new StreamModuleContext(GROUP_NAME); - } - - @Override public ModuleInstaller moduleInstaller() { - return installer; - } - - @Override public GroupConfigParser groupConfigParser() { - return null; - } -} diff --git a/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/StreamModuleInstaller.java b/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/StreamModuleInstaller.java deleted file mode 100644 index b10dc57a3b..0000000000 --- a/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/StreamModuleInstaller.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.stream; - -import java.util.LinkedList; -import java.util.List; -import org.skywalking.apm.collector.core.framework.CollectorContextHelper; -import org.skywalking.apm.collector.core.framework.Context; -import org.skywalking.apm.collector.core.framework.DefineException; -import org.skywalking.apm.collector.core.module.SingleModuleInstaller; -import org.skywalking.apm.collector.queue.QueueModuleGroupDefine; -import org.skywalking.apm.collector.stream.worker.AbstractLocalAsyncWorkerProvider; -import org.skywalking.apm.collector.stream.worker.AbstractRemoteWorkerProvider; -import org.skywalking.apm.collector.stream.worker.ClusterWorkerContext; -import org.skywalking.apm.collector.stream.worker.LocalAsyncWorkerProviderDefineLoader; -import org.skywalking.apm.collector.stream.worker.ProviderNotFoundException; -import org.skywalking.apm.collector.stream.worker.RemoteWorkerProviderDefineLoader; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class StreamModuleInstaller extends SingleModuleInstaller { - - private final Logger logger = LoggerFactory.getLogger(StreamModuleInstaller.class); - - @Override public String groupName() { - return StreamModuleGroupDefine.GROUP_NAME; - } - - @Override public Context moduleContext() { - return new StreamModuleContext(groupName()); - } - - @Override public List dependenceModules() { - List dependenceModules = new LinkedList<>(); - dependenceModules.add(QueueModuleGroupDefine.GROUP_NAME); - return dependenceModules; - } - - @Override public void onAfterInstall() throws DefineException { - initializeWorker((StreamModuleContext)CollectorContextHelper.INSTANCE.getContext(groupName())); - } - - private void initializeWorker(StreamModuleContext context) throws DefineException { - ClusterWorkerContext clusterWorkerContext = new ClusterWorkerContext(); - context.setClusterWorkerContext(clusterWorkerContext); - - LocalAsyncWorkerProviderDefineLoader localAsyncProviderLoader = new LocalAsyncWorkerProviderDefineLoader(); - RemoteWorkerProviderDefineLoader remoteProviderLoader = new RemoteWorkerProviderDefineLoader(); - try { - List localAsyncProviders = localAsyncProviderLoader.load(); - for (AbstractLocalAsyncWorkerProvider provider : localAsyncProviders) { - provider.setClusterContext(clusterWorkerContext); - provider.create(); - clusterWorkerContext.putRole(provider.role()); - } - - List remoteProviders = remoteProviderLoader.load(); - for (AbstractRemoteWorkerProvider provider : remoteProviders) { - provider.setClusterContext(clusterWorkerContext); - clusterWorkerContext.putRole(provider.role()); - clusterWorkerContext.putProvider(provider); - } - } catch (ProviderNotFoundException e) { - logger.error(e.getMessage(), e); - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/grpc/StreamGRPCConfig.java b/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/grpc/StreamGRPCConfig.java deleted file mode 100644 index f104ea3e5a..0000000000 --- a/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/grpc/StreamGRPCConfig.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.stream.grpc; - -/** - * @author peng-yongsheng - */ -public class StreamGRPCConfig { - public static String HOST; - public static int PORT; -} diff --git a/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/grpc/StreamGRPCConfigParser.java b/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/grpc/StreamGRPCConfigParser.java deleted file mode 100644 index 01e5bab3fa..0000000000 --- a/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/grpc/StreamGRPCConfigParser.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.stream.grpc; - -import java.util.Map; -import org.skywalking.apm.collector.core.config.ConfigParseException; -import org.skywalking.apm.collector.core.module.ModuleConfigParser; -import org.skywalking.apm.collector.core.util.ObjectUtils; -import org.skywalking.apm.collector.core.util.StringUtils; - -/** - * @author peng-yongsheng - */ -public class StreamGRPCConfigParser implements ModuleConfigParser { - - private static final String HOST = "host"; - private static final String PORT = "port"; - - @Override public void parse(Map config) throws ConfigParseException { - if (ObjectUtils.isEmpty(config) || StringUtils.isEmpty(config.get(HOST))) { - StreamGRPCConfig.HOST = "localhost"; - } else { - StreamGRPCConfig.HOST = (String)config.get(HOST); - } - - if (ObjectUtils.isEmpty(config) || StringUtils.isEmpty(config.get(PORT))) { - StreamGRPCConfig.PORT = 11800; - } else { - StreamGRPCConfig.PORT = (Integer)config.get(PORT); - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/grpc/StreamGRPCDataListener.java b/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/grpc/StreamGRPCDataListener.java deleted file mode 100644 index e599a3b375..0000000000 --- a/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/grpc/StreamGRPCDataListener.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.stream.grpc; - -import java.util.HashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import org.skywalking.apm.collector.client.grpc.GRPCClient; -import org.skywalking.apm.collector.cluster.ClusterModuleDefine; -import org.skywalking.apm.collector.core.client.ClientException; -import org.skywalking.apm.collector.core.cluster.ClusterDataListener; -import org.skywalking.apm.collector.core.framework.CollectorContextHelper; -import org.skywalking.apm.collector.stream.StreamModuleContext; -import org.skywalking.apm.collector.stream.StreamModuleGroupDefine; -import org.skywalking.apm.collector.stream.worker.RemoteWorkerRef; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class StreamGRPCDataListener extends ClusterDataListener { - - private final Logger logger = LoggerFactory.getLogger(StreamGRPCDataListener.class); - - public static final String PATH = ClusterModuleDefine.BASE_CATALOG + "." + StreamModuleGroupDefine.GROUP_NAME + "." + StreamGRPCModuleDefine.MODULE_NAME; - - @Override public String path() { - return PATH; - } - - private Map clients = new HashMap<>(); - private Map> remoteWorkerRefMap = new HashMap<>(); - - @Override public void serverJoinNotify(String serverAddress) { - String selfAddress = StreamGRPCConfig.HOST + ":" + StreamGRPCConfig.PORT; - StreamModuleContext context = (StreamModuleContext)CollectorContextHelper.INSTANCE.getContext(StreamModuleGroupDefine.GROUP_NAME); - - if (!clients.containsKey(serverAddress)) { - logger.info("new address: {}, create this address remote worker reference", serverAddress); - String[] hostPort = serverAddress.split(":"); - GRPCClient client = new GRPCClient(hostPort[0], Integer.valueOf(hostPort[1])); - try { - client.initialize(); - } catch (ClientException e) { - e.printStackTrace(); - } - clients.put(serverAddress, client); - - if (selfAddress.equals(serverAddress)) { - context.getClusterWorkerContext().getProviders().forEach(provider -> { - logger.info("create remote worker self reference, role: {}", provider.role().roleName()); - provider.create(); - }); - } else { - context.getClusterWorkerContext().getProviders().forEach(provider -> { - logger.info("create remote worker reference, role: {}", provider.role().roleName()); - RemoteWorkerRef remoteWorkerRef = provider.create(client); - if (!remoteWorkerRefMap.containsKey(serverAddress)) { - remoteWorkerRefMap.put(serverAddress, new LinkedList<>()); - } - remoteWorkerRefMap.get(serverAddress).add(remoteWorkerRef); - }); - } - } else { - logger.info("address: {} had remote worker reference, ignore", serverAddress); - } - } - - @Override public void serverQuitNotify(String serverAddress) { - StreamModuleContext context = (StreamModuleContext)CollectorContextHelper.INSTANCE.getContext(StreamModuleGroupDefine.GROUP_NAME); - - if (clients.containsKey(serverAddress)) { - clients.get(serverAddress).shutdown(); - clients.remove(serverAddress); - } - if (remoteWorkerRefMap.containsKey(serverAddress)) { - for (RemoteWorkerRef remoteWorkerRef : remoteWorkerRefMap.get(serverAddress)) { - context.getClusterWorkerContext().remove(remoteWorkerRef); - } - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/grpc/StreamGRPCModuleDefine.java b/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/grpc/StreamGRPCModuleDefine.java deleted file mode 100644 index ba89bab29d..0000000000 --- a/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/grpc/StreamGRPCModuleDefine.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.stream.grpc; - -import java.util.ArrayList; -import java.util.List; -import org.skywalking.apm.collector.core.client.Client; -import org.skywalking.apm.collector.core.cluster.ClusterDataListener; -import org.skywalking.apm.collector.core.framework.Handler; -import org.skywalking.apm.collector.core.module.ModuleConfigParser; -import org.skywalking.apm.collector.core.module.ModuleRegistration; -import org.skywalking.apm.collector.core.server.Server; -import org.skywalking.apm.collector.server.grpc.GRPCServer; -import org.skywalking.apm.collector.stream.StreamModuleDefine; -import org.skywalking.apm.collector.stream.StreamModuleGroupDefine; -import org.skywalking.apm.collector.stream.grpc.handler.RemoteCommonServiceHandler; - -/** - * @author peng-yongsheng - */ -public class StreamGRPCModuleDefine extends StreamModuleDefine { - - public static final String MODULE_NAME = "grpc"; - - @Override public String name() { - return MODULE_NAME; - } - - @Override protected String group() { - return StreamModuleGroupDefine.GROUP_NAME; - } - - @Override protected ModuleConfigParser configParser() { - return new StreamGRPCConfigParser(); - } - - @Override protected Client createClient() { - return null; - } - - @Override protected Server server() { - return new GRPCServer(StreamGRPCConfig.HOST, StreamGRPCConfig.PORT); - } - - @Override protected ModuleRegistration registration() { - return new StreamGRPCModuleRegistration(); - } - - @Override public ClusterDataListener listener() { - return new StreamGRPCDataListener(); - } - - @Override public List handlerList() { - List handlers = new ArrayList<>(); - handlers.add(new RemoteCommonServiceHandler()); - return handlers; - } -} diff --git a/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/grpc/StreamGRPCModuleRegistration.java b/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/grpc/StreamGRPCModuleRegistration.java deleted file mode 100644 index 73a0c390e0..0000000000 --- a/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/grpc/StreamGRPCModuleRegistration.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.stream.grpc; - -import org.skywalking.apm.collector.core.module.ModuleRegistration; - -/** - * @author peng-yongsheng - */ -public class StreamGRPCModuleRegistration extends ModuleRegistration { - - @Override public Value buildValue() { - return new Value(StreamGRPCConfig.HOST, StreamGRPCConfig.PORT, null); - } -} diff --git a/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/grpc/handler/RemoteCommonServiceHandler.java b/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/grpc/handler/RemoteCommonServiceHandler.java deleted file mode 100644 index 6111aa56c2..0000000000 --- a/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/grpc/handler/RemoteCommonServiceHandler.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.stream.grpc.handler; - -import io.grpc.stub.StreamObserver; -import org.skywalking.apm.collector.core.framework.CollectorContextHelper; -import org.skywalking.apm.collector.remote.grpc.proto.Empty; -import org.skywalking.apm.collector.remote.grpc.proto.RemoteCommonServiceGrpc; -import org.skywalking.apm.collector.remote.grpc.proto.RemoteData; -import org.skywalking.apm.collector.remote.grpc.proto.RemoteMessage; -import org.skywalking.apm.collector.server.grpc.GRPCHandler; -import org.skywalking.apm.collector.stream.StreamModuleContext; -import org.skywalking.apm.collector.stream.StreamModuleGroupDefine; -import org.skywalking.apm.collector.stream.worker.Role; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class RemoteCommonServiceHandler extends RemoteCommonServiceGrpc.RemoteCommonServiceImplBase implements GRPCHandler { - - private final Logger logger = LoggerFactory.getLogger(RemoteCommonServiceHandler.class); - - @Override public StreamObserver call(StreamObserver responseObserver) { - return new StreamObserver() { - @Override public void onNext(RemoteMessage message) { - String roleName = message.getWorkerRole(); - RemoteData remoteData = message.getRemoteData(); - - StreamModuleContext context = (StreamModuleContext)CollectorContextHelper.INSTANCE.getContext(StreamModuleGroupDefine.GROUP_NAME); - Role role = context.getClusterWorkerContext().getRole(roleName); - try { - Object object = role.dataDefine().deserialize(remoteData); - context.getClusterWorkerContext().lookupInSide(roleName).tell(object); - } catch (Throwable e) { - logger.error(e.getMessage(), e); - } - } - - @Override public void onError(Throwable throwable) { - logger.error(throwable.getMessage(), throwable); - } - - @Override public void onCompleted() { - responseObserver.onCompleted(); - } - }; - } -} diff --git a/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/AbstractLocalAsyncWorker.java b/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/AbstractLocalAsyncWorker.java deleted file mode 100644 index 48c01a32df..0000000000 --- a/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/AbstractLocalAsyncWorker.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.stream.worker; - -import org.skywalking.apm.collector.core.queue.QueueExecutor; - -/** - * The AbstractLocalAsyncWorker implementations represent workers, - * which receive local asynchronous message. - * - * @author peng-yongsheng - * @since v3.0-2017 - */ -public abstract class AbstractLocalAsyncWorker extends AbstractWorker implements QueueExecutor { - - private LocalAsyncWorkerRef workerRef; - - /** - * Construct an AbstractLocalAsyncWorker with the worker role and context. - * - * @param role The responsibility of worker in cluster, more than one workers can have same responsibility which use - * to provide load balancing ability. - * @param clusterContext See {@link ClusterWorkerContext} - */ - public AbstractLocalAsyncWorker(Role role, ClusterWorkerContext clusterContext) { - super(role, clusterContext); - } - - /** - * The asynchronous worker always use to persistence data into db, this is the end of the streaming, - * so usually no need to create the next worker instance at the time of this worker instance create. - * - * @throws ProviderNotFoundException When worker provider not found, it will be throw this exception. - */ - @Override - public void preStart() throws ProviderNotFoundException { - } - - @Override protected final LocalAsyncWorkerRef getSelf() { - return workerRef; - } - - @Override protected final void putSelfRef(LocalAsyncWorkerRef workerRef) { - this.workerRef = workerRef; - } - - /** - * Receive message - * - * @param message The persistence data or metric data. - * @throws WorkerException The Exception happen in {@link #onWork(Object)} - */ - final public void allocateJob(Object message) throws WorkerException { - onWork(message); - } -} diff --git a/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/AbstractLocalAsyncWorkerProvider.java b/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/AbstractLocalAsyncWorkerProvider.java deleted file mode 100644 index 6fb19621d7..0000000000 --- a/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/AbstractLocalAsyncWorkerProvider.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.stream.worker; - -import org.skywalking.apm.collector.core.framework.CollectorContextHelper; -import org.skywalking.apm.collector.core.queue.QueueCreator; -import org.skywalking.apm.collector.core.queue.QueueEventHandler; -import org.skywalking.apm.collector.core.queue.QueueExecutor; -import org.skywalking.apm.collector.queue.QueueModuleContext; -import org.skywalking.apm.collector.queue.QueueModuleGroupDefine; -import org.skywalking.apm.collector.stream.worker.impl.PersistenceWorker; -import org.skywalking.apm.collector.stream.worker.impl.PersistenceWorkerContainer; - -/** - * @author peng-yongsheng - */ -public abstract class AbstractLocalAsyncWorkerProvider extends AbstractWorkerProvider { - - public abstract int queueSize(); - - @Override final public WorkerRef create() throws ProviderNotFoundException { - T localAsyncWorker = workerInstance(getClusterContext()); - localAsyncWorker.preStart(); - - if (localAsyncWorker instanceof PersistenceWorker) { - PersistenceWorkerContainer.INSTANCE.addWorker((PersistenceWorker)localAsyncWorker); - } - - QueueCreator queueCreator = ((QueueModuleContext)CollectorContextHelper.INSTANCE.getContext(QueueModuleGroupDefine.GROUP_NAME)).getQueueCreator(); - QueueEventHandler queueEventHandler = queueCreator.create(queueSize(), localAsyncWorker); - - LocalAsyncWorkerRef workerRef = new LocalAsyncWorkerRef(role(), queueEventHandler); - getClusterContext().put(workerRef); - localAsyncWorker.putSelfRef(workerRef); - return workerRef; - } -} diff --git a/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/AbstractRemoteWorker.java b/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/AbstractRemoteWorker.java deleted file mode 100644 index 2bf7936c26..0000000000 --- a/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/AbstractRemoteWorker.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.stream.worker; - -/** - * The AbstractRemoteWorker implementations represent workers, - * which receive remote messages. - *

- * Usually, the implementations are doing persistent, or aggregate works. - * - * @author peng-yongsheng - * @since v3.0-2017 - */ -public abstract class AbstractRemoteWorker extends AbstractWorker { - - private RemoteWorkerRef workerRef; - - /** - * Construct an AbstractRemoteWorker with the worker role and context. - * - * @param role If multi-workers are for load balance, they should be more likely called worker instance. Meaning, - * each worker have multi instances. - * @param clusterContext See {@link ClusterWorkerContext} - */ - protected AbstractRemoteWorker(Role role, ClusterWorkerContext clusterContext) { - super(role, clusterContext); - } - - /** - * This method use for message producer to call for send message. - * - * @param message The persistence data or metric data. - * @throws Exception The Exception happen in {@link #onWork(Object)} - */ - final public void allocateJob(Object message) throws WorkerInvokeException { - try { - onWork(message); - } catch (WorkerException e) { - throw new WorkerInvokeException(e.getMessage(), e.getCause()); - } - } - - @Override protected final RemoteWorkerRef getSelf() { - return workerRef; - } - - @Override protected final void putSelfRef(RemoteWorkerRef workerRef) { - this.workerRef = workerRef; - } -} diff --git a/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/AbstractRemoteWorkerProvider.java b/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/AbstractRemoteWorkerProvider.java deleted file mode 100644 index 877d280b06..0000000000 --- a/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/AbstractRemoteWorkerProvider.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.stream.worker; - -import org.skywalking.apm.collector.client.grpc.GRPCClient; - -/** - * The AbstractRemoteWorkerProvider implementations represent providers, - * which create instance of cluster workers whose implemented {@link AbstractRemoteWorker}. - *

- * - * @author peng-yongsheng - * @since v3.0-2017 - */ -public abstract class AbstractRemoteWorkerProvider extends AbstractWorkerProvider { - - /** - * Create the worker instance into akka system, the akka system will control the cluster worker life cycle. - * - * @return The created worker reference. See {@link RemoteWorkerRef} - * @throws ProviderNotFoundException This worker instance attempted to find a provider which use to create another - * worker instance, when the worker provider not find then Throw this Exception. - */ - @Override final public WorkerRef create() { - T clusterWorker = workerInstance(getClusterContext()); - RemoteWorkerRef workerRef = new RemoteWorkerRef(role(), clusterWorker); - getClusterContext().put(workerRef); - return workerRef; - } - - public final RemoteWorkerRef create(GRPCClient client) { - RemoteWorkerRef workerRef = new RemoteWorkerRef(role(), client); - getClusterContext().put(workerRef); - return workerRef; - } -} diff --git a/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/AbstractWorker.java b/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/AbstractWorker.java deleted file mode 100644 index 4f142af228..0000000000 --- a/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/AbstractWorker.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.stream.worker; - -import org.skywalking.apm.collector.core.framework.Executor; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public abstract class AbstractWorker implements Executor { - - private final Logger logger = LoggerFactory.getLogger(AbstractWorker.class); - - private final Role role; - - private final ClusterWorkerContext clusterContext; - - public AbstractWorker(Role role, ClusterWorkerContext clusterContext) { - this.role = role; - this.clusterContext = clusterContext; - } - - @Override public final void execute(Object message) { - try { - onWork(message); - } catch (WorkerException e) { - logger.error(e.getMessage(), e); - } - } - - /** - * The data process logic in this method. - * - * @param message Cast the message object to a expect subclass. - * @throws WorkerException Don't handle the exception, throw it. - */ - protected abstract void onWork(Object message) throws WorkerException; - - public abstract void preStart() throws ProviderNotFoundException; - - final public ClusterWorkerContext getClusterContext() { - return clusterContext; - } - - final public Role getRole() { - return role; - } - - protected abstract S getSelf(); - - protected abstract void putSelfRef(S workerRef); -} diff --git a/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/AbstractWorkerProvider.java b/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/AbstractWorkerProvider.java deleted file mode 100644 index 7868530e61..0000000000 --- a/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/AbstractWorkerProvider.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.stream.worker; - -/** - * @author peng-yongsheng - */ -public abstract class AbstractWorkerProvider implements Provider { - - private ClusterWorkerContext clusterContext; - - public abstract Role role(); - - public abstract T workerInstance(ClusterWorkerContext clusterContext); - - final public void setClusterContext(ClusterWorkerContext clusterContext) { - this.clusterContext = clusterContext; - } - - final protected ClusterWorkerContext getClusterContext() { - return clusterContext; - } -} diff --git a/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/ClusterWorkerContext.java b/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/ClusterWorkerContext.java deleted file mode 100644 index ba51286b13..0000000000 --- a/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/ClusterWorkerContext.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.stream.worker; - -import java.util.ArrayList; -import java.util.List; - -/** - * @author peng-yongsheng - */ -public class ClusterWorkerContext extends WorkerContext { - - private List providers = new ArrayList<>(); - - public List getProviders() { - return providers; - } - - @Override - public void putProvider(AbstractRemoteWorkerProvider provider) { - providers.add(provider); - } -} diff --git a/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/ClusterWorkerRefCounter.java b/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/ClusterWorkerRefCounter.java deleted file mode 100644 index 43ef9db7e8..0000000000 --- a/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/ClusterWorkerRefCounter.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.stream.worker; - -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.atomic.AtomicInteger; - -/** - * @author peng-yongsheng - */ -public enum ClusterWorkerRefCounter { - INSTANCE; - - private Map counter = new ConcurrentHashMap<>(); - - public int incrementAndGet(Role role) { - if (!counter.containsKey(role.roleName())) { - AtomicInteger atomic = new AtomicInteger(0); - counter.putIfAbsent(role.roleName(), atomic); - } - return counter.get(role.roleName()).incrementAndGet(); - } -} diff --git a/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/Context.java b/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/Context.java deleted file mode 100644 index ee33e549fe..0000000000 --- a/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/Context.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.stream.worker; - -/** - * @author peng-yongsheng - */ -public interface Context extends LookUp { - - void putProvider(AbstractRemoteWorkerProvider provider); - - WorkerRefs lookup(Role role) throws WorkerNotFoundException; - - RemoteWorkerRef lookupInSide(String roleName) throws WorkerNotFoundException; - - void put(WorkerRef workerRef); - - void remove(WorkerRef workerRef); -} diff --git a/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/LocalAsyncWorkerProviderDefineLoader.java b/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/LocalAsyncWorkerProviderDefineLoader.java deleted file mode 100644 index d2b8ccf46b..0000000000 --- a/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/LocalAsyncWorkerProviderDefineLoader.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.stream.worker; - -import java.util.ArrayList; -import java.util.List; -import org.skywalking.apm.collector.core.framework.DefineException; -import org.skywalking.apm.collector.core.framework.Loader; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class LocalAsyncWorkerProviderDefineLoader implements Loader> { - - private final Logger logger = LoggerFactory.getLogger(LocalAsyncWorkerProviderDefineLoader.class); - - @Override public List load() throws DefineException { - List providers = new ArrayList<>(); - LocalWorkerProviderDefinitionFile definitionFile = new LocalWorkerProviderDefinitionFile(); - logger.info("local async worker provider definition file name: {}", definitionFile.fileName()); - - DefinitionLoader definitionLoader = DefinitionLoader.load(AbstractLocalAsyncWorkerProvider.class, definitionFile); - - for (AbstractLocalAsyncWorkerProvider provider : definitionLoader) { - logger.info("loaded local async worker provider definition class: {}", provider.getClass().getName()); - providers.add(provider); - } - return providers; - } -} diff --git a/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/LocalAsyncWorkerRef.java b/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/LocalAsyncWorkerRef.java deleted file mode 100644 index 1451a3549a..0000000000 --- a/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/LocalAsyncWorkerRef.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.stream.worker; - -import org.skywalking.apm.collector.core.queue.QueueEventHandler; - -/** - * @author peng-yongsheng - */ -public class LocalAsyncWorkerRef extends WorkerRef { - - private QueueEventHandler queueEventHandler; - - public LocalAsyncWorkerRef(Role role, QueueEventHandler queueEventHandler) { - super(role); - this.queueEventHandler = queueEventHandler; - } - - @Override - public void tell(Object message) throws WorkerInvokeException { - queueEventHandler.tell(message); - } -} diff --git a/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/LocalWorkerProviderDefinitionFile.java b/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/LocalWorkerProviderDefinitionFile.java deleted file mode 100644 index 14f07f4a6b..0000000000 --- a/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/LocalWorkerProviderDefinitionFile.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.stream.worker; - -import org.skywalking.apm.collector.core.framework.DefinitionFile; - -/** - * @author peng-yongsheng - */ -public class LocalWorkerProviderDefinitionFile extends DefinitionFile { - @Override protected String fileName() { - return "local_worker_provider.define"; - } -} diff --git a/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/LookUp.java b/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/LookUp.java deleted file mode 100644 index 8161756b8c..0000000000 --- a/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/LookUp.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.stream.worker; - -/** - * @author peng-yongsheng - */ -public interface LookUp { - - WorkerRefs lookup(Role role) throws WorkerNotFoundException; -} diff --git a/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/Provider.java b/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/Provider.java deleted file mode 100644 index c2a2fa76cc..0000000000 --- a/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/Provider.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.stream.worker; - -/** - * @author peng-yongsheng - */ -public interface Provider { - - WorkerRef create() throws ProviderNotFoundException; -} diff --git a/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/ProviderNotFoundException.java b/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/ProviderNotFoundException.java deleted file mode 100644 index d2ffb44e23..0000000000 --- a/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/ProviderNotFoundException.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.stream.worker; - -public class ProviderNotFoundException extends Exception { - public ProviderNotFoundException(String message) { - super(message); - } -} diff --git a/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/RemoteWorkerProviderDefineLoader.java b/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/RemoteWorkerProviderDefineLoader.java deleted file mode 100644 index fe7eeadb74..0000000000 --- a/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/RemoteWorkerProviderDefineLoader.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.stream.worker; - -import java.util.ArrayList; -import java.util.List; -import org.skywalking.apm.collector.core.framework.DefineException; -import org.skywalking.apm.collector.core.framework.Loader; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class RemoteWorkerProviderDefineLoader implements Loader> { - - private final Logger logger = LoggerFactory.getLogger(RemoteWorkerProviderDefineLoader.class); - - @Override public List load() throws DefineException { - List providers = new ArrayList<>(); - RemoteWorkerProviderDefinitionFile definitionFile = new RemoteWorkerProviderDefinitionFile(); - logger.info("remote worker provider definition file name: {}", definitionFile.fileName()); - - DefinitionLoader definitionLoader = DefinitionLoader.load(AbstractRemoteWorkerProvider.class, definitionFile); - - for (AbstractRemoteWorkerProvider provider : definitionLoader) { - logger.info("loaded remote worker provider definition class: {}", provider.getClass().getName()); - providers.add(provider); - } - return providers; - } -} diff --git a/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/RemoteWorkerProviderDefinitionFile.java b/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/RemoteWorkerProviderDefinitionFile.java deleted file mode 100644 index 96d403ba18..0000000000 --- a/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/RemoteWorkerProviderDefinitionFile.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.stream.worker; - -import org.skywalking.apm.collector.core.framework.DefinitionFile; - -/** - * @author peng-yongsheng - */ -public class RemoteWorkerProviderDefinitionFile extends DefinitionFile { - @Override protected String fileName() { - return "remote_worker_provider.define"; - } -} diff --git a/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/RemoteWorkerRef.java b/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/RemoteWorkerRef.java deleted file mode 100644 index cbb870efd8..0000000000 --- a/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/RemoteWorkerRef.java +++ /dev/null @@ -1,148 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.stream.worker; - -import io.grpc.stub.StreamObserver; -import org.skywalking.apm.collector.client.grpc.GRPCClient; -import org.skywalking.apm.collector.core.util.Const; -import org.skywalking.apm.collector.remote.grpc.proto.Empty; -import org.skywalking.apm.collector.remote.grpc.proto.RemoteCommonServiceGrpc; -import org.skywalking.apm.collector.remote.grpc.proto.RemoteData; -import org.skywalking.apm.collector.remote.grpc.proto.RemoteMessage; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class RemoteWorkerRef extends WorkerRef { - - private final Logger logger = LoggerFactory.getLogger(RemoteWorkerRef.class); - - private final Boolean acrossJVM; - private final RemoteCommonServiceGrpc.RemoteCommonServiceStub stub; - private StreamObserver streamObserver; - private final AbstractRemoteWorker remoteWorker; - private final String address; - - public RemoteWorkerRef(Role role, AbstractRemoteWorker remoteWorker) { - super(role); - this.remoteWorker = remoteWorker; - this.acrossJVM = false; - this.stub = null; - this.address = Const.EMPTY_STRING; - } - - public RemoteWorkerRef(Role role, GRPCClient client) { - super(role); - this.remoteWorker = null; - this.acrossJVM = true; - this.stub = RemoteCommonServiceGrpc.newStub(client.getChannel()); - this.address = client.toString(); - createStreamObserver(); - } - - @Override - public void tell(Object message) throws WorkerInvokeException { - if (acrossJVM) { - try { - RemoteData remoteData = getRole().dataDefine().serialize(message); - RemoteMessage.Builder builder = RemoteMessage.newBuilder(); - builder.setWorkerRole(getRole().roleName()); - builder.setRemoteData(remoteData); - - streamObserver.onNext(builder.build()); - } catch (Throwable e) { - logger.error(e.getMessage(), e); - } - } else { - remoteWorker.allocateJob(message); - } - } - - public Boolean isAcrossJVM() { - return acrossJVM; - } - - private void createStreamObserver() { - StreamStatus status = new StreamStatus(false); - streamObserver = stub.call(new StreamObserver() { - @Override public void onNext(Empty empty) { - } - - @Override public void onError(Throwable throwable) { - logger.error(throwable.getMessage(), throwable); - } - - @Override public void onCompleted() { - status.finished(); - } - }); - } - - class StreamStatus { - private volatile boolean status; - - public StreamStatus(boolean status) { - this.status = status; - } - - public boolean isFinish() { - return status; - } - - public void finished() { - this.status = true; - } - - /** - * @param maxTimeout max wait time, milliseconds. - */ - public void wait4Finish(long maxTimeout) { - long time = 0; - while (!status) { - if (time > maxTimeout) { - break; - } - try2Sleep(5); - time += 5; - } - } - - /** - * Try to sleep, and ignore the {@link InterruptedException} - * - * @param millis the length of time to sleep in milliseconds - */ - private void try2Sleep(long millis) { - try { - Thread.sleep(millis); - } catch (InterruptedException e) { - - } - } - } - - @Override public String toString() { - StringBuilder toString = new StringBuilder(); - toString.append("acrossJVM: ").append(acrossJVM); - toString.append(", address: ").append(address); - return toString.toString(); - } -} diff --git a/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/Role.java b/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/Role.java deleted file mode 100644 index 18ee23768f..0000000000 --- a/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/Role.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.stream.worker; - -import org.skywalking.apm.collector.storage.base.define.DataDefine; -import org.skywalking.apm.collector.stream.worker.selector.WorkerSelector; - -/** - * @author peng-yongsheng - */ -public interface Role { - - String roleName(); - - WorkerSelector workerSelector(); - - DataDefine dataDefine(); -} diff --git a/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/UsedRoleNameException.java b/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/UsedRoleNameException.java deleted file mode 100644 index b77d276bd8..0000000000 --- a/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/UsedRoleNameException.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.stream.worker; - -public class UsedRoleNameException extends Exception { - public UsedRoleNameException(String message) { - super(message); - } -} diff --git a/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/WorkerContext.java b/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/WorkerContext.java deleted file mode 100644 index ba1fd305cf..0000000000 --- a/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/WorkerContext.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.stream.worker; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public abstract class WorkerContext implements Context { - - private final Logger logger = LoggerFactory.getLogger(WorkerContext.class); - - private Map remoteWorkerRefs; - private Map> roleWorkers; - private Map roles; - - WorkerContext() { - this.roleWorkers = new HashMap<>(); - this.roles = new HashMap<>(); - this.remoteWorkerRefs = new HashMap<>(); - } - - private Map> getRoleWorkers() { - return this.roleWorkers; - } - - @Override final public WorkerRefs lookup(Role role) throws WorkerNotFoundException { - if (getRoleWorkers().containsKey(role.roleName())) { - return new WorkerRefs(getRoleWorkers().get(role.roleName()), role.workerSelector()); - } else { - throw new WorkerNotFoundException("role=" + role.roleName() + ", no available worker."); - } - } - - @Override final public RemoteWorkerRef lookupInSide(String roleName) throws WorkerNotFoundException { - if (remoteWorkerRefs.containsKey(roleName)) { - return remoteWorkerRefs.get(roleName); - } else { - throw new WorkerNotFoundException("role=" + roleName + ", no available worker."); - } - } - - public final void putRole(Role role) { - roles.put(role.roleName(), role); - } - - public final Role getRole(String roleName) { - return roles.get(roleName); - } - - @Override final public void put(WorkerRef workerRef) { - logger.debug("put worker reference into context, role name: {}", workerRef.getRole().roleName()); - if (!getRoleWorkers().containsKey(workerRef.getRole().roleName())) { - getRoleWorkers().putIfAbsent(workerRef.getRole().roleName(), new ArrayList<>()); - } - getRoleWorkers().get(workerRef.getRole().roleName()).add(workerRef); - - if (workerRef instanceof RemoteWorkerRef) { - RemoteWorkerRef remoteWorkerRef = (RemoteWorkerRef)workerRef; - if (!remoteWorkerRef.isAcrossJVM()) { - remoteWorkerRefs.put(workerRef.getRole().roleName(), remoteWorkerRef); - } - } - } - - @Override final public void remove(WorkerRef workerRef) { - getRoleWorkers().remove(workerRef.getRole().roleName()); - } -} diff --git a/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/WorkerException.java b/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/WorkerException.java deleted file mode 100644 index dd0de109f4..0000000000 --- a/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/WorkerException.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.stream.worker; - -/** - * Defines a general exception a worker can throw when it - * encounters difficulty. - * - * @author peng-yongsheng - * @since v3.1-2017 - */ -public class WorkerException extends Exception { - - public WorkerException(String message) { - super(message); - } - - public WorkerException(String message, Throwable cause) { - super(message, cause); - } -} diff --git a/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/WorkerInvokeException.java b/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/WorkerInvokeException.java deleted file mode 100644 index cb43be3947..0000000000 --- a/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/WorkerInvokeException.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.stream.worker; - -/** - * This exception is raised when worker fails to process job during "call" or "ask" - * - * @author peng-yongsheng - * @since v3.1-2017 - */ -public class WorkerInvokeException extends WorkerException { - - public WorkerInvokeException(String message) { - super(message); - } - - public WorkerInvokeException(String message, Throwable cause) { - super(message, cause); - } -} diff --git a/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/WorkerNotFoundException.java b/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/WorkerNotFoundException.java deleted file mode 100644 index 14ee398ca0..0000000000 --- a/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/WorkerNotFoundException.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.stream.worker; - -public class WorkerNotFoundException extends WorkerException { - public WorkerNotFoundException(String message) { - super(message); - } -} diff --git a/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/WorkerRef.java b/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/WorkerRef.java deleted file mode 100644 index 959689464d..0000000000 --- a/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/WorkerRef.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.stream.worker; - -/** - * @author peng-yongsheng - */ -public abstract class WorkerRef { - private Role role; - - public WorkerRef(Role role) { - this.role = role; - } - - final public Role getRole() { - return role; - } - - public abstract void tell(Object message) throws WorkerInvokeException; -} diff --git a/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/WorkerRefs.java b/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/WorkerRefs.java deleted file mode 100644 index 0f35a230d6..0000000000 --- a/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/WorkerRefs.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.stream.worker; - -import java.util.List; -import org.skywalking.apm.collector.stream.worker.selector.WorkerSelector; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class WorkerRefs { - - private final Logger logger = LoggerFactory.getLogger(WorkerRefs.class); - - private List workerRefs; - private WorkerSelector workerSelector; - private Role role; - - protected WorkerRefs(List workerRefs, WorkerSelector workerSelector) { - this.workerRefs = workerRefs; - this.workerSelector = workerSelector; - } - - protected WorkerRefs(List workerRefs, WorkerSelector workerSelector, Role role) { - this.workerRefs = workerRefs; - this.workerSelector = workerSelector; - this.role = role; - } - - public void tell(Object message) throws WorkerInvokeException { - logger.debug("WorkerSelector instance of {}", workerSelector.getClass()); - workerRefs.forEach(workerRef -> { - if (workerRef instanceof RemoteWorkerRef) { - logger.debug("message hashcode: {}, select workers: {}", message.hashCode(), workerRef.toString()); - } - }); - workerSelector.select(workerRefs, message).tell(message); - } -} diff --git a/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/impl/AggregationWorker.java b/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/impl/AggregationWorker.java deleted file mode 100644 index 21c480f106..0000000000 --- a/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/impl/AggregationWorker.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.stream.worker.impl; - -import org.skywalking.apm.collector.core.queue.EndOfBatchCommand; -import org.skywalking.apm.collector.core.stream.Data; -import org.skywalking.apm.collector.stream.worker.AbstractLocalAsyncWorker; -import org.skywalking.apm.collector.stream.worker.ClusterWorkerContext; -import org.skywalking.apm.collector.stream.worker.ProviderNotFoundException; -import org.skywalking.apm.collector.stream.worker.Role; -import org.skywalking.apm.collector.stream.worker.WorkerException; -import org.skywalking.apm.collector.stream.worker.WorkerInvokeException; -import org.skywalking.apm.collector.stream.worker.WorkerNotFoundException; -import org.skywalking.apm.collector.stream.worker.WorkerRefs; -import org.skywalking.apm.collector.stream.worker.impl.data.DataCache; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public abstract class AggregationWorker extends AbstractLocalAsyncWorker { - - private final Logger logger = LoggerFactory.getLogger(AggregationWorker.class); - - private DataCache dataCache; - private int messageNum; - - public AggregationWorker(Role role, ClusterWorkerContext clusterContext) { - super(role, clusterContext); - dataCache = new DataCache(); - } - - @Override public void preStart() throws ProviderNotFoundException { - super.preStart(); - } - - @Override protected final void onWork(Object message) throws WorkerException { - if (message instanceof EndOfBatchCommand) { - sendToNext(); - } else { - messageNum++; - aggregate(message); - - if (messageNum >= 100) { - sendToNext(); - messageNum = 0; - } - } - } - - protected abstract WorkerRefs nextWorkRef(String id) throws WorkerNotFoundException; - - private void sendToNext() throws WorkerException { - dataCache.switchPointer(); - while (dataCache.getLast().isWriting()) { - try { - Thread.sleep(10); - } catch (InterruptedException e) { - throw new WorkerException(e.getMessage(), e); - } - } - dataCache.getLast().asMap().forEach((id, data) -> { - try { - logger.debug(data.toString()); - nextWorkRef(id).tell(data); - } catch (WorkerNotFoundException | WorkerInvokeException e) { - logger.error(e.getMessage(), e); - } - }); - dataCache.finishReadingLast(); - } - - protected final void aggregate(Object message) { - Data data = (Data)message; - dataCache.writing(); - if (dataCache.containsKey(data.id())) { - getRole().dataDefine().mergeData(dataCache.get(data.id()), data); - } else { - dataCache.put(data.id(), data); - } - dataCache.finishWriting(); - } -} diff --git a/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/impl/FlushAndSwitch.java b/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/impl/FlushAndSwitch.java deleted file mode 100644 index b6148a7326..0000000000 --- a/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/impl/FlushAndSwitch.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.stream.worker.impl; - -/** - * @author peng-yongsheng - */ -public class FlushAndSwitch { -} diff --git a/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/impl/GRPCRemoteWorker.java b/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/impl/GRPCRemoteWorker.java deleted file mode 100644 index d87e15d6af..0000000000 --- a/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/impl/GRPCRemoteWorker.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.stream.worker.impl; - -import org.skywalking.apm.collector.stream.worker.AbstractRemoteWorker; -import org.skywalking.apm.collector.stream.worker.ClusterWorkerContext; -import org.skywalking.apm.collector.stream.worker.ProviderNotFoundException; -import org.skywalking.apm.collector.stream.worker.Role; -import org.skywalking.apm.collector.stream.worker.WorkerException; - -/** - * @author peng-yongsheng - */ -public class GRPCRemoteWorker extends AbstractRemoteWorker { - - protected GRPCRemoteWorker(Role role, ClusterWorkerContext clusterContext) { - super(role, clusterContext); - } - - @Override public void preStart() throws ProviderNotFoundException { - - } - - @Override protected final void onWork(Object message) throws WorkerException { - - } -} diff --git a/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/impl/PersistenceWorker.java b/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/impl/PersistenceWorker.java deleted file mode 100644 index 4827347a1d..0000000000 --- a/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/impl/PersistenceWorker.java +++ /dev/null @@ -1,154 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.stream.worker.impl; - -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import org.skywalking.apm.collector.core.queue.EndOfBatchCommand; -import org.skywalking.apm.collector.core.stream.Data; -import org.skywalking.apm.collector.core.util.ObjectUtils; -import org.skywalking.apm.collector.storage.base.dao.DAOContainer; -import org.skywalking.apm.collector.storage.base.dao.IBatchDAO; -import org.skywalking.apm.collector.stream.worker.AbstractLocalAsyncWorker; -import org.skywalking.apm.collector.stream.worker.ClusterWorkerContext; -import org.skywalking.apm.collector.stream.worker.ProviderNotFoundException; -import org.skywalking.apm.collector.stream.worker.Role; -import org.skywalking.apm.collector.stream.worker.WorkerException; -import org.skywalking.apm.collector.stream.worker.impl.dao.IPersistenceDAO; -import org.skywalking.apm.collector.stream.worker.impl.data.DataCache; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public abstract class PersistenceWorker extends AbstractLocalAsyncWorker { - - private final Logger logger = LoggerFactory.getLogger(PersistenceWorker.class); - - private DataCache dataCache; - - public PersistenceWorker(Role role, ClusterWorkerContext clusterContext) { - super(role, clusterContext); - dataCache = new DataCache(); - } - - @Override public void preStart() throws ProviderNotFoundException { - super.preStart(); - } - - @Override protected final void onWork(Object message) throws WorkerException { - if (message instanceof FlushAndSwitch) { - try { - if (dataCache.trySwitchPointer()) { - dataCache.switchPointer(); - } - } finally { - dataCache.trySwitchPointerFinally(); - } - } else if (message instanceof EndOfBatchCommand) { - } else { - if (dataCache.currentCollectionSize() >= 5000) { - try { - if (dataCache.trySwitchPointer()) { - dataCache.switchPointer(); - - List collection = buildBatchCollection(); - IBatchDAO dao = (IBatchDAO)DAOContainer.INSTANCE.get(IBatchDAO.class.getName()); - dao.batchPersistence(collection); - } - } finally { - dataCache.trySwitchPointerFinally(); - } - } - aggregate(message); - } - } - - public final List buildBatchCollection() throws WorkerException { - List batchCollection = new LinkedList<>(); - try { - while (dataCache.getLast().isWriting()) { - try { - Thread.sleep(10); - } catch (InterruptedException e) { - logger.warn("thread wake up"); - } - } - - if (dataCache.getLast().asMap() != null) { - batchCollection = prepareBatch(dataCache.getLast().asMap()); - } - } finally { - dataCache.finishReadingLast(); - } - return batchCollection; - } - - protected final List prepareBatch(Map dataMap) { - List insertBatchCollection = new LinkedList<>(); - List updateBatchCollection = new LinkedList<>(); - dataMap.forEach((id, data) -> { - if (needMergeDBData()) { - Data dbData = persistenceDAO().get(id, getRole().dataDefine()); - if (ObjectUtils.isNotEmpty(dbData)) { - getRole().dataDefine().mergeData(data, dbData); - try { - updateBatchCollection.add(persistenceDAO().prepareBatchUpdate(data)); - } catch (Throwable t) { - logger.error(t.getMessage(), t); - } - } else { - try { - insertBatchCollection.add(persistenceDAO().prepareBatchInsert(data)); - } catch (Throwable t) { - logger.error(t.getMessage(), t); - } - } - } else { - try { - insertBatchCollection.add(persistenceDAO().prepareBatchInsert(data)); - } catch (Throwable t) { - logger.error(t.getMessage(), t); - } - } - }); - - insertBatchCollection.addAll(updateBatchCollection); - return insertBatchCollection; - } - - private void aggregate(Object message) { - dataCache.writing(); - Data data = (Data)message; - - if (dataCache.containsKey(data.id())) { - getRole().dataDefine().mergeData(dataCache.get(data.id()), data); - } else { - dataCache.put(data.id(), data); - } - - dataCache.finishWriting(); - } - - protected abstract IPersistenceDAO persistenceDAO(); - - protected abstract boolean needMergeDBData(); -} diff --git a/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/impl/PersistenceWorkerContainer.java b/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/impl/PersistenceWorkerContainer.java deleted file mode 100644 index 9dd5e43300..0000000000 --- a/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/impl/PersistenceWorkerContainer.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.stream.worker.impl; - -import java.util.ArrayList; -import java.util.List; - -/** - * @author peng-yongsheng - */ -public enum PersistenceWorkerContainer { - INSTANCE; - - private List persistenceWorkers = new ArrayList<>(); - - public void addWorker(PersistenceWorker worker) { - persistenceWorkers.add(worker); - } - - public List getPersistenceWorkers() { - return persistenceWorkers; - } -} diff --git a/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/impl/dao/IPersistenceDAO.java b/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/impl/dao/IPersistenceDAO.java deleted file mode 100644 index c25540c1bc..0000000000 --- a/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/impl/dao/IPersistenceDAO.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.stream.worker.impl.dao; - -import org.skywalking.apm.collector.core.stream.Data; -import org.skywalking.apm.collector.storage.base.define.DataDefine; - -/** - * @author peng-yongsheng - */ -public interface IPersistenceDAO { - Data get(String id, DataDefine dataDefine); - - I prepareBatchInsert(Data data); - - U prepareBatchUpdate(Data data); -} diff --git a/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/impl/data/DataCache.java b/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/impl/data/DataCache.java deleted file mode 100644 index 05b70e26b1..0000000000 --- a/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/impl/data/DataCache.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.stream.worker.impl.data; - -import org.skywalking.apm.collector.core.stream.Data; - -/** - * @author peng-yongsheng - */ -public class DataCache extends Window { - - private DataCollection lockedDataCollection; - - public boolean containsKey(String id) { - return lockedDataCollection.containsKey(id); - } - - public Data get(String id) { - return lockedDataCollection.get(id); - } - - public void put(String id, Data data) { - lockedDataCollection.put(id, data); - } - - public void writing() { - lockedDataCollection = getCurrentAndWriting(); - } - - public int currentCollectionSize() { - return getCurrent().size(); - } - - public void finishWriting() { - lockedDataCollection.finishWriting(); - lockedDataCollection = null; - } -} diff --git a/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/impl/data/DataCollection.java b/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/impl/data/DataCollection.java deleted file mode 100644 index cc6b2fcb44..0000000000 --- a/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/impl/data/DataCollection.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.stream.worker.impl.data; - -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; -import org.skywalking.apm.collector.core.stream.Data; - -/** - * @author peng-yongsheng - */ -public class DataCollection { - private Map data; - private volatile boolean writing; - private volatile boolean reading; - - public DataCollection() { - this.data = new ConcurrentHashMap<>(); - this.writing = false; - this.reading = false; - } - - public void finishWriting() { - writing = false; - } - - public void writing() { - writing = true; - } - - public boolean isWriting() { - return writing; - } - - public void finishReading() { - reading = false; - } - - public void reading() { - reading = true; - } - - public boolean isReading() { - return reading; - } - - public boolean containsKey(String key) { - return data.containsKey(key); - } - - public void put(String key, Data value) { - data.put(key, value); - } - - public Data get(String key) { - return data.get(key); - } - - public int size() { - return data.size(); - } - - public void clear() { - data.clear(); - } - - public Map asMap() { - return data; - } -} diff --git a/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/impl/data/Window.java b/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/impl/data/Window.java deleted file mode 100644 index a1b53450ab..0000000000 --- a/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/impl/data/Window.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.stream.worker.impl.data; - -import java.util.concurrent.atomic.AtomicInteger; - -/** - * @author peng-yongsheng - */ -public abstract class Window { - - private AtomicInteger windowSwitch = new AtomicInteger(0); - - private DataCollection pointer; - - private DataCollection windowDataA; - private DataCollection windowDataB; - - public Window() { - windowDataA = new DataCollection(); - windowDataB = new DataCollection(); - pointer = windowDataA; - } - - public boolean trySwitchPointer() { - return windowSwitch.incrementAndGet() == 1 && !getLast().isReading(); - } - - public void trySwitchPointerFinally() { - windowSwitch.addAndGet(-1); - } - - public void switchPointer() { - if (pointer == windowDataA) { - pointer = windowDataB; - } else { - pointer = windowDataA; - } - getLast().reading(); - } - - protected DataCollection getCurrentAndWriting() { - if (pointer == windowDataA) { - windowDataA.writing(); - return windowDataA; - } else { - windowDataB.writing(); - return windowDataB; - } - } - - protected DataCollection getCurrent() { - return pointer; - } - - public DataCollection getLast() { - if (pointer == windowDataA) { - return windowDataB; - } else { - return windowDataA; - } - } - - public void finishReadingLast() { - getLast().clear(); - getLast().finishReading(); - } -} diff --git a/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/selector/ForeverFirstSelector.java b/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/selector/ForeverFirstSelector.java deleted file mode 100644 index c74fa95537..0000000000 --- a/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/selector/ForeverFirstSelector.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.stream.worker.selector; - -import java.util.List; -import org.skywalking.apm.collector.stream.worker.WorkerRef; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class ForeverFirstSelector implements WorkerSelector { - - private final Logger logger = LoggerFactory.getLogger(ForeverFirstSelector.class); - - @Override public WorkerRef select(List members, Object message) { - logger.debug("member size: {}", members.size()); - return members.get(0); - } -} diff --git a/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/selector/HashCodeSelector.java b/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/selector/HashCodeSelector.java deleted file mode 100644 index 6231b7be22..0000000000 --- a/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/selector/HashCodeSelector.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.stream.worker.selector; - -import java.util.List; -import org.skywalking.apm.collector.core.stream.AbstractHashMessage; -import org.skywalking.apm.collector.stream.worker.AbstractWorker; -import org.skywalking.apm.collector.stream.worker.WorkerRef; - -/** - * The HashCodeSelector is a simple implementation of {@link WorkerSelector}. It choose {@link WorkerRef} - * by message {@link AbstractHashMessage} key's hashcode, so it can use to send the same hashcode message to same {@link - * WorkerRef}. Usually, use to database operate which avoid dirty data. - * - * @author peng-yongsheng - * @since v3.0-2017 - */ -public class HashCodeSelector implements WorkerSelector { - - /** - * Use message hashcode to select {@link WorkerRef}. - * - * @param members given {@link WorkerRef} list, which size is greater than 0; - * @param message the {@link AbstractWorker} is going to send. - * @return the selected {@link WorkerRef} - */ - @Override - public WorkerRef select(List members, Object message) { - if (message instanceof AbstractHashMessage) { - AbstractHashMessage hashMessage = (AbstractHashMessage)message; - int size = members.size(); - int selectIndex = Math.abs(hashMessage.getHashCode()) % size; - return members.get(selectIndex); - } else { - throw new IllegalArgumentException("the message send into HashCodeSelector must implementation of AbstractHashMessage, the message object class is: " + message.getClass().getName()); - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/selector/RollingSelector.java b/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/selector/RollingSelector.java deleted file mode 100644 index d13036cafa..0000000000 --- a/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/selector/RollingSelector.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.stream.worker.selector; - -import java.util.List; -import org.skywalking.apm.collector.stream.worker.AbstractWorker; -import org.skywalking.apm.collector.stream.worker.WorkerRef; - -/** - * The RollingSelector is a simple implementation of {@link WorkerSelector}. - * It choose {@link WorkerRef} nearly random, by round-robin. - * - * @author peng-yongsheng - * @since v3.0-2017 - */ -public class RollingSelector implements WorkerSelector { - - private int index = 0; - - /** - * Use round-robin to select {@link WorkerRef}. - * - * @param members given {@link WorkerRef} list, which size is greater than 0; - * @param message message the {@link AbstractWorker} is going to send. - * @return the selected {@link WorkerRef} - */ - @Override - public WorkerRef select(List members, Object message) { - int size = members.size(); - index++; - int selectIndex = Math.abs(index) % size; - return members.get(selectIndex); - } -} diff --git a/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/selector/WorkerSelector.java b/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/selector/WorkerSelector.java deleted file mode 100644 index d8d8389ad3..0000000000 --- a/apm-collector-3.2.3/apm-collector-stream/src/main/java/org/skywalking/apm/collector/stream/worker/selector/WorkerSelector.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.stream.worker.selector; - -import java.util.List; -import org.skywalking.apm.collector.stream.worker.AbstractWorker; -import org.skywalking.apm.collector.stream.worker.WorkerRef; - -/** - * The WorkerSelector should be implemented by any class whose instances - * are intended to provide select a {@link WorkerRef} from a {@link WorkerRef} list. - *

- * Actually, the WorkerRef is designed to provide a routing ability in the collector cluster - * - * @author peng-yongsheng - * @since v3.0-2017 - */ -public interface WorkerSelector { - - /** - * select a {@link WorkerRef} from a {@link WorkerRef} list. - * - * @param members given {@link WorkerRef} list, which size is greater than 0; - * @param message the {@link AbstractWorker} is going to send. - * @return the selected {@link WorkerRef} - */ - T select(List members, Object message); -} diff --git a/apm-collector-3.2.3/apm-collector-stream/src/main/resources/META-INF/defines/group.define b/apm-collector-3.2.3/apm-collector-stream/src/main/resources/META-INF/defines/group.define deleted file mode 100644 index dfcb240580..0000000000 --- a/apm-collector-3.2.3/apm-collector-stream/src/main/resources/META-INF/defines/group.define +++ /dev/null @@ -1 +0,0 @@ -org.skywalking.apm.collector.stream.StreamModuleGroupDefine \ No newline at end of file diff --git a/apm-collector-3.2.3/apm-collector-stream/src/main/resources/META-INF/defines/module.define b/apm-collector-3.2.3/apm-collector-stream/src/main/resources/META-INF/defines/module.define deleted file mode 100644 index b58f3f133a..0000000000 --- a/apm-collector-3.2.3/apm-collector-stream/src/main/resources/META-INF/defines/module.define +++ /dev/null @@ -1 +0,0 @@ -org.skywalking.apm.collector.stream.grpc.StreamGRPCModuleDefine \ No newline at end of file diff --git a/apm-collector-3.2.3/apm-collector-stream/src/test/java/org/skywalking/apm/collector/stream/worker/util/TimeBucketUtilsTestCase.java b/apm-collector-3.2.3/apm-collector-stream/src/test/java/org/skywalking/apm/collector/stream/worker/util/TimeBucketUtilsTestCase.java deleted file mode 100644 index 0e1075d337..0000000000 --- a/apm-collector-3.2.3/apm-collector-stream/src/test/java/org/skywalking/apm/collector/stream/worker/util/TimeBucketUtilsTestCase.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.stream.worker.util; - -import java.util.Calendar; -import java.util.TimeZone; -import org.junit.Assert; -import org.junit.Test; -import org.skywalking.apm.collector.core.util.TimeBucketUtils; - -/** - * @author peng-yongsheng - */ -public class TimeBucketUtilsTestCase { - - @Test - public void testUTCLocation() { - TimeZone.setDefault(TimeZone.getTimeZone("UTC")); - long timeBucket = 201703310915L; - long changedTimeBucket = TimeBucketUtils.INSTANCE.changeToUTCTimeBucket(timeBucket); - Assert.assertEquals(201703310115L, changedTimeBucket); - } - - @Test - public void testUTC8Location() { - TimeZone.setDefault(TimeZone.getTimeZone("GMT+08:00")); - long timeBucket = 201703310915L; - long changedTimeBucket = TimeBucketUtils.INSTANCE.changeToUTCTimeBucket(timeBucket); - Assert.assertEquals(201703310915L, changedTimeBucket); - } - - @Test - public void testGetSecondTimeBucket() { - TimeZone.setDefault(TimeZone.getTimeZone("GMT+08:00")); - long timeBucket = TimeBucketUtils.INSTANCE.getSecondTimeBucket(1490922929258L); - Assert.assertEquals(20170331091529L, timeBucket); - } - - @Test - public void test() { - Calendar calendar = Calendar.getInstance(); - calendar.setTimeInMillis(1490922929258L); - calendar.set(Calendar.SECOND, calendar.get(Calendar.SECOND) - 3); - calendar.set(Calendar.SECOND, calendar.get(Calendar.SECOND) - 2); - calendar.set(Calendar.SECOND, calendar.get(Calendar.SECOND) - 2); - } -} diff --git a/apm-collector-3.2.3/apm-collector-ui/pom.xml b/apm-collector-3.2.3/apm-collector-ui/pom.xml deleted file mode 100644 index afe5bcf0bb..0000000000 --- a/apm-collector-3.2.3/apm-collector-ui/pom.xml +++ /dev/null @@ -1,60 +0,0 @@ - - - - - - apm-collector-3.2.3 - org.skywalking - 3.2.4-2017 - - 4.0.0 - - apm-collector-3.2.3-ui - jar - - - - org.skywalking - apm-collector-3.2.3-core - ${project.version} - - - org.skywalking - apm-collector-3.2.3-cluster - ${project.version} - - - org.skywalking - apm-collector-3.2.3-server - ${project.version} - - - org.skywalking - apm-collector-3.2.3-storage - ${project.version} - - - org.skywalking - apm-collector-3.2.3-cache - ${project.version} - - - diff --git a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/UIModuleContext.java b/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/UIModuleContext.java deleted file mode 100644 index 4be86a4177..0000000000 --- a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/UIModuleContext.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.ui; - -import org.skywalking.apm.collector.core.framework.Context; - -/** - * @author peng-yongsheng - */ -public class UIModuleContext extends Context { - - public UIModuleContext(String groupName) { - super(groupName); - } -} diff --git a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/UIModuleDefine.java b/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/UIModuleDefine.java deleted file mode 100644 index 8abb42cf34..0000000000 --- a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/UIModuleDefine.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.ui; - -import org.skywalking.apm.collector.core.client.Client; -import org.skywalking.apm.collector.core.cluster.ClusterDataListenerDefine; -import org.skywalking.apm.collector.core.module.ModuleDefine; - -/** - * @author peng-yongsheng - */ -public abstract class UIModuleDefine extends ModuleDefine implements ClusterDataListenerDefine { - - @Override protected final Client createClient() { - throw new UnsupportedOperationException(""); - } - - @Override public final boolean defaultModule() { - return true; - } - - @Override protected final void initializeOtherContext() { - - } -} diff --git a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/UIModuleException.java b/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/UIModuleException.java deleted file mode 100644 index 033470bebe..0000000000 --- a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/UIModuleException.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.ui; - -import org.skywalking.apm.collector.core.module.ModuleException; - -/** - * @author peng-yongsheng - */ -public class UIModuleException extends ModuleException { - public UIModuleException(String message) { - super(message); - } - - public UIModuleException(String message, Throwable cause) { - super(message, cause); - } -} diff --git a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/UIModuleGroupDefine.java b/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/UIModuleGroupDefine.java deleted file mode 100644 index ce7123971b..0000000000 --- a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/UIModuleGroupDefine.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.ui; - -import org.skywalking.apm.collector.core.config.GroupConfigParser; -import org.skywalking.apm.collector.core.framework.Context; -import org.skywalking.apm.collector.core.module.ModuleGroupDefine; -import org.skywalking.apm.collector.core.module.ModuleInstaller; - -/** - * @author peng-yongsheng - */ -public class UIModuleGroupDefine implements ModuleGroupDefine { - - public static final String GROUP_NAME = "ui"; - private final UIModuleInstaller installer; - - public UIModuleGroupDefine() { - installer = new UIModuleInstaller(); - } - - @Override public String name() { - return GROUP_NAME; - } - - @Override public Context groupContext() { - return new UIModuleContext(GROUP_NAME); - } - - @Override public ModuleInstaller moduleInstaller() { - return installer; - } - - @Override public GroupConfigParser groupConfigParser() { - return null; - } -} diff --git a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/UIModuleInstaller.java b/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/UIModuleInstaller.java deleted file mode 100644 index 7741dd697d..0000000000 --- a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/UIModuleInstaller.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.ui; - -import java.util.List; -import org.skywalking.apm.collector.core.framework.Context; -import org.skywalking.apm.collector.core.module.MultipleModuleInstaller; - -/** - * @author peng-yongsheng - */ -public class UIModuleInstaller extends MultipleModuleInstaller { - - @Override public String groupName() { - return UIModuleGroupDefine.GROUP_NAME; - } - - @Override public Context moduleContext() { - return new UIModuleContext(groupName()); - } - - @Override public List dependenceModules() { - return null; - } -} diff --git a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/CpuMetricEsDAO.java b/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/CpuMetricEsDAO.java deleted file mode 100644 index 1367f5b09c..0000000000 --- a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/CpuMetricEsDAO.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.ui.dao; - -import com.google.gson.JsonArray; -import org.elasticsearch.action.get.GetResponse; -import org.elasticsearch.action.get.MultiGetItemResponse; -import org.elasticsearch.action.get.MultiGetRequestBuilder; -import org.elasticsearch.action.get.MultiGetResponse; -import org.skywalking.apm.collector.core.util.Const; -import org.skywalking.apm.collector.core.util.TimeBucketUtils; -import org.skywalking.apm.collector.storage.base.define.jvm.CpuMetricTable; -import org.skywalking.apm.collector.storage.elasticsearch.dao.EsDAO; - -/** - * @author peng-yongsheng - */ -public class CpuMetricEsDAO extends EsDAO implements ICpuMetricDAO { - - @Override public int getMetric(int instanceId, long timeBucket) { - String id = timeBucket + Const.ID_SPLIT + instanceId; - GetResponse getResponse = getClient().prepareGet(CpuMetricTable.TABLE, id).get(); - - if (getResponse.isExists()) { - return ((Number)getResponse.getSource().get(CpuMetricTable.COLUMN_USAGE_PERCENT)).intValue(); - } - return 0; - } - - @Override public JsonArray getMetric(int instanceId, long startTimeBucket, long endTimeBucket) { - MultiGetRequestBuilder prepareMultiGet = getClient().prepareMultiGet(); - - long timeBucket = startTimeBucket; - do { - timeBucket = TimeBucketUtils.INSTANCE.addSecondForSecondTimeBucket(TimeBucketUtils.TimeBucketType.SECOND.name(), timeBucket, 1); - String id = timeBucket + Const.ID_SPLIT + instanceId; - prepareMultiGet.add(CpuMetricTable.TABLE, CpuMetricTable.TABLE_TYPE, id); - } - while (timeBucket <= endTimeBucket); - - JsonArray metrics = new JsonArray(); - MultiGetResponse multiGetResponse = prepareMultiGet.get(); - for (MultiGetItemResponse response : multiGetResponse.getResponses()) { - if (response.getResponse().isExists()) { - double cpuUsed = ((Number)response.getResponse().getSource().get(CpuMetricTable.COLUMN_USAGE_PERCENT)).doubleValue(); - metrics.add((int)(cpuUsed * 100)); - } else { - metrics.add(0); - } - } - return metrics; - } -} diff --git a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/CpuMetricH2DAO.java b/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/CpuMetricH2DAO.java deleted file mode 100644 index cb740c0bc9..0000000000 --- a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/CpuMetricH2DAO.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.ui.dao; - -import com.google.gson.JsonArray; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.List; -import org.skywalking.apm.collector.client.h2.H2Client; -import org.skywalking.apm.collector.client.h2.H2ClientException; -import org.skywalking.apm.collector.core.util.Const; -import org.skywalking.apm.collector.core.util.TimeBucketUtils; -import org.skywalking.apm.collector.storage.base.define.jvm.CpuMetricTable; -import org.skywalking.apm.collector.storage.h2.SqlBuilder; -import org.skywalking.apm.collector.storage.h2.base.dao.H2DAO; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng, clevertension - */ -public class CpuMetricH2DAO extends H2DAO implements ICpuMetricDAO { - private final Logger logger = LoggerFactory.getLogger(InstanceH2DAO.class); - private static final String GET_CPU_METRIC_SQL = "select * from {0} where {1} = ?"; - - @Override public int getMetric(int instanceId, long timeBucket) { - String id = timeBucket + Const.ID_SPLIT + instanceId; - H2Client client = getClient(); - String sql = SqlBuilder.buildSql(GET_CPU_METRIC_SQL, CpuMetricTable.TABLE, CpuMetricTable.COLUMN_ID); - Object[] params = new Object[] {id}; - try (ResultSet rs = client.executeQuery(sql, params)) { - if (rs.next()) { - return rs.getInt(CpuMetricTable.COLUMN_USAGE_PERCENT); - } - } catch (SQLException | H2ClientException e) { - logger.error(e.getMessage(), e); - } - return 0; - } - - @Override public JsonArray getMetric(int instanceId, long startTimeBucket, long endTimeBucket) { - H2Client client = getClient(); - String sql = SqlBuilder.buildSql(GET_CPU_METRIC_SQL, CpuMetricTable.TABLE, CpuMetricTable.COLUMN_ID); - - long timeBucket = startTimeBucket; - List idList = new ArrayList<>(); - do { - timeBucket = TimeBucketUtils.INSTANCE.addSecondForSecondTimeBucket(TimeBucketUtils.TimeBucketType.SECOND.name(), timeBucket, 1); - String id = timeBucket + Const.ID_SPLIT + instanceId; - idList.add(id); - } - while (timeBucket <= endTimeBucket); - - JsonArray metrics = new JsonArray(); - idList.forEach(id -> { - try (ResultSet rs = client.executeQuery(sql, new String[] {id})) { - if (rs.next()) { - double cpuUsed = rs.getDouble(CpuMetricTable.COLUMN_USAGE_PERCENT); - metrics.add((int)(cpuUsed * 100)); - } else { - metrics.add(0); - } - } catch (SQLException | H2ClientException e) { - logger.error(e.getMessage(), e); - } - }); - - return metrics; - } -} diff --git a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/GCMetricEsDAO.java b/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/GCMetricEsDAO.java deleted file mode 100644 index e04c33cfde..0000000000 --- a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/GCMetricEsDAO.java +++ /dev/null @@ -1,149 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.ui.dao; - -import com.google.gson.JsonArray; -import com.google.gson.JsonObject; -import org.elasticsearch.action.get.GetResponse; -import org.elasticsearch.action.get.MultiGetItemResponse; -import org.elasticsearch.action.get.MultiGetRequestBuilder; -import org.elasticsearch.action.get.MultiGetResponse; -import org.elasticsearch.action.search.SearchRequestBuilder; -import org.elasticsearch.action.search.SearchResponse; -import org.elasticsearch.action.search.SearchType; -import org.elasticsearch.index.query.BoolQueryBuilder; -import org.elasticsearch.index.query.QueryBuilders; -import org.elasticsearch.search.aggregations.AggregationBuilders; -import org.elasticsearch.search.aggregations.bucket.terms.Terms; -import org.elasticsearch.search.aggregations.metrics.sum.Sum; -import org.skywalking.apm.collector.core.util.Const; -import org.skywalking.apm.collector.core.util.TimeBucketUtils; -import org.skywalking.apm.collector.storage.base.define.jvm.GCMetricTable; -import org.skywalking.apm.collector.storage.elasticsearch.dao.EsDAO; -import org.skywalking.apm.network.proto.GCPhrase; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class GCMetricEsDAO extends EsDAO implements IGCMetricDAO { - - private final Logger logger = LoggerFactory.getLogger(GCMetricEsDAO.class); - - @Override public GCCount getGCCount(long[] timeBuckets, int instanceId) { - logger.debug("get gc count, timeBuckets: {}, instanceId: {}", timeBuckets, instanceId); - SearchRequestBuilder searchRequestBuilder = getClient().prepareSearch(GCMetricTable.TABLE); - searchRequestBuilder.setTypes(GCMetricTable.TABLE_TYPE); - searchRequestBuilder.setSearchType(SearchType.DFS_QUERY_THEN_FETCH); - - BoolQueryBuilder boolQuery = QueryBuilders.boolQuery(); - boolQuery.must().add(QueryBuilders.termQuery(GCMetricTable.COLUMN_INSTANCE_ID, instanceId)); - boolQuery.must().add(QueryBuilders.termsQuery(GCMetricTable.COLUMN_TIME_BUCKET, timeBuckets)); - - searchRequestBuilder.setQuery(boolQuery); - searchRequestBuilder.setSize(0); - searchRequestBuilder.addAggregation( - AggregationBuilders.terms(GCMetricTable.COLUMN_PHRASE).field(GCMetricTable.COLUMN_PHRASE) - .subAggregation(AggregationBuilders.sum(GCMetricTable.COLUMN_COUNT).field(GCMetricTable.COLUMN_COUNT))); - - SearchResponse searchResponse = searchRequestBuilder.execute().actionGet(); - - GCCount gcCount = new GCCount(); - Terms phraseAggregation = searchResponse.getAggregations().get(GCMetricTable.COLUMN_PHRASE); - for (Terms.Bucket phraseBucket : phraseAggregation.getBuckets()) { - int phrase = phraseBucket.getKeyAsNumber().intValue(); - Sum sumAggregation = phraseBucket.getAggregations().get(GCMetricTable.COLUMN_COUNT); - int count = (int)sumAggregation.getValue(); - - if (phrase == GCPhrase.NEW_VALUE) { - gcCount.setYoung(count); - } else if (phrase == GCPhrase.OLD_VALUE) { - gcCount.setOld(count); - } - } - - return gcCount; - } - - @Override public JsonObject getMetric(int instanceId, long timeBucket) { - JsonObject response = new JsonObject(); - - String youngId = timeBucket + Const.ID_SPLIT + GCPhrase.NEW_VALUE + instanceId; - GetResponse youngResponse = getClient().prepareGet(GCMetricTable.TABLE, youngId).get(); - if (youngResponse.isExists()) { - response.addProperty("ygc", ((Number)youngResponse.getSource().get(GCMetricTable.COLUMN_COUNT)).intValue()); - } - - String oldId = timeBucket + Const.ID_SPLIT + GCPhrase.OLD_VALUE + instanceId; - GetResponse oldResponse = getClient().prepareGet(GCMetricTable.TABLE, oldId).get(); - if (oldResponse.isExists()) { - response.addProperty("ogc", ((Number)oldResponse.getSource().get(GCMetricTable.COLUMN_COUNT)).intValue()); - } - - return response; - } - - @Override public JsonObject getMetric(int instanceId, long startTimeBucket, long endTimeBucket) { - JsonObject response = new JsonObject(); - - MultiGetRequestBuilder youngPrepareMultiGet = getClient().prepareMultiGet(); - long timeBucket = startTimeBucket; - do { - timeBucket = TimeBucketUtils.INSTANCE.addSecondForSecondTimeBucket(TimeBucketUtils.TimeBucketType.SECOND.name(), timeBucket, 1); - String youngId = timeBucket + Const.ID_SPLIT + instanceId + Const.ID_SPLIT + GCPhrase.NEW_VALUE; - youngPrepareMultiGet.add(GCMetricTable.TABLE, GCMetricTable.TABLE_TYPE, youngId); - } - while (timeBucket <= endTimeBucket); - - JsonArray youngArray = new JsonArray(); - MultiGetResponse multiGetResponse = youngPrepareMultiGet.get(); - for (MultiGetItemResponse itemResponse : multiGetResponse.getResponses()) { - if (itemResponse.getResponse().isExists()) { - youngArray.add(((Number)itemResponse.getResponse().getSource().get(GCMetricTable.COLUMN_COUNT)).intValue()); - } else { - youngArray.add(0); - } - } - response.add("ygc", youngArray); - - MultiGetRequestBuilder oldPrepareMultiGet = getClient().prepareMultiGet(); - timeBucket = startTimeBucket; - do { - timeBucket = TimeBucketUtils.INSTANCE.addSecondForSecondTimeBucket(TimeBucketUtils.TimeBucketType.SECOND.name(), timeBucket, 1); - String oldId = timeBucket + Const.ID_SPLIT + instanceId + Const.ID_SPLIT + GCPhrase.OLD_VALUE; - oldPrepareMultiGet.add(GCMetricTable.TABLE, GCMetricTable.TABLE_TYPE, oldId); - } - while (timeBucket <= endTimeBucket); - - JsonArray oldArray = new JsonArray(); - - multiGetResponse = oldPrepareMultiGet.get(); - for (MultiGetItemResponse itemResponse : multiGetResponse.getResponses()) { - if (itemResponse.getResponse().isExists()) { - oldArray.add(((Number)itemResponse.getResponse().getSource().get(GCMetricTable.COLUMN_COUNT)).intValue()); - } else { - oldArray.add(0); - } - } - response.add("ogc", oldArray); - - return response; - } -} diff --git a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/GCMetricH2DAO.java b/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/GCMetricH2DAO.java deleted file mode 100644 index 490f83ea0f..0000000000 --- a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/GCMetricH2DAO.java +++ /dev/null @@ -1,154 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.ui.dao; - -import com.google.gson.JsonArray; -import com.google.gson.JsonObject; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.List; -import org.skywalking.apm.collector.client.h2.H2Client; -import org.skywalking.apm.collector.client.h2.H2ClientException; -import org.skywalking.apm.collector.core.util.Const; -import org.skywalking.apm.collector.core.util.TimeBucketUtils; -import org.skywalking.apm.collector.storage.base.define.jvm.GCMetricTable; -import org.skywalking.apm.collector.storage.h2.SqlBuilder; -import org.skywalking.apm.collector.storage.h2.base.dao.H2DAO; -import org.skywalking.apm.network.proto.GCPhrase; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng, clevertension - */ -public class GCMetricH2DAO extends H2DAO implements IGCMetricDAO { - private final Logger logger = LoggerFactory.getLogger(GCMetricH2DAO.class); - private static final String GET_GC_COUNT_SQL = "select {1}, sum({0}) as cnt, {1} from {2} where {3} = ? and {4} in ("; - private static final String GET_GC_METRIC_SQL = "select * from {0} where {1} = ?"; - - @Override public GCCount getGCCount(long[] timeBuckets, int instanceId) { - GCCount gcCount = new GCCount(); - H2Client client = getClient(); - String sql = GET_GC_COUNT_SQL; - StringBuilder builder = new StringBuilder(); - - for (int i = 0; i < timeBuckets.length; i++) { - builder.append("?,"); - } - builder.delete(builder.length() - 1, builder.length()); - builder.append(")"); - sql = sql + builder + " group by {1}"; - sql = SqlBuilder.buildSql(sql, GCMetricTable.COLUMN_COUNT, GCMetricTable.COLUMN_PHRASE, - GCMetricTable.TABLE, GCMetricTable.COLUMN_INSTANCE_ID, GCMetricTable.COLUMN_ID); - Object[] params = new Object[timeBuckets.length + 1]; - for (int i = 0; i < timeBuckets.length; i++) { - params[i + 1] = timeBuckets[i]; - } - params[0] = instanceId; - try (ResultSet rs = client.executeQuery(sql, params)) { - if (rs.next()) { - int phrase = rs.getInt(GCMetricTable.COLUMN_PHRASE); - int count = rs.getInt("cnt"); - - if (phrase == GCPhrase.NEW_VALUE) { - gcCount.setYoung(count); - } else if (phrase == GCPhrase.OLD_VALUE) { - gcCount.setOld(count); - } - } - } catch (SQLException | H2ClientException e) { - logger.error(e.getMessage(), e); - } - return gcCount; - } - - @Override public JsonObject getMetric(int instanceId, long timeBucket) { - JsonObject response = new JsonObject(); - H2Client client = getClient(); - String sql = SqlBuilder.buildSql(GET_GC_METRIC_SQL, GCMetricTable.TABLE, GCMetricTable.COLUMN_ID); - String youngId = timeBucket + Const.ID_SPLIT + GCPhrase.NEW_VALUE + instanceId; - Object[] params = new Object[] {youngId}; - try (ResultSet rs = client.executeQuery(sql, params)) { - if (rs.next()) { - response.addProperty("ygc", rs.getInt(GCMetricTable.COLUMN_COUNT)); - } - } catch (SQLException | H2ClientException e) { - logger.error(e.getMessage(), e); - } - String oldId = timeBucket + Const.ID_SPLIT + GCPhrase.OLD_VALUE + instanceId; - Object[] params1 = new Object[] {oldId}; - try (ResultSet rs = client.executeQuery(sql, params1)) { - if (rs.next()) { - response.addProperty("ogc", rs.getInt(GCMetricTable.COLUMN_COUNT)); - } - } catch (SQLException | H2ClientException e) { - logger.error(e.getMessage(), e); - } - - return response; - } - - @Override public JsonObject getMetric(int instanceId, long startTimeBucket, long endTimeBucket) { - JsonObject response = new JsonObject(); - H2Client client = getClient(); - String sql = SqlBuilder.buildSql(GET_GC_METRIC_SQL, GCMetricTable.TABLE, GCMetricTable.COLUMN_ID); - long timeBucket = startTimeBucket; - List youngIdsList = new ArrayList<>(); - do { - timeBucket = TimeBucketUtils.INSTANCE.addSecondForSecondTimeBucket(TimeBucketUtils.TimeBucketType.SECOND.name(), timeBucket, 1); - String youngId = timeBucket + Const.ID_SPLIT + instanceId + Const.ID_SPLIT + GCPhrase.NEW_VALUE; - youngIdsList.add(youngId); - } - while (timeBucket <= endTimeBucket); - - JsonArray youngArray = new JsonArray(); - forEachRs(client, youngIdsList, sql, youngArray); - response.add("ygc", youngArray); - - List oldIdsList = new ArrayList<>(); - timeBucket = startTimeBucket; - do { - timeBucket = TimeBucketUtils.INSTANCE.addSecondForSecondTimeBucket(TimeBucketUtils.TimeBucketType.SECOND.name(), timeBucket, 1); - String oldId = timeBucket + Const.ID_SPLIT + instanceId + Const.ID_SPLIT + GCPhrase.OLD_VALUE; - oldIdsList.add(oldId); - } - while (timeBucket <= endTimeBucket); - - JsonArray oldArray = new JsonArray(); - forEachRs(client, oldIdsList, sql, oldArray); - response.add("ogc", oldArray); - - return response; - } - - private void forEachRs(H2Client client, List idsList, String sql, JsonArray metricArray) { - idsList.forEach(id -> { - try (ResultSet rs = client.executeQuery(sql, new String[] {id})) { - if (rs.next()) { - metricArray.add(rs.getInt(GCMetricTable.COLUMN_COUNT)); - } else { - metricArray.add(0); - } - } catch (SQLException | H2ClientException e) { - logger.error(e.getMessage(), e); - } - }); - } -} diff --git a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/GlobalTraceEsDAO.java b/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/GlobalTraceEsDAO.java deleted file mode 100644 index b26333e687..0000000000 --- a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/GlobalTraceEsDAO.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.ui.dao; - -import java.util.ArrayList; -import java.util.List; -import org.elasticsearch.action.search.SearchRequestBuilder; -import org.elasticsearch.action.search.SearchResponse; -import org.elasticsearch.action.search.SearchType; -import org.elasticsearch.index.query.QueryBuilders; -import org.elasticsearch.search.SearchHit; -import org.skywalking.apm.collector.storage.base.define.global.GlobalTraceTable; -import org.skywalking.apm.collector.storage.elasticsearch.dao.EsDAO; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class GlobalTraceEsDAO extends EsDAO implements IGlobalTraceDAO { - - private final Logger logger = LoggerFactory.getLogger(GlobalTraceEsDAO.class); - - @Override public List getGlobalTraceId(String segmentId) { - SearchRequestBuilder searchRequestBuilder = getClient().prepareSearch(GlobalTraceTable.TABLE); - searchRequestBuilder.setTypes(GlobalTraceTable.TABLE_TYPE); - searchRequestBuilder.setSearchType(SearchType.DFS_QUERY_THEN_FETCH); - searchRequestBuilder.setQuery(QueryBuilders.termQuery(GlobalTraceTable.COLUMN_SEGMENT_ID, segmentId)); - searchRequestBuilder.setSize(10); - - SearchResponse searchResponse = searchRequestBuilder.execute().actionGet(); - - List globalTraceIds = new ArrayList<>(); - SearchHit[] searchHits = searchResponse.getHits().getHits(); - for (SearchHit searchHit : searchHits) { - String globalTraceId = (String)searchHit.getSource().get(GlobalTraceTable.COLUMN_GLOBAL_TRACE_ID); - logger.debug("segmentId: {}, global trace id: {}", segmentId, globalTraceId); - globalTraceIds.add(globalTraceId); - } - return globalTraceIds; - } - - @Override public List getSegmentIds(String globalTraceId) { - SearchRequestBuilder searchRequestBuilder = getClient().prepareSearch(GlobalTraceTable.TABLE); - searchRequestBuilder.setTypes(GlobalTraceTable.TABLE_TYPE); - searchRequestBuilder.setSearchType(SearchType.DFS_QUERY_THEN_FETCH); - searchRequestBuilder.setQuery(QueryBuilders.termQuery(GlobalTraceTable.COLUMN_GLOBAL_TRACE_ID, globalTraceId)); - searchRequestBuilder.setSize(10); - - SearchResponse searchResponse = searchRequestBuilder.execute().actionGet(); - - List segmentIds = new ArrayList<>(); - SearchHit[] searchHits = searchResponse.getHits().getHits(); - for (SearchHit searchHit : searchHits) { - String segmentId = (String)searchHit.getSource().get(GlobalTraceTable.COLUMN_SEGMENT_ID); - logger.debug("segmentId: {}, global trace id: {}", segmentId, globalTraceId); - segmentIds.add(segmentId); - } - return segmentIds; - } -} diff --git a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/GlobalTraceH2DAO.java b/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/GlobalTraceH2DAO.java deleted file mode 100644 index 1092843ae3..0000000000 --- a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/GlobalTraceH2DAO.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.ui.dao; - -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.List; - -import org.skywalking.apm.collector.client.h2.H2Client; -import org.skywalking.apm.collector.client.h2.H2ClientException; -import org.skywalking.apm.collector.storage.base.define.global.GlobalTraceTable; -import org.skywalking.apm.collector.storage.h2.SqlBuilder; -import org.skywalking.apm.collector.storage.h2.base.dao.H2DAO; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng, clevertension - */ -public class GlobalTraceH2DAO extends H2DAO implements IGlobalTraceDAO { - private final Logger logger = LoggerFactory.getLogger(GlobalTraceH2DAO.class); - private static final String GET_GLOBAL_TRACE_ID_SQL = "select {0} from {1} where {2} = ? limit 10"; - private static final String GET_SEGMENT_IDS_SQL = "select {0} from {1} where {2} = ? limit 10"; - @Override public List getGlobalTraceId(String segmentId) { - List globalTraceIds = new ArrayList<>(); - H2Client client = getClient(); - String sql = SqlBuilder.buildSql(GET_GLOBAL_TRACE_ID_SQL, GlobalTraceTable.COLUMN_GLOBAL_TRACE_ID, - GlobalTraceTable.TABLE, GlobalTraceTable.COLUMN_SEGMENT_ID); - Object[] params = new Object[]{segmentId}; - try (ResultSet rs = client.executeQuery(sql, params)) { - while (rs.next()) { - String globalTraceId = rs.getString(GlobalTraceTable.COLUMN_GLOBAL_TRACE_ID); - logger.debug("segmentId: {}, global trace id: {}", segmentId, globalTraceId); - globalTraceIds.add(globalTraceId); - } - } catch (SQLException | H2ClientException e) { - logger.error(e.getMessage(), e); - } - return globalTraceIds; - } - - @Override public List getSegmentIds(String globalTraceId) { - List segmentIds = new ArrayList<>(); - H2Client client = getClient(); - String sql = SqlBuilder.buildSql(GET_SEGMENT_IDS_SQL, GlobalTraceTable.COLUMN_SEGMENT_ID, - GlobalTraceTable.TABLE, GlobalTraceTable.COLUMN_GLOBAL_TRACE_ID); - Object[] params = new Object[]{globalTraceId}; - try (ResultSet rs = client.executeQuery(sql, params)) { - while (rs.next()) { - String segmentId = rs.getString(GlobalTraceTable.COLUMN_SEGMENT_ID); - logger.debug("segmentId: {}, global trace id: {}", segmentId, globalTraceId); - segmentIds.add(segmentId); - } - } catch (SQLException | H2ClientException e) { - logger.error(e.getMessage(), e); - } - return segmentIds; - } -} diff --git a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/ICpuMetricDAO.java b/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/ICpuMetricDAO.java deleted file mode 100644 index 0f58c7d87d..0000000000 --- a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/ICpuMetricDAO.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.ui.dao; - -import com.google.gson.JsonArray; - -/** - * @author peng-yongsheng - */ -public interface ICpuMetricDAO { - int getMetric(int instanceId, long timeBucket); - - JsonArray getMetric(int instanceId, long startTimeBucket, long endTimeBucket); -} diff --git a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/IGCMetricDAO.java b/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/IGCMetricDAO.java deleted file mode 100644 index dd6e187f54..0000000000 --- a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/IGCMetricDAO.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.ui.dao; - -import com.google.gson.JsonObject; - -/** - * @author peng-yongsheng - */ -public interface IGCMetricDAO { - - GCCount getGCCount(long[] timeBuckets, int instanceId); - - JsonObject getMetric(int instanceId, long timeBucket); - - JsonObject getMetric(int instanceId, long startTimeBucket, long endTimeBucket); - - class GCCount { - private int young; - private int old; - private int full; - - public int getYoung() { - return young; - } - - public int getOld() { - return old; - } - - public int getFull() { - return full; - } - - public void setYoung(int young) { - this.young = young; - } - - public void setOld(int old) { - this.old = old; - } - - public void setFull(int full) { - this.full = full; - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/IGlobalTraceDAO.java b/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/IGlobalTraceDAO.java deleted file mode 100644 index 6e98e8cf4c..0000000000 --- a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/IGlobalTraceDAO.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.ui.dao; - -import java.util.List; - -/** - * @author peng-yongsheng - */ -public interface IGlobalTraceDAO { - List getGlobalTraceId(String segmentId); - - List getSegmentIds(String globalTraceId); -} diff --git a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/IInstPerformanceDAO.java b/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/IInstPerformanceDAO.java deleted file mode 100644 index c4d1346901..0000000000 --- a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/IInstPerformanceDAO.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.ui.dao; - -import com.google.gson.JsonArray; - -/** - * @author peng-yongsheng - */ -public interface IInstPerformanceDAO { - InstPerformance get(long[] timeBuckets, int instanceId); - - int getTpsMetric(int instanceId, long timeBucket); - - JsonArray getTpsMetric(int instanceId, long startTimeBucket, long endTimeBucket); - - int getRespTimeMetric(int instanceId, long timeBucket); - - JsonArray getRespTimeMetric(int instanceId, long startTimeBucket, long endTimeBucket); - - class InstPerformance { - private final int instanceId; - private final int calls; - private final long costTotal; - - public InstPerformance(int instanceId, int calls, long costTotal) { - this.instanceId = instanceId; - this.calls = calls; - this.costTotal = costTotal; - } - - public int getInstanceId() { - return instanceId; - } - - public int getCalls() { - return calls; - } - - public long getCostTotal() { - return costTotal; - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/IInstanceDAO.java b/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/IInstanceDAO.java deleted file mode 100644 index ff5bc58fa8..0000000000 --- a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/IInstanceDAO.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.ui.dao; - -import com.google.gson.JsonArray; -import java.util.List; -import org.skywalking.apm.collector.storage.base.define.register.InstanceDataDefine; - -/** - * @author peng-yongsheng - */ -public interface IInstanceDAO { - Long lastHeartBeatTime(); - - Long instanceLastHeartBeatTime(long applicationInstanceId); - - JsonArray getApplications(long startTime, long endTime); - - InstanceDataDefine.Instance getInstance(int instanceId); - - List getInstances(int applicationId, long timeBucket); - - class Application { - private final int applicationId; - private final long count; - - public Application(int applicationId, long count) { - this.applicationId = applicationId; - this.count = count; - } - - public int getApplicationId() { - return applicationId; - } - - public long getCount() { - return count; - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/IMemoryMetricDAO.java b/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/IMemoryMetricDAO.java deleted file mode 100644 index 14195d320f..0000000000 --- a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/IMemoryMetricDAO.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.ui.dao; - -import com.google.gson.JsonObject; - -/** - * @author peng-yongsheng - */ -public interface IMemoryMetricDAO { - JsonObject getMetric(int instanceId, long timeBucket, boolean isHeap); - - JsonObject getMetric(int instanceId, long startTimeBucket, long endTimeBucket, boolean isHeap); -} diff --git a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/IMemoryPoolMetricDAO.java b/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/IMemoryPoolMetricDAO.java deleted file mode 100644 index c35bae58eb..0000000000 --- a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/IMemoryPoolMetricDAO.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.ui.dao; - -import com.google.gson.JsonObject; - -/** - * @author peng-yongsheng - */ -public interface IMemoryPoolMetricDAO { - JsonObject getMetric(int instanceId, long timeBucket, int poolType); - - JsonObject getMetric(int instanceId, long startTimeBucket, long endTimeBucket, int poolType); -} diff --git a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/INodeComponentDAO.java b/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/INodeComponentDAO.java deleted file mode 100644 index ef944e89c4..0000000000 --- a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/INodeComponentDAO.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.ui.dao; - -import com.google.gson.JsonArray; - -/** - * @author peng-yongsheng - */ -public interface INodeComponentDAO { - JsonArray load(long startTime, long endTime); -} diff --git a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/INodeMappingDAO.java b/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/INodeMappingDAO.java deleted file mode 100644 index c05a7563f6..0000000000 --- a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/INodeMappingDAO.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.ui.dao; - -import com.google.gson.JsonArray; - -/** - * @author peng-yongsheng - */ -public interface INodeMappingDAO { - JsonArray load(long startTime, long endTime); -} diff --git a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/INodeReferenceDAO.java b/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/INodeReferenceDAO.java deleted file mode 100644 index 8237e28d08..0000000000 --- a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/INodeReferenceDAO.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.ui.dao; - -import com.google.gson.JsonArray; - -/** - * @author peng-yongsheng - */ -public interface INodeReferenceDAO { - JsonArray load(long startTime, long endTime); -} diff --git a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/ISegmentCostDAO.java b/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/ISegmentCostDAO.java deleted file mode 100644 index 15d7ebf7f1..0000000000 --- a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/ISegmentCostDAO.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.ui.dao; - -import com.google.gson.JsonObject; -import java.util.List; - -/** - * @author peng-yongsheng - */ -public interface ISegmentCostDAO { - JsonObject loadTop(long startTime, long endTime, long minCost, long maxCost, String operationName, - Error error, int applicationId, List segmentIds, int limit, int from, Sort sort); - - enum Sort { - Cost, Time - } - - enum Error { - All, True, False - } -} diff --git a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/ISegmentDAO.java b/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/ISegmentDAO.java deleted file mode 100644 index 6bd9b6ea50..0000000000 --- a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/ISegmentDAO.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.ui.dao; - -import org.skywalking.apm.network.proto.TraceSegmentObject; - -/** - * @author peng-yongsheng - */ -public interface ISegmentDAO { - TraceSegmentObject load(String segmentId); -} diff --git a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/IServiceEntryDAO.java b/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/IServiceEntryDAO.java deleted file mode 100644 index 7b0926cab9..0000000000 --- a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/IServiceEntryDAO.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.ui.dao; - -import com.google.gson.JsonObject; - -/** - * @author peng-yongsheng - */ -public interface IServiceEntryDAO { - JsonObject load(int applicationId, String entryServiceName, long startTime, long endTime, int from, int size); -} diff --git a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/IServiceReferenceDAO.java b/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/IServiceReferenceDAO.java deleted file mode 100644 index bd064745a3..0000000000 --- a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/IServiceReferenceDAO.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.ui.dao; - -import com.google.gson.JsonObject; -import java.util.Map; - -/** - * @author peng-yongsheng - */ -public interface IServiceReferenceDAO { - Map load(int entryServiceId, long startTime, long endTime); -} diff --git a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/InstPerformanceEsDAO.java b/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/InstPerformanceEsDAO.java deleted file mode 100644 index 4cd08faf53..0000000000 --- a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/InstPerformanceEsDAO.java +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.ui.dao; - -import com.google.gson.JsonArray; -import org.elasticsearch.action.get.GetResponse; -import org.elasticsearch.action.get.MultiGetItemResponse; -import org.elasticsearch.action.get.MultiGetRequestBuilder; -import org.elasticsearch.action.get.MultiGetResponse; -import org.elasticsearch.action.search.SearchRequestBuilder; -import org.elasticsearch.action.search.SearchResponse; -import org.elasticsearch.action.search.SearchType; -import org.elasticsearch.index.query.BoolQueryBuilder; -import org.elasticsearch.index.query.QueryBuilders; -import org.elasticsearch.search.aggregations.AggregationBuilders; -import org.elasticsearch.search.aggregations.metrics.sum.Sum; -import org.elasticsearch.search.sort.SortOrder; -import org.skywalking.apm.collector.core.util.Const; -import org.skywalking.apm.collector.core.util.TimeBucketUtils; -import org.skywalking.apm.collector.storage.base.define.instance.InstPerformanceTable; -import org.skywalking.apm.collector.storage.elasticsearch.dao.EsDAO; - -/** - * @author peng-yongsheng - */ -public class InstPerformanceEsDAO extends EsDAO implements IInstPerformanceDAO { - - @Override public InstPerformance get(long[] timeBuckets, int instanceId) { - SearchRequestBuilder searchRequestBuilder = getClient().prepareSearch(InstPerformanceTable.TABLE); - searchRequestBuilder.setTypes(InstPerformanceTable.TABLE_TYPE); - searchRequestBuilder.setSearchType(SearchType.DFS_QUERY_THEN_FETCH); - - BoolQueryBuilder boolQuery = QueryBuilders.boolQuery(); - boolQuery.must().add(QueryBuilders.termQuery(InstPerformanceTable.COLUMN_INSTANCE_ID, instanceId)); - boolQuery.must().add(QueryBuilders.termsQuery(InstPerformanceTable.COLUMN_TIME_BUCKET, timeBuckets)); - - searchRequestBuilder.setQuery(boolQuery); - searchRequestBuilder.setSize(0); - searchRequestBuilder.addSort(InstPerformanceTable.COLUMN_INSTANCE_ID, SortOrder.ASC); - - searchRequestBuilder.addAggregation(AggregationBuilders.sum(InstPerformanceTable.COLUMN_CALLS).field(InstPerformanceTable.COLUMN_CALLS)); - searchRequestBuilder.addAggregation(AggregationBuilders.sum(InstPerformanceTable.COLUMN_COST_TOTAL).field(InstPerformanceTable.COLUMN_COST_TOTAL)); - - SearchResponse searchResponse = searchRequestBuilder.execute().actionGet(); - Sum sumCalls = searchResponse.getAggregations().get(InstPerformanceTable.COLUMN_CALLS); - Sum sumCostTotal = searchResponse.getAggregations().get(InstPerformanceTable.COLUMN_CALLS); - return new InstPerformance(instanceId, (int)sumCalls.getValue(), (long)sumCostTotal.getValue()); - } - - @Override public int getTpsMetric(int instanceId, long timeBucket) { - String id = timeBucket + Const.ID_SPLIT + instanceId; - GetResponse getResponse = getClient().prepareGet(InstPerformanceTable.TABLE, id).get(); - - if (getResponse.isExists()) { - return ((Number)getResponse.getSource().get(InstPerformanceTable.COLUMN_CALLS)).intValue(); - } - return 0; - } - - @Override public JsonArray getTpsMetric(int instanceId, long startTimeBucket, long endTimeBucket) { - MultiGetRequestBuilder prepareMultiGet = getClient().prepareMultiGet(); - - long timeBucket = startTimeBucket; - do { - String id = timeBucket + Const.ID_SPLIT + instanceId; - prepareMultiGet.add(InstPerformanceTable.TABLE, InstPerformanceTable.TABLE_TYPE, id); - timeBucket = TimeBucketUtils.INSTANCE.addSecondForSecondTimeBucket(TimeBucketUtils.TimeBucketType.SECOND.name(), timeBucket, 1); - } - while (timeBucket <= endTimeBucket); - - JsonArray metrics = new JsonArray(); - MultiGetResponse multiGetResponse = prepareMultiGet.get(); - for (MultiGetItemResponse response : multiGetResponse.getResponses()) { - if (response.getResponse().isExists()) { - metrics.add(((Number)response.getResponse().getSource().get(InstPerformanceTable.COLUMN_CALLS)).intValue()); - } else { - metrics.add(0); - } - } - return metrics; - } - - @Override public int getRespTimeMetric(int instanceId, long timeBucket) { - String id = timeBucket + Const.ID_SPLIT + instanceId; - GetResponse getResponse = getClient().prepareGet(InstPerformanceTable.TABLE, id).get(); - - if (getResponse.isExists()) { - int callTimes = ((Number)getResponse.getSource().get(InstPerformanceTable.COLUMN_CALLS)).intValue(); - int costTotal = ((Number)getResponse.getSource().get(InstPerformanceTable.COLUMN_COST_TOTAL)).intValue(); - return costTotal / callTimes; - } - return 0; - } - - @Override public JsonArray getRespTimeMetric(int instanceId, long startTimeBucket, long endTimeBucket) { - MultiGetRequestBuilder prepareMultiGet = getClient().prepareMultiGet(); - - int i = 0; - long timeBucket; - do { - timeBucket = TimeBucketUtils.INSTANCE.addSecondForSecondTimeBucket(TimeBucketUtils.TimeBucketType.SECOND.name(), startTimeBucket, i); - String id = timeBucket + Const.ID_SPLIT + instanceId; - prepareMultiGet.add(InstPerformanceTable.TABLE, InstPerformanceTable.TABLE_TYPE, id); - i++; - } - while (timeBucket <= endTimeBucket); - - JsonArray metrics = new JsonArray(); - MultiGetResponse multiGetResponse = prepareMultiGet.get(); - for (MultiGetItemResponse response : multiGetResponse.getResponses()) { - if (response.getResponse().isExists()) { - int callTimes = ((Number)response.getResponse().getSource().get(InstPerformanceTable.COLUMN_CALLS)).intValue(); - int costTotal = ((Number)response.getResponse().getSource().get(InstPerformanceTable.COLUMN_COST_TOTAL)).intValue(); - metrics.add(costTotal / callTimes); - } else { - metrics.add(0); - } - } - return metrics; - } -} diff --git a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/InstPerformanceH2DAO.java b/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/InstPerformanceH2DAO.java deleted file mode 100644 index 1a3cdc0d38..0000000000 --- a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/InstPerformanceH2DAO.java +++ /dev/null @@ -1,162 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.ui.dao; - -import com.google.gson.JsonArray; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.List; -import org.skywalking.apm.collector.client.h2.H2Client; -import org.skywalking.apm.collector.client.h2.H2ClientException; -import org.skywalking.apm.collector.core.util.Const; -import org.skywalking.apm.collector.core.util.TimeBucketUtils; -import org.skywalking.apm.collector.storage.base.define.instance.InstPerformanceTable; -import org.skywalking.apm.collector.storage.h2.SqlBuilder; -import org.skywalking.apm.collector.storage.h2.base.dao.H2DAO; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng, clevertension - */ -public class InstPerformanceH2DAO extends H2DAO implements IInstPerformanceDAO { - private final Logger logger = LoggerFactory.getLogger(InstPerformanceH2DAO.class); - private static final String GET_INST_PERF_SQL = "select * from {0} where {1} = ? and {2} in ("; - private static final String GET_TPS_METRIC_SQL = "select * from {0} where {1} = ?"; - - @Override public InstPerformance get(long[] timeBuckets, int instanceId) { - H2Client client = getClient(); - logger.info("the inst performance inst id = {}", instanceId); - String sql = SqlBuilder.buildSql(GET_INST_PERF_SQL, InstPerformanceTable.TABLE, InstPerformanceTable.COLUMN_INSTANCE_ID, InstPerformanceTable.COLUMN_TIME_BUCKET); - StringBuilder builder = new StringBuilder(); - for (int i = 0; i < timeBuckets.length; i++) { - builder.append("?,"); - } - builder.delete(builder.length() - 1, builder.length()); - builder.append(")"); - sql = sql + builder; - Object[] params = new Object[timeBuckets.length + 1]; - for (int i = 0; i < timeBuckets.length; i++) { - params[i + 1] = timeBuckets[i]; - } - params[0] = instanceId; - try (ResultSet rs = client.executeQuery(sql, params)) { - if (rs.next()) { - int callTimes = rs.getInt(InstPerformanceTable.COLUMN_CALLS); - int costTotal = rs.getInt(InstPerformanceTable.COLUMN_COST_TOTAL); - return new InstPerformance(instanceId, callTimes, costTotal); - } - } catch (SQLException | H2ClientException e) { - logger.error(e.getMessage(), e); - } - return null; - } - - @Override public int getTpsMetric(int instanceId, long timeBucket) { - logger.info("getTpMetric instanceId = {}, startTimeBucket = {}", instanceId, timeBucket); - H2Client client = getClient(); - String sql = SqlBuilder.buildSql(GET_TPS_METRIC_SQL, InstPerformanceTable.TABLE, InstPerformanceTable.COLUMN_ID); - Object[] params = new Object[] {instanceId}; - try (ResultSet rs = client.executeQuery(sql, params)) { - if (rs.next()) { - return rs.getInt(InstPerformanceTable.COLUMN_CALLS); - } - } catch (SQLException | H2ClientException e) { - logger.error(e.getMessage(), e); - } - return 0; - } - - @Override public JsonArray getTpsMetric(int instanceId, long startTimeBucket, long endTimeBucket) { - logger.info("getTpsMetric instanceId = {}, startTimeBucket = {}, endTimeBucket = {}", instanceId, startTimeBucket, endTimeBucket); - H2Client client = getClient(); - String sql = SqlBuilder.buildSql(GET_TPS_METRIC_SQL, InstPerformanceTable.TABLE, InstPerformanceTable.COLUMN_ID); - - long timeBucket = startTimeBucket; - List idList = new ArrayList<>(); - do { - String id = timeBucket + Const.ID_SPLIT + instanceId; - timeBucket = TimeBucketUtils.INSTANCE.addSecondForSecondTimeBucket(TimeBucketUtils.TimeBucketType.SECOND.name(), timeBucket, 1); - idList.add(id); - } - while (timeBucket <= endTimeBucket); - - JsonArray metrics = new JsonArray(); - idList.forEach(id -> { - try (ResultSet rs = client.executeQuery(sql, new Object[] {id})) { - if (rs.next()) { - int calls = rs.getInt(InstPerformanceTable.COLUMN_CALLS); - metrics.add(calls); - } else { - metrics.add(0); - } - } catch (SQLException | H2ClientException e) { - logger.error(e.getMessage(), e); - } - }); - return metrics; - } - - @Override public int getRespTimeMetric(int instanceId, long timeBucket) { - H2Client client = getClient(); - String sql = SqlBuilder.buildSql(GET_TPS_METRIC_SQL, InstPerformanceTable.TABLE, InstPerformanceTable.COLUMN_ID); - Object[] params = new Object[] {instanceId}; - try (ResultSet rs = client.executeQuery(sql, params)) { - if (rs.next()) { - int callTimes = rs.getInt(InstPerformanceTable.COLUMN_CALLS); - int costTotal = rs.getInt(InstPerformanceTable.COLUMN_COST_TOTAL); - return costTotal / callTimes; - } - } catch (SQLException | H2ClientException e) { - logger.error(e.getMessage(), e); - } - return 0; - } - - @Override public JsonArray getRespTimeMetric(int instanceId, long startTimeBucket, long endTimeBucket) { - H2Client client = getClient(); - String sql = SqlBuilder.buildSql(GET_TPS_METRIC_SQL, InstPerformanceTable.TABLE, InstPerformanceTable.COLUMN_ID); - - long timeBucket = startTimeBucket; - List idList = new ArrayList<>(); - do { - String id = timeBucket + Const.ID_SPLIT + instanceId; - timeBucket = TimeBucketUtils.INSTANCE.addSecondForSecondTimeBucket(TimeBucketUtils.TimeBucketType.SECOND.name(), timeBucket, 1); - idList.add(id); - } - while (timeBucket <= endTimeBucket); - - JsonArray metrics = new JsonArray(); - idList.forEach(id -> { - try (ResultSet rs = client.executeQuery(sql, new Object[] {id})) { - if (rs.next()) { - int callTimes = rs.getInt(InstPerformanceTable.COLUMN_CALLS); - int costTotal = rs.getInt(InstPerformanceTable.COLUMN_COST_TOTAL); - metrics.add(costTotal / callTimes); - } else { - metrics.add(0); - } - } catch (SQLException | H2ClientException e) { - logger.error(e.getMessage(), e); - } - }); - return metrics; - } -} diff --git a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/InstanceEsDAO.java b/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/InstanceEsDAO.java deleted file mode 100644 index 1a2d147c0f..0000000000 --- a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/InstanceEsDAO.java +++ /dev/null @@ -1,164 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.ui.dao; - -import com.google.gson.JsonArray; -import com.google.gson.JsonObject; -import java.util.LinkedList; -import java.util.List; -import org.elasticsearch.action.get.GetRequestBuilder; -import org.elasticsearch.action.get.GetResponse; -import org.elasticsearch.action.search.SearchRequestBuilder; -import org.elasticsearch.action.search.SearchResponse; -import org.elasticsearch.action.search.SearchType; -import org.elasticsearch.index.query.AbstractQueryBuilder; -import org.elasticsearch.index.query.BoolQueryBuilder; -import org.elasticsearch.index.query.QueryBuilders; -import org.elasticsearch.index.query.RangeQueryBuilder; -import org.elasticsearch.search.SearchHit; -import org.elasticsearch.search.aggregations.AggregationBuilders; -import org.elasticsearch.search.aggregations.bucket.terms.Terms; -import org.elasticsearch.search.aggregations.metrics.valuecount.ValueCount; -import org.elasticsearch.search.sort.SortBuilders; -import org.elasticsearch.search.sort.SortMode; -import org.skywalking.apm.collector.cache.ApplicationCache; -import org.skywalking.apm.collector.core.util.TimeBucketUtils; -import org.skywalking.apm.collector.storage.base.define.register.InstanceDataDefine; -import org.skywalking.apm.collector.storage.base.define.register.InstanceTable; -import org.skywalking.apm.collector.storage.elasticsearch.dao.EsDAO; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class InstanceEsDAO extends EsDAO implements IInstanceDAO { - - private final Logger logger = LoggerFactory.getLogger(InstanceEsDAO.class); - - @Override public Long lastHeartBeatTime() { - long fiveMinuteBefore = System.currentTimeMillis() - 5 * 60 * 1000; - fiveMinuteBefore = TimeBucketUtils.INSTANCE.getSecondTimeBucket(fiveMinuteBefore); - RangeQueryBuilder rangeQueryBuilder = QueryBuilders.rangeQuery(InstanceTable.COLUMN_HEARTBEAT_TIME).gt(fiveMinuteBefore); - return heartBeatTime(rangeQueryBuilder); - } - - @Override public Long instanceLastHeartBeatTime(long applicationInstanceId) { - long fiveMinuteBefore = System.currentTimeMillis() - 5 * 60 * 1000; - fiveMinuteBefore = TimeBucketUtils.INSTANCE.getSecondTimeBucket(fiveMinuteBefore); - - BoolQueryBuilder boolQueryBuilder = new BoolQueryBuilder(); - boolQueryBuilder.must(QueryBuilders.rangeQuery(InstanceTable.COLUMN_HEARTBEAT_TIME).gt(fiveMinuteBefore)); - boolQueryBuilder.must(QueryBuilders.termQuery(InstanceTable.COLUMN_INSTANCE_ID, applicationInstanceId)); - return heartBeatTime(boolQueryBuilder); - } - - private Long heartBeatTime(AbstractQueryBuilder queryBuilder) { - SearchRequestBuilder searchRequestBuilder = getClient().prepareSearch(InstanceTable.TABLE); - searchRequestBuilder.setTypes(InstanceTable.TABLE_TYPE); - searchRequestBuilder.setSearchType(SearchType.DFS_QUERY_THEN_FETCH); - searchRequestBuilder.setQuery(queryBuilder); - searchRequestBuilder.setSize(1); - searchRequestBuilder.setFetchSource(InstanceTable.COLUMN_HEARTBEAT_TIME, null); - searchRequestBuilder.addSort(SortBuilders.fieldSort(InstanceTable.COLUMN_HEARTBEAT_TIME).sortMode(SortMode.MAX)); - - SearchResponse searchResponse = searchRequestBuilder.execute().actionGet(); - SearchHit[] searchHits = searchResponse.getHits().getHits(); - - Long heartBeatTime = 0L; - for (SearchHit searchHit : searchHits) { - heartBeatTime = (Long)searchHit.getSource().get(InstanceTable.COLUMN_HEARTBEAT_TIME); - logger.debug("heartBeatTime: {}", heartBeatTime); - heartBeatTime = heartBeatTime - 5; - } - return heartBeatTime; - } - - @Override public JsonArray getApplications(long startTime, long endTime) { - logger.debug("application list get, start time: {}, end time: {}", startTime, endTime); - SearchRequestBuilder searchRequestBuilder = getClient().prepareSearch(InstanceTable.TABLE); - searchRequestBuilder.setTypes(InstanceTable.TABLE_TYPE); - searchRequestBuilder.setSearchType(SearchType.DFS_QUERY_THEN_FETCH); - searchRequestBuilder.setQuery(QueryBuilders.rangeQuery(InstanceTable.COLUMN_HEARTBEAT_TIME).gte(startTime)); - searchRequestBuilder.setSize(0); - searchRequestBuilder.addAggregation(AggregationBuilders.terms(InstanceTable.COLUMN_APPLICATION_ID).field(InstanceTable.COLUMN_APPLICATION_ID).size(100) - .subAggregation(AggregationBuilders.count(InstanceTable.COLUMN_INSTANCE_ID).field(InstanceTable.COLUMN_INSTANCE_ID))); - - SearchResponse searchResponse = searchRequestBuilder.execute().actionGet(); - Terms genders = searchResponse.getAggregations().get(InstanceTable.COLUMN_APPLICATION_ID); - - JsonArray applications = new JsonArray(); - for (Terms.Bucket applicationsBucket : genders.getBuckets()) { - Integer applicationId = applicationsBucket.getKeyAsNumber().intValue(); - logger.debug("applicationId: {}", applicationId); - - ValueCount instanceCount = applicationsBucket.getAggregations().get(InstanceTable.COLUMN_INSTANCE_ID); - - JsonObject application = new JsonObject(); - application.addProperty("applicationId", applicationId); - application.addProperty("applicationCode", ApplicationCache.get(applicationId)); - application.addProperty("instanceCount", instanceCount.getValue()); - applications.add(application); - } - return applications; - } - - @Override public InstanceDataDefine.Instance getInstance(int instanceId) { - logger.debug("get instance info, instance id: {}", instanceId); - GetRequestBuilder requestBuilder = getClient().prepareGet(InstanceTable.TABLE, String.valueOf(instanceId)); - GetResponse getResponse = requestBuilder.get(); - if (getResponse.isExists()) { - InstanceDataDefine.Instance instance = new InstanceDataDefine.Instance(); - instance.setId(String.valueOf(instanceId)); - instance.setApplicationId(((Number)getResponse.getSource().get(InstanceTable.COLUMN_APPLICATION_ID)).intValue()); - instance.setAgentUUID((String)getResponse.getSource().get(InstanceTable.COLUMN_AGENT_UUID)); - instance.setRegisterTime(((Number)getResponse.getSource().get(InstanceTable.COLUMN_REGISTER_TIME)).longValue()); - instance.setHeartBeatTime(((Number)getResponse.getSource().get(InstanceTable.COLUMN_HEARTBEAT_TIME)).longValue()); - instance.setOsInfo((String)getResponse.getSource().get(InstanceTable.COLUMN_OS_INFO)); - return instance; - } - return null; - } - - @Override public List getInstances(int applicationId, long timeBucket) { - logger.debug("get instances info, application id: {}, timeBucket: {}", applicationId, timeBucket); - SearchRequestBuilder searchRequestBuilder = getClient().prepareSearch(InstanceTable.TABLE); - searchRequestBuilder.setTypes(InstanceTable.TABLE_TYPE); - searchRequestBuilder.setSearchType(SearchType.DFS_QUERY_THEN_FETCH); - searchRequestBuilder.setSize(1000); - - BoolQueryBuilder boolQuery = QueryBuilders.boolQuery(); - boolQuery.must().add(QueryBuilders.rangeQuery(InstanceTable.COLUMN_HEARTBEAT_TIME).gte(timeBucket)); - boolQuery.must().add(QueryBuilders.termQuery(InstanceTable.COLUMN_APPLICATION_ID, applicationId)); - searchRequestBuilder.setQuery(boolQuery); - - SearchResponse searchResponse = searchRequestBuilder.execute().actionGet(); - SearchHit[] searchHits = searchResponse.getHits().getHits(); - - List instanceList = new LinkedList<>(); - for (SearchHit searchHit : searchHits) { - InstanceDataDefine.Instance instance = new InstanceDataDefine.Instance(); - instance.setApplicationId(((Number)searchHit.getSource().get(InstanceTable.COLUMN_APPLICATION_ID)).intValue()); - instance.setHeartBeatTime(((Number)searchHit.getSource().get(InstanceTable.COLUMN_HEARTBEAT_TIME)).longValue()); - instance.setInstanceId(((Number)searchHit.getSource().get(InstanceTable.COLUMN_INSTANCE_ID)).intValue()); - instanceList.add(instance); - } - return instanceList; - } -} diff --git a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/InstanceH2DAO.java b/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/InstanceH2DAO.java deleted file mode 100644 index 95f956ba90..0000000000 --- a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/InstanceH2DAO.java +++ /dev/null @@ -1,149 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.ui.dao; - -import com.google.gson.JsonArray; -import com.google.gson.JsonObject; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.LinkedList; -import java.util.List; -import org.skywalking.apm.collector.cache.ApplicationCache; -import org.skywalking.apm.collector.client.h2.H2Client; -import org.skywalking.apm.collector.client.h2.H2ClientException; -import org.skywalking.apm.collector.core.util.TimeBucketUtils; -import org.skywalking.apm.collector.storage.base.define.register.InstanceDataDefine; -import org.skywalking.apm.collector.storage.base.define.register.InstanceTable; -import org.skywalking.apm.collector.storage.h2.SqlBuilder; -import org.skywalking.apm.collector.storage.h2.base.dao.H2DAO; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng, clevertension - */ -public class InstanceH2DAO extends H2DAO implements IInstanceDAO { - private final Logger logger = LoggerFactory.getLogger(InstanceH2DAO.class); - private static final String GET_LAST_HEARTBEAT_TIME_SQL = "select {0} from {1} where {2} > ? limit 1"; - private static final String GET_INST_LAST_HEARTBEAT_TIME_SQL = "select {0} from {1} where {2} > ? and {3} = ? limit 1"; - private static final String GET_INSTANCE_SQL = "select * from {0} where {1} = ?"; - private static final String GET_INSTANCES_SQL = "select * from {0} where {1} = ? and {2} >= ?"; - private static final String GET_APPLICATIONS_SQL = "select {3}, count({0}) as cnt from {1} where {2} >= ? group by {3} limit 100"; - - @Override - public Long lastHeartBeatTime() { - H2Client client = getClient(); - long fiveMinuteBefore = System.currentTimeMillis() - 5 * 60 * 1000; - fiveMinuteBefore = TimeBucketUtils.INSTANCE.getSecondTimeBucket(fiveMinuteBefore); - String sql = SqlBuilder.buildSql(GET_LAST_HEARTBEAT_TIME_SQL, InstanceTable.COLUMN_HEARTBEAT_TIME, InstanceTable.TABLE, InstanceTable.COLUMN_HEARTBEAT_TIME); - Object[] params = new Object[] {fiveMinuteBefore}; - try (ResultSet rs = client.executeQuery(sql, params)) { - if (rs.next()) { - return rs.getLong(1); - } - } catch (SQLException | H2ClientException e) { - logger.error(e.getMessage(), e); - } - return 0L; - } - - @Override - public Long instanceLastHeartBeatTime(long applicationInstanceId) { - H2Client client = getClient(); - long fiveMinuteBefore = System.currentTimeMillis() - 5 * 60 * 1000; - fiveMinuteBefore = TimeBucketUtils.INSTANCE.getSecondTimeBucket(fiveMinuteBefore); - String sql = SqlBuilder.buildSql(GET_INST_LAST_HEARTBEAT_TIME_SQL, InstanceTable.COLUMN_HEARTBEAT_TIME, InstanceTable.TABLE, - InstanceTable.COLUMN_HEARTBEAT_TIME, InstanceTable.COLUMN_INSTANCE_ID); - Object[] params = new Object[] {fiveMinuteBefore, applicationInstanceId}; - try (ResultSet rs = client.executeQuery(sql, params)) { - if (rs.next()) { - return rs.getLong(1); - } - } catch (SQLException | H2ClientException e) { - logger.error(e.getMessage(), e); - } - return 0L; - } - - @Override - public JsonArray getApplications(long startTime, long endTime) { - H2Client client = getClient(); - JsonArray applications = new JsonArray(); - String sql = SqlBuilder.buildSql(GET_APPLICATIONS_SQL, InstanceTable.COLUMN_INSTANCE_ID, - InstanceTable.TABLE, InstanceTable.COLUMN_HEARTBEAT_TIME, InstanceTable.COLUMN_APPLICATION_ID); - Object[] params = new Object[] {startTime}; - try (ResultSet rs = client.executeQuery(sql, params)) { - while (rs.next()) { - Integer applicationId = rs.getInt(InstanceTable.COLUMN_APPLICATION_ID); - logger.debug("applicationId: {}", applicationId); - JsonObject application = new JsonObject(); - application.addProperty("applicationId", applicationId); - application.addProperty("applicationCode", ApplicationCache.get(applicationId)); - application.addProperty("instanceCount", rs.getInt("cnt")); - applications.add(application); - } - } catch (SQLException | H2ClientException e) { - logger.error(e.getMessage(), e); - } - return applications; - } - - @Override - public InstanceDataDefine.Instance getInstance(int instanceId) { - H2Client client = getClient(); - String sql = SqlBuilder.buildSql(GET_INSTANCE_SQL, InstanceTable.TABLE, InstanceTable.COLUMN_INSTANCE_ID); - Object[] params = new Object[] {instanceId}; - try (ResultSet rs = client.executeQuery(sql, params)) { - if (rs.next()) { - InstanceDataDefine.Instance instance = new InstanceDataDefine.Instance(); - instance.setId(String.valueOf(instanceId)); - instance.setApplicationId(rs.getInt(InstanceTable.COLUMN_APPLICATION_ID)); - instance.setAgentUUID(rs.getString(InstanceTable.COLUMN_AGENT_UUID)); - instance.setRegisterTime(rs.getLong(InstanceTable.COLUMN_REGISTER_TIME)); - instance.setHeartBeatTime(rs.getLong(InstanceTable.COLUMN_HEARTBEAT_TIME)); - instance.setOsInfo(rs.getString(InstanceTable.COLUMN_OS_INFO)); - return instance; - } - } catch (SQLException | H2ClientException e) { - logger.error(e.getMessage(), e); - } - return null; - } - - @Override - public List getInstances(int applicationId, long timeBucket) { - logger.debug("get instances info, application id: {}, timeBucket: {}", applicationId, timeBucket); - List instanceList = new LinkedList<>(); - H2Client client = getClient(); - String sql = SqlBuilder.buildSql(GET_INSTANCES_SQL, InstanceTable.TABLE, InstanceTable.COLUMN_APPLICATION_ID, InstanceTable.COLUMN_HEARTBEAT_TIME); - Object[] params = new Object[] {applicationId, timeBucket}; - try (ResultSet rs = client.executeQuery(sql, params)) { - while (rs.next()) { - InstanceDataDefine.Instance instance = new InstanceDataDefine.Instance(); - instance.setApplicationId(rs.getInt(InstanceTable.COLUMN_APPLICATION_ID)); - instance.setHeartBeatTime(rs.getLong(InstanceTable.COLUMN_HEARTBEAT_TIME)); - instance.setInstanceId(rs.getInt(InstanceTable.COLUMN_INSTANCE_ID)); - instanceList.add(instance); - } - } catch (SQLException | H2ClientException e) { - logger.error(e.getMessage(), e); - } - return instanceList; - } -} diff --git a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/MemoryMetricEsDAO.java b/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/MemoryMetricEsDAO.java deleted file mode 100644 index 554ac23aa1..0000000000 --- a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/MemoryMetricEsDAO.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.ui.dao; - -import com.google.gson.JsonArray; -import com.google.gson.JsonObject; -import org.elasticsearch.action.get.GetResponse; -import org.elasticsearch.action.get.MultiGetItemResponse; -import org.elasticsearch.action.get.MultiGetRequestBuilder; -import org.elasticsearch.action.get.MultiGetResponse; -import org.skywalking.apm.collector.core.util.Const; -import org.skywalking.apm.collector.core.util.TimeBucketUtils; -import org.skywalking.apm.collector.storage.base.define.jvm.MemoryMetricTable; -import org.skywalking.apm.collector.storage.elasticsearch.dao.EsDAO; - -/** - * @author peng-yongsheng - */ -public class MemoryMetricEsDAO extends EsDAO implements IMemoryMetricDAO { - - @Override public JsonObject getMetric(int instanceId, long timeBucket, boolean isHeap) { - String id = timeBucket + Const.ID_SPLIT + instanceId + Const.ID_SPLIT + isHeap; - GetResponse getResponse = getClient().prepareGet(MemoryMetricTable.TABLE, id).get(); - - JsonObject metric = new JsonObject(); - if (getResponse.isExists()) { - metric.addProperty("max", ((Number)getResponse.getSource().get(MemoryMetricTable.COLUMN_MAX)).intValue()); - metric.addProperty("init", ((Number)getResponse.getSource().get(MemoryMetricTable.COLUMN_INIT)).intValue()); - metric.addProperty("used", ((Number)getResponse.getSource().get(MemoryMetricTable.COLUMN_USED)).intValue()); - } else { - metric.addProperty("max", 0); - metric.addProperty("init", 0); - metric.addProperty("used", 0); - } - return metric; - } - - @Override public JsonObject getMetric(int instanceId, long startTimeBucket, long endTimeBucket, boolean isHeap) { - MultiGetRequestBuilder prepareMultiGet = getClient().prepareMultiGet(); - - int i = 0; - long timeBucket = startTimeBucket; - do { - timeBucket = TimeBucketUtils.INSTANCE.addSecondForSecondTimeBucket(TimeBucketUtils.TimeBucketType.SECOND.name(), timeBucket, 1); - String id = timeBucket + Const.ID_SPLIT + instanceId + Const.ID_SPLIT + isHeap; - prepareMultiGet.add(MemoryMetricTable.TABLE, MemoryMetricTable.TABLE_TYPE, id); - } - while (timeBucket <= endTimeBucket); - - JsonObject metric = new JsonObject(); - JsonArray usedMetric = new JsonArray(); - MultiGetResponse multiGetResponse = prepareMultiGet.get(); - for (MultiGetItemResponse response : multiGetResponse.getResponses()) { - if (response.getResponse().isExists()) { - metric.addProperty("max", ((Number)response.getResponse().getSource().get(MemoryMetricTable.COLUMN_MAX)).longValue()); - metric.addProperty("init", ((Number)response.getResponse().getSource().get(MemoryMetricTable.COLUMN_INIT)).longValue()); - usedMetric.add(((Number)response.getResponse().getSource().get(MemoryMetricTable.COLUMN_USED)).longValue()); - } else { - metric.addProperty("max", 0); - metric.addProperty("init", 0); - usedMetric.add(0); - } - } - metric.add("used", usedMetric); - return metric; - } -} diff --git a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/MemoryMetricH2DAO.java b/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/MemoryMetricH2DAO.java deleted file mode 100644 index a392a971cc..0000000000 --- a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/MemoryMetricH2DAO.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.ui.dao; - -import com.google.gson.JsonArray; -import com.google.gson.JsonObject; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.List; -import org.skywalking.apm.collector.client.h2.H2Client; -import org.skywalking.apm.collector.client.h2.H2ClientException; -import org.skywalking.apm.collector.core.util.Const; -import org.skywalking.apm.collector.core.util.TimeBucketUtils; -import org.skywalking.apm.collector.storage.base.define.jvm.MemoryMetricTable; -import org.skywalking.apm.collector.storage.h2.SqlBuilder; -import org.skywalking.apm.collector.storage.h2.base.dao.H2DAO; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author clevertension - */ -public class MemoryMetricH2DAO extends H2DAO implements IMemoryMetricDAO { - private final Logger logger = LoggerFactory.getLogger(InstanceH2DAO.class); - private static final String GET_MEMORY_METRIC_SQL = "select * from {0} where {1} =?"; - - @Override public JsonObject getMetric(int instanceId, long timeBucket, boolean isHeap) { - H2Client client = getClient(); - String id = timeBucket + Const.ID_SPLIT + instanceId + Const.ID_SPLIT + isHeap; - String sql = SqlBuilder.buildSql(GET_MEMORY_METRIC_SQL, MemoryMetricTable.TABLE, MemoryMetricTable.COLUMN_ID); - Object[] params = new Object[] {id}; - JsonObject metric = new JsonObject(); - try (ResultSet rs = client.executeQuery(sql, params)) { - if (rs.next()) { - metric.addProperty("max", rs.getInt(MemoryMetricTable.COLUMN_MAX)); - metric.addProperty("init", rs.getInt(MemoryMetricTable.COLUMN_INIT)); - metric.addProperty("used", rs.getInt(MemoryMetricTable.COLUMN_USED)); - } else { - metric.addProperty("max", 0); - metric.addProperty("init", 0); - metric.addProperty("used", 0); - } - } catch (SQLException | H2ClientException e) { - logger.error(e.getMessage(), e); - } - return metric; - } - - @Override public JsonObject getMetric(int instanceId, long startTimeBucket, long endTimeBucket, boolean isHeap) { - H2Client client = getClient(); - String sql = SqlBuilder.buildSql(GET_MEMORY_METRIC_SQL, MemoryMetricTable.TABLE, MemoryMetricTable.COLUMN_ID); - List idList = new ArrayList<>(); - long timeBucket = startTimeBucket; - do { - timeBucket = TimeBucketUtils.INSTANCE.addSecondForSecondTimeBucket(TimeBucketUtils.TimeBucketType.SECOND.name(), timeBucket, 1); - String id = timeBucket + Const.ID_SPLIT + instanceId + Const.ID_SPLIT + isHeap; - idList.add(id); - } - while (timeBucket <= endTimeBucket); - - JsonObject metric = new JsonObject(); - JsonArray usedMetric = new JsonArray(); - - idList.forEach(id -> { - try (ResultSet rs = client.executeQuery(sql, new String[] {id})) { - if (rs.next()) { - metric.addProperty("max", rs.getLong(MemoryMetricTable.COLUMN_MAX)); - metric.addProperty("init", rs.getLong(MemoryMetricTable.COLUMN_INIT)); - usedMetric.add(rs.getLong(MemoryMetricTable.COLUMN_USED)); - } else { - metric.addProperty("max", 0); - metric.addProperty("init", 0); - usedMetric.add(0); - } - } catch (SQLException | H2ClientException e) { - logger.error(e.getMessage(), e); - } - }); - - metric.add("used", usedMetric); - return metric; - } -} diff --git a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/MemoryPoolMetricEsDAO.java b/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/MemoryPoolMetricEsDAO.java deleted file mode 100644 index f386ef7a9f..0000000000 --- a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/MemoryPoolMetricEsDAO.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.ui.dao; - -import com.google.gson.JsonArray; -import com.google.gson.JsonObject; -import org.elasticsearch.action.get.GetResponse; -import org.elasticsearch.action.get.MultiGetItemResponse; -import org.elasticsearch.action.get.MultiGetRequestBuilder; -import org.elasticsearch.action.get.MultiGetResponse; -import org.skywalking.apm.collector.core.util.Const; -import org.skywalking.apm.collector.core.util.TimeBucketUtils; -import org.skywalking.apm.collector.storage.base.define.jvm.MemoryPoolMetricTable; -import org.skywalking.apm.collector.storage.elasticsearch.dao.EsDAO; - -/** - * @author peng-yongsheng - */ -public class MemoryPoolMetricEsDAO extends EsDAO implements IMemoryPoolMetricDAO { - - @Override public JsonObject getMetric(int instanceId, long timeBucket, int poolType) { - String id = timeBucket + Const.ID_SPLIT + instanceId + Const.ID_SPLIT + poolType; - GetResponse getResponse = getClient().prepareGet(MemoryPoolMetricTable.TABLE, id).get(); - - JsonObject metric = new JsonObject(); - if (getResponse.isExists()) { - metric.addProperty("max", ((Number)getResponse.getSource().get(MemoryPoolMetricTable.COLUMN_MAX)).intValue()); - metric.addProperty("init", ((Number)getResponse.getSource().get(MemoryPoolMetricTable.COLUMN_INIT)).intValue()); - metric.addProperty("used", ((Number)getResponse.getSource().get(MemoryPoolMetricTable.COLUMN_USED)).intValue()); - } else { - metric.addProperty("max", 0); - metric.addProperty("init", 0); - metric.addProperty("used", 0); - } - return metric; - } - - @Override public JsonObject getMetric(int instanceId, long startTimeBucket, long endTimeBucket, int poolType) { - MultiGetRequestBuilder prepareMultiGet = getClient().prepareMultiGet(); - - long timeBucket = startTimeBucket; - do { - timeBucket = TimeBucketUtils.INSTANCE.addSecondForSecondTimeBucket(TimeBucketUtils.TimeBucketType.SECOND.name(), timeBucket, 1); - String id = timeBucket + Const.ID_SPLIT + instanceId + Const.ID_SPLIT + poolType; - prepareMultiGet.add(MemoryPoolMetricTable.TABLE, MemoryPoolMetricTable.TABLE_TYPE, id); - } - while (timeBucket <= endTimeBucket); - - JsonObject metric = new JsonObject(); - JsonArray usedMetric = new JsonArray(); - MultiGetResponse multiGetResponse = prepareMultiGet.get(); - for (MultiGetItemResponse response : multiGetResponse.getResponses()) { - if (response.getResponse().isExists()) { - metric.addProperty("max", ((Number)response.getResponse().getSource().get(MemoryPoolMetricTable.COLUMN_MAX)).longValue()); - metric.addProperty("init", ((Number)response.getResponse().getSource().get(MemoryPoolMetricTable.COLUMN_INIT)).longValue()); - usedMetric.add(((Number)response.getResponse().getSource().get(MemoryPoolMetricTable.COLUMN_USED)).longValue()); - } else { - metric.addProperty("max", 0); - metric.addProperty("init", 0); - usedMetric.add(0); - } - } - metric.add("used", usedMetric); - return metric; - } -} diff --git a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/MemoryPoolMetricH2DAO.java b/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/MemoryPoolMetricH2DAO.java deleted file mode 100644 index 397817cdd2..0000000000 --- a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/MemoryPoolMetricH2DAO.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.ui.dao; - -import com.google.gson.JsonArray; -import com.google.gson.JsonObject; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.List; -import org.skywalking.apm.collector.client.h2.H2Client; -import org.skywalking.apm.collector.client.h2.H2ClientException; -import org.skywalking.apm.collector.core.util.Const; -import org.skywalking.apm.collector.core.util.TimeBucketUtils; -import org.skywalking.apm.collector.storage.base.define.jvm.MemoryPoolMetricTable; -import org.skywalking.apm.collector.storage.h2.SqlBuilder; -import org.skywalking.apm.collector.storage.h2.base.dao.H2DAO; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author clevertension - */ -public class MemoryPoolMetricH2DAO extends H2DAO implements IMemoryPoolMetricDAO { - private final Logger logger = LoggerFactory.getLogger(InstanceH2DAO.class); - private static final String GET_MEMORY_POOL_METRIC_SQL = "select * from {0} where {1} = ?"; - - @Override public JsonObject getMetric(int instanceId, long timeBucket, int poolType) { - H2Client client = getClient(); - String id = timeBucket + Const.ID_SPLIT + instanceId + Const.ID_SPLIT + poolType; - String sql = SqlBuilder.buildSql(GET_MEMORY_POOL_METRIC_SQL, MemoryPoolMetricTable.TABLE, MemoryPoolMetricTable.COLUMN_ID); - Object[] params = new Object[] {id}; - JsonObject metric = new JsonObject(); - try (ResultSet rs = client.executeQuery(sql, params)) { - if (rs.next()) { - metric.addProperty("max", rs.getInt(MemoryPoolMetricTable.COLUMN_MAX)); - metric.addProperty("init", rs.getInt(MemoryPoolMetricTable.COLUMN_INIT)); - metric.addProperty("used", rs.getInt(MemoryPoolMetricTable.COLUMN_USED)); - } else { - metric.addProperty("max", 0); - metric.addProperty("init", 0); - metric.addProperty("used", 0); - } - } catch (SQLException | H2ClientException e) { - logger.error(e.getMessage(), e); - } - return metric; - } - - @Override public JsonObject getMetric(int instanceId, long startTimeBucket, long endTimeBucket, int poolType) { - H2Client client = getClient(); - String sql = SqlBuilder.buildSql(GET_MEMORY_POOL_METRIC_SQL, MemoryPoolMetricTable.TABLE, MemoryPoolMetricTable.COLUMN_ID); - List idList = new ArrayList<>(); - long timeBucket = startTimeBucket; - do { - timeBucket = TimeBucketUtils.INSTANCE.addSecondForSecondTimeBucket(TimeBucketUtils.TimeBucketType.SECOND.name(), timeBucket, 1); - String id = timeBucket + Const.ID_SPLIT + instanceId + Const.ID_SPLIT + poolType; - idList.add(id); - } - while (timeBucket <= endTimeBucket); - - JsonObject metric = new JsonObject(); - JsonArray usedMetric = new JsonArray(); - - idList.forEach(id -> { - try (ResultSet rs = client.executeQuery(sql, new String[] {id})) { - if (rs.next()) { - metric.addProperty("max", rs.getLong(MemoryPoolMetricTable.COLUMN_MAX)); - metric.addProperty("init", rs.getLong(MemoryPoolMetricTable.COLUMN_INIT)); - usedMetric.add(rs.getLong(MemoryPoolMetricTable.COLUMN_USED)); - } else { - metric.addProperty("max", 0); - metric.addProperty("init", 0); - usedMetric.add(0); - } - } catch (SQLException | H2ClientException e) { - logger.error(e.getMessage(), e); - } - }); - - metric.add("used", usedMetric); - return metric; - } -} diff --git a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/NodeComponentEsDAO.java b/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/NodeComponentEsDAO.java deleted file mode 100644 index 29c9430538..0000000000 --- a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/NodeComponentEsDAO.java +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.ui.dao; - -import com.google.gson.JsonArray; -import com.google.gson.JsonObject; -import org.elasticsearch.action.search.SearchRequestBuilder; -import org.elasticsearch.action.search.SearchResponse; -import org.elasticsearch.action.search.SearchType; -import org.elasticsearch.index.query.QueryBuilders; -import org.elasticsearch.search.aggregations.AggregationBuilders; -import org.elasticsearch.search.aggregations.bucket.terms.Terms; -import org.skywalking.apm.collector.cache.ApplicationCache; -import org.skywalking.apm.collector.core.util.StringUtils; -import org.skywalking.apm.collector.storage.base.define.node.NodeComponentTable; -import org.skywalking.apm.collector.storage.elasticsearch.dao.EsDAO; -import org.skywalking.apm.network.trace.component.ComponentsDefine; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class NodeComponentEsDAO extends EsDAO implements INodeComponentDAO { - - private final Logger logger = LoggerFactory.getLogger(NodeComponentEsDAO.class); - - @Override public JsonArray load(long startTime, long endTime) { - logger.debug("node component load, start time: {}, end time: {}", startTime, endTime); - JsonArray nodeComponentArray = new JsonArray(); - nodeComponentArray.addAll(aggregationByComponentId(startTime, endTime)); - nodeComponentArray.addAll(aggregationByComponentName(startTime, endTime)); - return nodeComponentArray; - } - - private JsonArray aggregationByComponentId(long startTime, long endTime) { - SearchRequestBuilder searchRequestBuilder = getClient().prepareSearch(NodeComponentTable.TABLE); - searchRequestBuilder.setTypes(NodeComponentTable.TABLE_TYPE); - searchRequestBuilder.setSearchType(SearchType.DFS_QUERY_THEN_FETCH); - searchRequestBuilder.setQuery(QueryBuilders.rangeQuery(NodeComponentTable.COLUMN_TIME_BUCKET).gte(startTime).lte(endTime)); - searchRequestBuilder.setSize(0); - - searchRequestBuilder.addAggregation(AggregationBuilders.terms(NodeComponentTable.COLUMN_COMPONENT_ID).field(NodeComponentTable.COLUMN_COMPONENT_ID).size(100) - .subAggregation(AggregationBuilders.terms(NodeComponentTable.COLUMN_PEER).field(NodeComponentTable.COLUMN_PEER).size(100)) - .subAggregation(AggregationBuilders.terms(NodeComponentTable.COLUMN_PEER_ID).field(NodeComponentTable.COLUMN_PEER_ID).size(100))); - - SearchResponse searchResponse = searchRequestBuilder.execute().actionGet(); - - Terms componentIdTerms = searchResponse.getAggregations().get(NodeComponentTable.COLUMN_COMPONENT_ID); - JsonArray nodeComponentArray = new JsonArray(); - for (Terms.Bucket componentIdBucket : componentIdTerms.getBuckets()) { - int componentId = componentIdBucket.getKeyAsNumber().intValue(); - String componentName = ComponentsDefine.getInstance().getComponentName(componentId); - if (componentId != 0) { - buildComponentArray(componentIdBucket, componentName, nodeComponentArray); - } - } - - return nodeComponentArray; - } - - private JsonArray aggregationByComponentName(long startTime, long endTime) { - SearchRequestBuilder searchRequestBuilder = getClient().prepareSearch(NodeComponentTable.TABLE); - searchRequestBuilder.setTypes(NodeComponentTable.TABLE_TYPE); - searchRequestBuilder.setSearchType(SearchType.DFS_QUERY_THEN_FETCH); - searchRequestBuilder.setQuery(QueryBuilders.rangeQuery(NodeComponentTable.COLUMN_TIME_BUCKET).gte(startTime).lte(endTime)); - searchRequestBuilder.setSize(0); - - searchRequestBuilder.addAggregation(AggregationBuilders.terms(NodeComponentTable.COLUMN_COMPONENT_NAME).field(NodeComponentTable.COLUMN_COMPONENT_NAME).size(100) - .subAggregation(AggregationBuilders.terms(NodeComponentTable.COLUMN_PEER).field(NodeComponentTable.COLUMN_PEER).size(100)) - .subAggregation(AggregationBuilders.terms(NodeComponentTable.COLUMN_PEER_ID).field(NodeComponentTable.COLUMN_PEER_ID).size(100))); - - SearchResponse searchResponse = searchRequestBuilder.execute().actionGet(); - - Terms componentNameTerms = searchResponse.getAggregations().get(NodeComponentTable.COLUMN_COMPONENT_NAME); - JsonArray nodeComponentArray = new JsonArray(); - for (Terms.Bucket componentNameBucket : componentNameTerms.getBuckets()) { - String componentName = componentNameBucket.getKeyAsString(); - if (StringUtils.isNotEmpty(componentName)) { - buildComponentArray(componentNameBucket, componentName, nodeComponentArray); - } - } - - return nodeComponentArray; - } - - private void buildComponentArray(Terms.Bucket componentBucket, String componentName, JsonArray nodeComponentArray) { - Terms peerIdTerms = componentBucket.getAggregations().get(NodeComponentTable.COLUMN_PEER_ID); - for (Terms.Bucket peerIdBucket : peerIdTerms.getBuckets()) { - int peerId = peerIdBucket.getKeyAsNumber().intValue(); - - if (peerId != 0) { - String peer = ApplicationCache.get(peerId); - - JsonObject nodeComponentObj = new JsonObject(); - nodeComponentObj.addProperty("componentName", componentName); - nodeComponentObj.addProperty("peer", peer); - nodeComponentArray.add(nodeComponentObj); - } - } - - Terms peerTerms = componentBucket.getAggregations().get(NodeComponentTable.COLUMN_PEER); - for (Terms.Bucket peerBucket : peerTerms.getBuckets()) { - String peer = peerBucket.getKeyAsString(); - - if (StringUtils.isNotEmpty(peer)) { - JsonObject nodeComponentObj = new JsonObject(); - nodeComponentObj.addProperty("componentName", componentName); - nodeComponentObj.addProperty("peer", peer); - nodeComponentArray.add(nodeComponentObj); - } - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/NodeComponentH2DAO.java b/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/NodeComponentH2DAO.java deleted file mode 100644 index 4896c4a63a..0000000000 --- a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/NodeComponentH2DAO.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.ui.dao; - -import com.google.gson.JsonArray; -import com.google.gson.JsonObject; -import java.sql.ResultSet; -import java.sql.SQLException; -import org.skywalking.apm.collector.cache.ApplicationCache; -import org.skywalking.apm.collector.client.h2.H2Client; -import org.skywalking.apm.collector.client.h2.H2ClientException; -import org.skywalking.apm.collector.core.util.StringUtils; -import org.skywalking.apm.collector.storage.base.define.node.NodeComponentTable; -import org.skywalking.apm.collector.storage.h2.SqlBuilder; -import org.skywalking.apm.collector.storage.h2.base.dao.H2DAO; -import org.skywalking.apm.network.trace.component.ComponentsDefine; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng, clevertension - */ -public class NodeComponentH2DAO extends H2DAO implements INodeComponentDAO { - private final Logger logger = LoggerFactory.getLogger(NodeComponentH2DAO.class); - private static final String AGGREGATE_COMPONENT_SQL = "select {0}, {1}, {2} from {3} where {4} >= ? and {4} <= ? group by {0}, {1}, {2} limit 100"; - - @Override public JsonArray load(long startTime, long endTime) { - JsonArray nodeComponentArray = new JsonArray(); - nodeComponentArray.addAll(aggregationComponent(startTime, endTime)); - return nodeComponentArray; - } - - private JsonArray aggregationComponent(long startTime, long endTime) { - H2Client client = getClient(); - - JsonArray nodeComponentArray = new JsonArray(); - String sql = SqlBuilder.buildSql(AGGREGATE_COMPONENT_SQL, NodeComponentTable.COLUMN_COMPONENT_ID, - NodeComponentTable.COLUMN_PEER, NodeComponentTable.COLUMN_PEER_ID, - NodeComponentTable.TABLE, NodeComponentTable.COLUMN_TIME_BUCKET); - Object[] params = new Object[] {startTime, endTime}; - try (ResultSet rs = client.executeQuery(sql, params)) { - while (rs.next()) { - int peerId = rs.getInt(NodeComponentTable.COLUMN_PEER_ID); - int componentId = rs.getInt(NodeComponentTable.COLUMN_COMPONENT_ID); - String componentName = ComponentsDefine.getInstance().getComponentName(componentId); - if (peerId != 0) { - String peer = ApplicationCache.get(peerId); - nodeComponentArray.add(buildNodeComponent(peer, componentName)); - } - String peer = rs.getString(NodeComponentTable.COLUMN_PEER); - if (StringUtils.isNotEmpty(peer)) { - nodeComponentArray.add(buildNodeComponent(peer, componentName)); - } - } - } catch (SQLException | H2ClientException e) { - logger.error(e.getMessage(), e); - } - return nodeComponentArray; - } - - private JsonObject buildNodeComponent(String peer, String componentName) { - JsonObject nodeComponentObj = new JsonObject(); - nodeComponentObj.addProperty("componentName", componentName); - nodeComponentObj.addProperty("peer", peer); - return nodeComponentObj; - } -} diff --git a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/NodeMappingEsDAO.java b/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/NodeMappingEsDAO.java deleted file mode 100644 index 83b28598a1..0000000000 --- a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/NodeMappingEsDAO.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.ui.dao; - -import com.google.gson.JsonArray; -import com.google.gson.JsonObject; -import org.elasticsearch.action.search.SearchRequestBuilder; -import org.elasticsearch.action.search.SearchResponse; -import org.elasticsearch.action.search.SearchType; -import org.elasticsearch.index.query.QueryBuilders; -import org.elasticsearch.search.aggregations.AggregationBuilders; -import org.elasticsearch.search.aggregations.bucket.terms.Terms; -import org.skywalking.apm.collector.cache.ApplicationCache; -import org.skywalking.apm.collector.core.util.StringUtils; -import org.skywalking.apm.collector.storage.base.define.node.NodeMappingTable; -import org.skywalking.apm.collector.storage.elasticsearch.dao.EsDAO; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class NodeMappingEsDAO extends EsDAO implements INodeMappingDAO { - - private final Logger logger = LoggerFactory.getLogger(NodeMappingEsDAO.class); - - @Override public JsonArray load(long startTime, long endTime) { - SearchRequestBuilder searchRequestBuilder = getClient().prepareSearch(NodeMappingTable.TABLE); - searchRequestBuilder.setTypes(NodeMappingTable.TABLE_TYPE); - searchRequestBuilder.setSearchType(SearchType.DFS_QUERY_THEN_FETCH); - searchRequestBuilder.setQuery(QueryBuilders.rangeQuery(NodeMappingTable.COLUMN_TIME_BUCKET).gte(startTime).lte(endTime)); - searchRequestBuilder.setSize(0); - - searchRequestBuilder.addAggregation( - AggregationBuilders.terms(NodeMappingTable.COLUMN_APPLICATION_ID).field(NodeMappingTable.COLUMN_APPLICATION_ID).size(100) - .subAggregation(AggregationBuilders.terms(NodeMappingTable.COLUMN_ADDRESS_ID).field(NodeMappingTable.COLUMN_ADDRESS_ID).size(100)) - .subAggregation(AggregationBuilders.terms(NodeMappingTable.COLUMN_ADDRESS).field(NodeMappingTable.COLUMN_ADDRESS).size(100))); - SearchResponse searchResponse = searchRequestBuilder.execute().actionGet(); - - Terms applicationIdTerms = searchResponse.getAggregations().get(NodeMappingTable.COLUMN_APPLICATION_ID); - - JsonArray nodeMappingArray = new JsonArray(); - for (Terms.Bucket applicationIdBucket : applicationIdTerms.getBuckets()) { - int applicationId = applicationIdBucket.getKeyAsNumber().intValue(); - String applicationCode = ApplicationCache.get(applicationId); - Terms addressIdTerms = applicationIdBucket.getAggregations().get(NodeMappingTable.COLUMN_ADDRESS_ID); - for (Terms.Bucket addressIdBucket : addressIdTerms.getBuckets()) { - int addressId = addressIdBucket.getKeyAsNumber().intValue(); - String address = ApplicationCache.get(addressId); - - if (addressId != 0) { - JsonObject nodeMappingObj = new JsonObject(); - nodeMappingObj.addProperty("applicationCode", applicationCode); - nodeMappingObj.addProperty("address", address); - nodeMappingArray.add(nodeMappingObj); - } - } - - Terms addressTerms = applicationIdBucket.getAggregations().get(NodeMappingTable.COLUMN_ADDRESS); - for (Terms.Bucket addressBucket : addressTerms.getBuckets()) { - String address = addressBucket.getKeyAsString(); - - if (StringUtils.isNotEmpty(address)) { - JsonObject nodeMappingObj = new JsonObject(); - nodeMappingObj.addProperty("applicationCode", applicationCode); - nodeMappingObj.addProperty("address", address); - nodeMappingArray.add(nodeMappingObj); - } - } - } - logger.debug("node mapping data: {}", nodeMappingArray.toString()); - return nodeMappingArray; - } -} diff --git a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/NodeMappingH2DAO.java b/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/NodeMappingH2DAO.java deleted file mode 100644 index c5593d869e..0000000000 --- a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/NodeMappingH2DAO.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.ui.dao; - -import com.google.gson.JsonArray; -import com.google.gson.JsonObject; -import java.sql.ResultSet; -import java.sql.SQLException; -import org.skywalking.apm.collector.cache.ApplicationCache; -import org.skywalking.apm.collector.client.h2.H2Client; -import org.skywalking.apm.collector.client.h2.H2ClientException; -import org.skywalking.apm.collector.core.util.StringUtils; -import org.skywalking.apm.collector.storage.base.define.node.NodeMappingTable; -import org.skywalking.apm.collector.storage.h2.SqlBuilder; -import org.skywalking.apm.collector.storage.h2.base.dao.H2DAO; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng, clevertension - */ -public class NodeMappingH2DAO extends H2DAO implements INodeMappingDAO { - private final Logger logger = LoggerFactory.getLogger(NodeMappingH2DAO.class); - private static final String NODE_MAPPING_SQL = "select {0}, {1}, {2} from {3} where {4} >= ? and {4} <= ? group by {0}, {1}, {2} limit 100"; - - @Override public JsonArray load(long startTime, long endTime) { - H2Client client = getClient(); - JsonArray nodeMappingArray = new JsonArray(); - String sql = SqlBuilder.buildSql(NODE_MAPPING_SQL, NodeMappingTable.COLUMN_APPLICATION_ID, - NodeMappingTable.COLUMN_ADDRESS_ID, NodeMappingTable.COLUMN_ADDRESS, - NodeMappingTable.TABLE, NodeMappingTable.COLUMN_TIME_BUCKET); - - Object[] params = new Object[] {startTime, endTime}; - try (ResultSet rs = client.executeQuery(sql, params)) { - while (rs.next()) { - int applicationId = rs.getInt(NodeMappingTable.COLUMN_APPLICATION_ID); - String applicationCode = ApplicationCache.get(applicationId); - int addressId = rs.getInt(NodeMappingTable.COLUMN_ADDRESS_ID); - if (addressId != 0) { - String address = ApplicationCache.get(addressId); - JsonObject nodeMappingObj = new JsonObject(); - nodeMappingObj.addProperty("applicationCode", applicationCode); - nodeMappingObj.addProperty("address", address); - nodeMappingArray.add(nodeMappingObj); - } - String address = rs.getString(NodeMappingTable.COLUMN_ADDRESS); - if (StringUtils.isNotEmpty(address)) { - JsonObject nodeMappingObj = new JsonObject(); - nodeMappingObj.addProperty("applicationCode", applicationCode); - nodeMappingObj.addProperty("address", address); - nodeMappingArray.add(nodeMappingObj); - } - } - } catch (SQLException | H2ClientException e) { - logger.error(e.getMessage(), e); - } - logger.debug("node mapping data: {}", nodeMappingArray.toString()); - return nodeMappingArray; - } -} diff --git a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/NodeReferenceEsDAO.java b/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/NodeReferenceEsDAO.java deleted file mode 100644 index dda8ed65e9..0000000000 --- a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/NodeReferenceEsDAO.java +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.ui.dao; - -import com.google.gson.JsonArray; -import com.google.gson.JsonObject; -import org.elasticsearch.action.search.SearchRequestBuilder; -import org.elasticsearch.action.search.SearchResponse; -import org.elasticsearch.action.search.SearchType; -import org.elasticsearch.index.query.QueryBuilders; -import org.elasticsearch.search.aggregations.AggregationBuilders; -import org.elasticsearch.search.aggregations.bucket.terms.Terms; -import org.elasticsearch.search.aggregations.bucket.terms.TermsAggregationBuilder; -import org.elasticsearch.search.aggregations.metrics.sum.Sum; -import org.skywalking.apm.collector.cache.ApplicationCache; -import org.skywalking.apm.collector.core.util.StringUtils; -import org.skywalking.apm.collector.storage.base.define.noderef.NodeReferenceTable; -import org.skywalking.apm.collector.storage.elasticsearch.dao.EsDAO; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class NodeReferenceEsDAO extends EsDAO implements INodeReferenceDAO { - - private final Logger logger = LoggerFactory.getLogger(NodeReferenceEsDAO.class); - - @Override public JsonArray load(long startTime, long endTime) { - SearchRequestBuilder searchRequestBuilder = getClient().prepareSearch(NodeReferenceTable.TABLE); - searchRequestBuilder.setTypes(NodeReferenceTable.TABLE_TYPE); - searchRequestBuilder.setSearchType(SearchType.DFS_QUERY_THEN_FETCH); - searchRequestBuilder.setQuery(QueryBuilders.rangeQuery(NodeReferenceTable.COLUMN_TIME_BUCKET).gte(startTime).lte(endTime)); - searchRequestBuilder.setSize(0); - - TermsAggregationBuilder aggregationBuilder = AggregationBuilders.terms(NodeReferenceTable.COLUMN_FRONT_APPLICATION_ID).field(NodeReferenceTable.COLUMN_FRONT_APPLICATION_ID).size(100); - aggregationBuilder.subAggregation(AggregationBuilders.terms(NodeReferenceTable.COLUMN_BEHIND_APPLICATION_ID).field(NodeReferenceTable.COLUMN_BEHIND_APPLICATION_ID).size(100) - .subAggregation(AggregationBuilders.sum(NodeReferenceTable.COLUMN_S1_LTE).field(NodeReferenceTable.COLUMN_S1_LTE)) - .subAggregation(AggregationBuilders.sum(NodeReferenceTable.COLUMN_S3_LTE).field(NodeReferenceTable.COLUMN_S3_LTE)) - .subAggregation(AggregationBuilders.sum(NodeReferenceTable.COLUMN_S5_LTE).field(NodeReferenceTable.COLUMN_S5_LTE)) - .subAggregation(AggregationBuilders.sum(NodeReferenceTable.COLUMN_S5_GT).field(NodeReferenceTable.COLUMN_S5_GT)) - .subAggregation(AggregationBuilders.sum(NodeReferenceTable.COLUMN_SUMMARY).field(NodeReferenceTable.COLUMN_SUMMARY)) - .subAggregation(AggregationBuilders.sum(NodeReferenceTable.COLUMN_ERROR).field(NodeReferenceTable.COLUMN_ERROR))); - aggregationBuilder.subAggregation(AggregationBuilders.terms(NodeReferenceTable.COLUMN_BEHIND_PEER).field(NodeReferenceTable.COLUMN_BEHIND_PEER).size(100) - .subAggregation(AggregationBuilders.sum(NodeReferenceTable.COLUMN_S1_LTE).field(NodeReferenceTable.COLUMN_S1_LTE)) - .subAggregation(AggregationBuilders.sum(NodeReferenceTable.COLUMN_S3_LTE).field(NodeReferenceTable.COLUMN_S3_LTE)) - .subAggregation(AggregationBuilders.sum(NodeReferenceTable.COLUMN_S5_LTE).field(NodeReferenceTable.COLUMN_S5_LTE)) - .subAggregation(AggregationBuilders.sum(NodeReferenceTable.COLUMN_S5_GT).field(NodeReferenceTable.COLUMN_S5_GT)) - .subAggregation(AggregationBuilders.sum(NodeReferenceTable.COLUMN_SUMMARY).field(NodeReferenceTable.COLUMN_SUMMARY)) - .subAggregation(AggregationBuilders.sum(NodeReferenceTable.COLUMN_ERROR).field(NodeReferenceTable.COLUMN_ERROR))); - - searchRequestBuilder.addAggregation(aggregationBuilder); - SearchResponse searchResponse = searchRequestBuilder.execute().actionGet(); - - JsonArray nodeRefResSumArray = new JsonArray(); - Terms frontApplicationIdTerms = searchResponse.getAggregations().get(NodeReferenceTable.COLUMN_FRONT_APPLICATION_ID); - for (Terms.Bucket frontApplicationIdBucket : frontApplicationIdTerms.getBuckets()) { - int applicationId = frontApplicationIdBucket.getKeyAsNumber().intValue(); - String applicationCode = ApplicationCache.get(applicationId); - Terms behindApplicationIdTerms = frontApplicationIdBucket.getAggregations().get(NodeReferenceTable.COLUMN_BEHIND_APPLICATION_ID); - for (Terms.Bucket behindApplicationIdBucket : behindApplicationIdTerms.getBuckets()) { - int behindApplicationId = behindApplicationIdBucket.getKeyAsNumber().intValue(); - - if (behindApplicationId != 0) { - String behindApplicationCode = ApplicationCache.get(behindApplicationId); - - Sum s1LTE = behindApplicationIdBucket.getAggregations().get(NodeReferenceTable.COLUMN_S1_LTE); - Sum s3LTE = behindApplicationIdBucket.getAggregations().get(NodeReferenceTable.COLUMN_S3_LTE); - Sum s5LTE = behindApplicationIdBucket.getAggregations().get(NodeReferenceTable.COLUMN_S5_LTE); - Sum s5GT = behindApplicationIdBucket.getAggregations().get(NodeReferenceTable.COLUMN_S5_GT); - Sum summary = behindApplicationIdBucket.getAggregations().get(NodeReferenceTable.COLUMN_SUMMARY); - Sum error = behindApplicationIdBucket.getAggregations().get(NodeReferenceTable.COLUMN_ERROR); - logger.debug("applicationId: {}, behindApplicationId: {}, s1LTE: {}, s3LTE: {}, s5LTE: {}, s5GT: {}, error: {}, summary: {}", applicationId, - behindApplicationId, s1LTE.getValue(), s3LTE.getValue(), s5LTE.getValue(), s5GT.getValue(), error.getValue(), summary.getValue()); - - JsonObject nodeRefResSumObj = new JsonObject(); - nodeRefResSumObj.addProperty("front", applicationCode); - nodeRefResSumObj.addProperty("behind", behindApplicationCode); - nodeRefResSumObj.addProperty(NodeReferenceTable.COLUMN_S1_LTE, s1LTE.getValue()); - nodeRefResSumObj.addProperty(NodeReferenceTable.COLUMN_S3_LTE, s3LTE.getValue()); - nodeRefResSumObj.addProperty(NodeReferenceTable.COLUMN_S5_LTE, s5LTE.getValue()); - nodeRefResSumObj.addProperty(NodeReferenceTable.COLUMN_S5_GT, s5GT.getValue()); - nodeRefResSumObj.addProperty(NodeReferenceTable.COLUMN_ERROR, error.getValue()); - nodeRefResSumObj.addProperty(NodeReferenceTable.COLUMN_SUMMARY, summary.getValue()); - nodeRefResSumArray.add(nodeRefResSumObj); - } - } - - Terms behindPeerTerms = frontApplicationIdBucket.getAggregations().get(NodeReferenceTable.COLUMN_BEHIND_PEER); - for (Terms.Bucket behindPeerBucket : behindPeerTerms.getBuckets()) { - String behindPeer = behindPeerBucket.getKeyAsString(); - - if (StringUtils.isNotEmpty(behindPeer)) { - Sum s1LTE = behindPeerBucket.getAggregations().get(NodeReferenceTable.COLUMN_S1_LTE); - Sum s3LTE = behindPeerBucket.getAggregations().get(NodeReferenceTable.COLUMN_S3_LTE); - Sum s5LTE = behindPeerBucket.getAggregations().get(NodeReferenceTable.COLUMN_S5_LTE); - Sum s5GT = behindPeerBucket.getAggregations().get(NodeReferenceTable.COLUMN_S5_GT); - Sum summary = behindPeerBucket.getAggregations().get(NodeReferenceTable.COLUMN_SUMMARY); - Sum error = behindPeerBucket.getAggregations().get(NodeReferenceTable.COLUMN_ERROR); - logger.debug("applicationId: {}, behindPeer: {}, s1LTE: {}, s3LTE: {}, s5LTE: {}, s5GT: {}, error: {}, summary: {}", applicationId, - behindPeer, s1LTE.getValue(), s3LTE.getValue(), s5LTE.getValue(), s5GT.getValue(), error.getValue(), summary.getValue()); - - JsonObject nodeRefResSumObj = new JsonObject(); - nodeRefResSumObj.addProperty("front", applicationCode); - nodeRefResSumObj.addProperty("behind", behindPeer); - nodeRefResSumObj.addProperty(NodeReferenceTable.COLUMN_S1_LTE, s1LTE.getValue()); - nodeRefResSumObj.addProperty(NodeReferenceTable.COLUMN_S3_LTE, s3LTE.getValue()); - nodeRefResSumObj.addProperty(NodeReferenceTable.COLUMN_S5_LTE, s5LTE.getValue()); - nodeRefResSumObj.addProperty(NodeReferenceTable.COLUMN_S5_GT, s5GT.getValue()); - nodeRefResSumObj.addProperty(NodeReferenceTable.COLUMN_ERROR, error.getValue()); - nodeRefResSumObj.addProperty(NodeReferenceTable.COLUMN_SUMMARY, summary.getValue()); - nodeRefResSumArray.add(nodeRefResSumObj); - } - } - } - - return nodeRefResSumArray; - } -} diff --git a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/NodeReferenceH2DAO.java b/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/NodeReferenceH2DAO.java deleted file mode 100644 index 7681efc345..0000000000 --- a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/NodeReferenceH2DAO.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.ui.dao; - -import java.sql.ResultSet; -import java.sql.SQLException; - -import org.skywalking.apm.collector.cache.ApplicationCache; -import org.skywalking.apm.collector.client.h2.H2Client; -import org.skywalking.apm.collector.client.h2.H2ClientException; -import org.skywalking.apm.collector.core.util.StringUtils; -import org.skywalking.apm.collector.storage.base.define.noderef.NodeReferenceTable; -import org.skywalking.apm.collector.storage.h2.SqlBuilder; -import org.skywalking.apm.collector.storage.h2.base.dao.H2DAO; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.google.gson.JsonArray; -import com.google.gson.JsonObject; - -/** - * @author peng-yongsheng, clevertension - */ -public class NodeReferenceH2DAO extends H2DAO implements INodeReferenceDAO { - private final Logger logger = LoggerFactory.getLogger(NodeReferenceH2DAO.class); - private static final String NODE_REFERENCE_SQL = "select {8}, {9}, {10}, sum({0}) as {0}, sum({1}) as {1}, sum({2}) as {2}, " + - "sum({3}) as {3}, sum({4}) as {4}, sum({5}) as {5} from {6} where {7} >= ? and {7} <= ? group by {8}, {9}, {10} limit 100"; - @Override public JsonArray load(long startTime, long endTime) { - H2Client client = getClient(); - JsonArray nodeRefResSumArray = new JsonArray(); - String sql = SqlBuilder.buildSql(NODE_REFERENCE_SQL, NodeReferenceTable.COLUMN_S1_LTE, - NodeReferenceTable.COLUMN_S3_LTE, NodeReferenceTable.COLUMN_S5_LTE, - NodeReferenceTable.COLUMN_S5_GT, NodeReferenceTable.COLUMN_SUMMARY, - NodeReferenceTable.COLUMN_ERROR, NodeReferenceTable.TABLE, NodeReferenceTable.COLUMN_TIME_BUCKET, - NodeReferenceTable.COLUMN_FRONT_APPLICATION_ID, NodeReferenceTable.COLUMN_BEHIND_APPLICATION_ID, NodeReferenceTable.COLUMN_BEHIND_PEER); - - Object[] params = new Object[]{startTime, endTime}; - try (ResultSet rs = client.executeQuery(sql, params)) { - while (rs.next()) { - int applicationId = rs.getInt(NodeReferenceTable.COLUMN_FRONT_APPLICATION_ID); - String applicationCode = ApplicationCache.get(applicationId); - int behindApplicationId = rs.getInt(NodeReferenceTable.COLUMN_BEHIND_APPLICATION_ID); - if (behindApplicationId != 0) { - String behindApplicationCode = ApplicationCache.get(behindApplicationId); - - JsonObject nodeRefResSumObj = new JsonObject(); - nodeRefResSumObj.addProperty("front", applicationCode); - nodeRefResSumObj.addProperty("behind", behindApplicationCode); - nodeRefResSumObj.addProperty(NodeReferenceTable.COLUMN_S1_LTE, rs.getDouble(NodeReferenceTable.COLUMN_S1_LTE)); - nodeRefResSumObj.addProperty(NodeReferenceTable.COLUMN_S3_LTE, rs.getDouble(NodeReferenceTable.COLUMN_S3_LTE)); - nodeRefResSumObj.addProperty(NodeReferenceTable.COLUMN_S5_LTE, rs.getDouble(NodeReferenceTable.COLUMN_S5_LTE)); - nodeRefResSumObj.addProperty(NodeReferenceTable.COLUMN_S5_GT, rs.getDouble(NodeReferenceTable.COLUMN_S5_GT)); - nodeRefResSumObj.addProperty(NodeReferenceTable.COLUMN_ERROR, rs.getDouble(NodeReferenceTable.COLUMN_ERROR)); - nodeRefResSumObj.addProperty(NodeReferenceTable.COLUMN_SUMMARY, rs.getDouble(NodeReferenceTable.COLUMN_SUMMARY)); - nodeRefResSumArray.add(nodeRefResSumObj); - } - String behindPeer = rs.getString(NodeReferenceTable.COLUMN_BEHIND_PEER); - if (StringUtils.isNotEmpty(behindPeer)) { - JsonObject nodeRefResSumObj = new JsonObject(); - nodeRefResSumObj.addProperty("front", applicationCode); - nodeRefResSumObj.addProperty("behind", behindPeer); - nodeRefResSumObj.addProperty(NodeReferenceTable.COLUMN_S1_LTE, rs.getDouble(NodeReferenceTable.COLUMN_S1_LTE)); - nodeRefResSumObj.addProperty(NodeReferenceTable.COLUMN_S3_LTE, rs.getDouble(NodeReferenceTable.COLUMN_S3_LTE)); - nodeRefResSumObj.addProperty(NodeReferenceTable.COLUMN_S5_LTE, rs.getDouble(NodeReferenceTable.COLUMN_S5_LTE)); - nodeRefResSumObj.addProperty(NodeReferenceTable.COLUMN_S5_GT, rs.getDouble(NodeReferenceTable.COLUMN_S5_GT)); - nodeRefResSumObj.addProperty(NodeReferenceTable.COLUMN_ERROR, rs.getDouble(NodeReferenceTable.COLUMN_ERROR)); - nodeRefResSumObj.addProperty(NodeReferenceTable.COLUMN_SUMMARY, rs.getDouble(NodeReferenceTable.COLUMN_SUMMARY)); - nodeRefResSumArray.add(nodeRefResSumObj); - } - } - } catch (SQLException | H2ClientException e) { - logger.error(e.getMessage(), e); - } - return nodeRefResSumArray; - } -} diff --git a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/SegmentCostEsDAO.java b/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/SegmentCostEsDAO.java deleted file mode 100644 index c5274c02f7..0000000000 --- a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/SegmentCostEsDAO.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.ui.dao; - -import com.google.gson.JsonArray; -import com.google.gson.JsonObject; -import java.util.List; -import org.elasticsearch.action.search.SearchRequestBuilder; -import org.elasticsearch.action.search.SearchResponse; -import org.elasticsearch.action.search.SearchType; -import org.elasticsearch.index.query.BoolQueryBuilder; -import org.elasticsearch.index.query.QueryBuilder; -import org.elasticsearch.index.query.QueryBuilders; -import org.elasticsearch.index.query.RangeQueryBuilder; -import org.elasticsearch.search.SearchHit; -import org.elasticsearch.search.sort.SortOrder; -import org.skywalking.apm.collector.core.util.CollectionUtils; -import org.skywalking.apm.collector.core.util.StringUtils; -import org.skywalking.apm.collector.storage.base.dao.DAOContainer; -import org.skywalking.apm.collector.storage.base.define.global.GlobalTraceTable; -import org.skywalking.apm.collector.storage.base.define.segment.SegmentCostTable; -import org.skywalking.apm.collector.storage.elasticsearch.dao.EsDAO; - -/** - * @author peng-yongsheng - */ -public class SegmentCostEsDAO extends EsDAO implements ISegmentCostDAO { - - @Override public JsonObject loadTop(long startTime, long endTime, long minCost, long maxCost, String operationName, - Error error, int applicationId, List segmentIds, int limit, int from, Sort sort) { - SearchRequestBuilder searchRequestBuilder = getClient().prepareSearch(SegmentCostTable.TABLE); - searchRequestBuilder.setTypes(SegmentCostTable.TABLE_TYPE); - searchRequestBuilder.setSearchType(SearchType.DFS_QUERY_THEN_FETCH); - BoolQueryBuilder boolQueryBuilder = QueryBuilders.boolQuery(); - searchRequestBuilder.setQuery(boolQueryBuilder); - List mustQueryList = boolQueryBuilder.must(); - - mustQueryList.add(QueryBuilders.rangeQuery(SegmentCostTable.COLUMN_TIME_BUCKET).gte(startTime).lte(endTime)); - if (minCost != -1 || maxCost != -1) { - RangeQueryBuilder rangeQueryBuilder = QueryBuilders.rangeQuery(SegmentCostTable.COLUMN_COST); - if (minCost != -1) { - rangeQueryBuilder.gte(minCost); - } - if (maxCost != -1) { - rangeQueryBuilder.lte(maxCost); - } - boolQueryBuilder.must().add(rangeQueryBuilder); - } - if (StringUtils.isNotEmpty(operationName)) { - mustQueryList.add(QueryBuilders.matchQuery(SegmentCostTable.COLUMN_SERVICE_NAME, operationName)); - } - if (CollectionUtils.isNotEmpty(segmentIds)) { - boolQueryBuilder.must().add(QueryBuilders.termsQuery(SegmentCostTable.COLUMN_SEGMENT_ID, segmentIds.toArray(new String[0]))); - } - if (Error.True.equals(error)) { - boolQueryBuilder.must().add(QueryBuilders.termQuery(SegmentCostTable.COLUMN_IS_ERROR, true)); - } else if (Error.False.equals(error)) { - boolQueryBuilder.must().add(QueryBuilders.termQuery(SegmentCostTable.COLUMN_IS_ERROR, false)); - } - if (applicationId != 0) { - boolQueryBuilder.must().add(QueryBuilders.termQuery(SegmentCostTable.COLUMN_APPLICATION_ID, applicationId)); - } - - if (Sort.Cost.equals(sort)) { - searchRequestBuilder.addSort(SegmentCostTable.COLUMN_COST, SortOrder.DESC); - } else if (Sort.Time.equals(sort)) { - searchRequestBuilder.addSort(SegmentCostTable.COLUMN_START_TIME, SortOrder.DESC); - } - searchRequestBuilder.setSize(limit); - searchRequestBuilder.setFrom(from); - - SearchResponse searchResponse = searchRequestBuilder.execute().actionGet(); - - JsonObject topSegPaging = new JsonObject(); - topSegPaging.addProperty("recordsTotal", searchResponse.getHits().totalHits); - - JsonArray topSegArray = new JsonArray(); - topSegPaging.add("data", topSegArray); - - int num = from; - for (SearchHit searchHit : searchResponse.getHits().getHits()) { - JsonObject topSegmentJson = new JsonObject(); - topSegmentJson.addProperty("num", num); - String segmentId = (String)searchHit.getSource().get(SegmentCostTable.COLUMN_SEGMENT_ID); - topSegmentJson.addProperty(SegmentCostTable.COLUMN_SEGMENT_ID, segmentId); - topSegmentJson.addProperty(SegmentCostTable.COLUMN_START_TIME, (Number)searchHit.getSource().get(SegmentCostTable.COLUMN_START_TIME)); - if (searchHit.getSource().containsKey(SegmentCostTable.COLUMN_END_TIME)) { - topSegmentJson.addProperty(SegmentCostTable.COLUMN_END_TIME, (Number)searchHit.getSource().get(SegmentCostTable.COLUMN_END_TIME)); - } - - IGlobalTraceDAO globalTraceDAO = (IGlobalTraceDAO)DAOContainer.INSTANCE.get(IGlobalTraceDAO.class.getName()); - List globalTraces = globalTraceDAO.getGlobalTraceId(segmentId); - if (CollectionUtils.isNotEmpty(globalTraces)) { - topSegmentJson.addProperty(GlobalTraceTable.COLUMN_GLOBAL_TRACE_ID, globalTraces.get(0)); - } - - topSegmentJson.addProperty(SegmentCostTable.COLUMN_APPLICATION_ID, (Number)searchHit.getSource().get(SegmentCostTable.COLUMN_APPLICATION_ID)); - topSegmentJson.addProperty(SegmentCostTable.COLUMN_SERVICE_NAME, (String)searchHit.getSource().get(SegmentCostTable.COLUMN_SERVICE_NAME)); - topSegmentJson.addProperty(SegmentCostTable.COLUMN_COST, (Number)searchHit.getSource().get(SegmentCostTable.COLUMN_COST)); - topSegmentJson.addProperty(SegmentCostTable.COLUMN_IS_ERROR, (Boolean)searchHit.getSource().get(SegmentCostTable.COLUMN_IS_ERROR)); - - num++; - topSegArray.add(topSegmentJson); - } - - return topSegPaging; - } -} diff --git a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/SegmentCostH2DAO.java b/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/SegmentCostH2DAO.java deleted file mode 100644 index 1c9e2e84a6..0000000000 --- a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/SegmentCostH2DAO.java +++ /dev/null @@ -1,159 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.ui.dao; - -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.List; - -import org.elasticsearch.search.sort.SortOrder; -import org.skywalking.apm.collector.client.h2.H2Client; -import org.skywalking.apm.collector.client.h2.H2ClientException; -import org.skywalking.apm.collector.core.util.CollectionUtils; -import org.skywalking.apm.collector.core.util.StringUtils; -import org.skywalking.apm.collector.storage.base.dao.DAOContainer; -import org.skywalking.apm.collector.storage.base.define.global.GlobalTraceTable; -import org.skywalking.apm.collector.storage.base.define.segment.SegmentCostTable; -import org.skywalking.apm.collector.storage.h2.SqlBuilder; -import org.skywalking.apm.collector.storage.h2.base.dao.H2DAO; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.google.gson.JsonArray; -import com.google.gson.JsonObject; - -/** - * @author peng-yongsheng, clevertension - */ -public class SegmentCostH2DAO extends H2DAO implements ISegmentCostDAO { - private final Logger logger = LoggerFactory.getLogger(SegmentCostH2DAO.class); - private static final String GET_SEGMENT_COST_SQL = "select * from {0} where {1} >= ? and {1} <= ?"; - @Override public JsonObject loadTop(long startTime, long endTime, long minCost, long maxCost, String operationName, - Error error, int applicationId, List segmentIds, int limit, int from, Sort sort) { - H2Client client = getClient(); - String sql = GET_SEGMENT_COST_SQL; - List params = new ArrayList<>(); - List columns = new ArrayList<>(); - columns.add(SegmentCostTable.TABLE); - columns.add(SegmentCostTable.COLUMN_TIME_BUCKET); - params.add(startTime); - params.add(endTime); - int paramIndex = 1; - if (minCost != -1 || maxCost != -1) { - if (minCost != -1) { - paramIndex++; - sql = sql + " and {" + paramIndex + "} >= ?"; - params.add(minCost); - columns.add(SegmentCostTable.COLUMN_COST); - } - if (maxCost != -1) { - paramIndex++; - sql = sql + " and {" + paramIndex + "} <= ?"; - params.add(maxCost); - columns.add(SegmentCostTable.COLUMN_COST); - } - } - if (StringUtils.isNotEmpty(operationName)) { - paramIndex++; - sql = sql + " and {" + paramIndex + "} = ?"; - params.add(operationName); - columns.add(SegmentCostTable.COLUMN_SERVICE_NAME); - } - if (CollectionUtils.isNotEmpty(segmentIds)) { - paramIndex++; - sql = sql + " and {" + paramIndex + "} in ("; - columns.add(SegmentCostTable.COLUMN_SEGMENT_ID); - StringBuilder builder = new StringBuilder(); - for (int i = 0; i < segmentIds.size(); i++) { - builder.append("?,"); - } - builder.delete(builder.length() - 1, builder.length()); - builder.append(")"); - sql = sql + builder; - for (String segmentId : segmentIds) { - params.add(segmentId); - } - } - if (Error.True.equals(error)) { - paramIndex++; - sql = sql + " and {" + paramIndex + "} = ?"; - params.add(true); - columns.add(SegmentCostTable.COLUMN_IS_ERROR); - } else if (Error.False.equals(error)) { - paramIndex++; - sql = sql + " and {" + paramIndex + "} = ?"; - params.add(false); - columns.add(SegmentCostTable.COLUMN_IS_ERROR); - } - if (applicationId != 0) { - paramIndex++; - sql = sql + " and {" + paramIndex + "} = ?"; - params.add(applicationId); - columns.add(SegmentCostTable.COLUMN_APPLICATION_ID); - } - - if (Sort.Cost.equals(sort)) { - sql = sql + " order by " + SegmentCostTable.COLUMN_COST + " " + SortOrder.DESC; - } else if (Sort.Time.equals(sort)) { - sql = sql + " order by " + SegmentCostTable.COLUMN_START_TIME + " " + SortOrder.DESC; - } - - sql = sql + " limit " + from + "," + limit; - sql = SqlBuilder.buildSql(sql, columns); - Object[] p = params.toArray(new Object[0]); - - JsonObject topSegPaging = new JsonObject(); - - - JsonArray topSegArray = new JsonArray(); - topSegPaging.add("data", topSegArray); - int cnt = 0; - int num = from; - try (ResultSet rs = client.executeQuery(sql, p)) { - while (rs.next()) { - JsonObject topSegmentJson = new JsonObject(); - topSegmentJson.addProperty("num", num); - String segmentId = rs.getString(SegmentCostTable.COLUMN_SEGMENT_ID); - topSegmentJson.addProperty(SegmentCostTable.COLUMN_SEGMENT_ID, segmentId); - topSegmentJson.addProperty(SegmentCostTable.COLUMN_START_TIME, rs.getLong(SegmentCostTable.COLUMN_START_TIME)); - topSegmentJson.addProperty(SegmentCostTable.COLUMN_END_TIME, rs.getLong(SegmentCostTable.COLUMN_END_TIME)); - - IGlobalTraceDAO globalTraceDAO = (IGlobalTraceDAO) DAOContainer.INSTANCE.get(IGlobalTraceDAO.class.getName()); - List globalTraces = globalTraceDAO.getGlobalTraceId(segmentId); - if (CollectionUtils.isNotEmpty(globalTraces)) { - topSegmentJson.addProperty(GlobalTraceTable.COLUMN_GLOBAL_TRACE_ID, globalTraces.get(0)); - } - - topSegmentJson.addProperty(SegmentCostTable.COLUMN_APPLICATION_ID, rs.getInt(SegmentCostTable.COLUMN_APPLICATION_ID)); - topSegmentJson.addProperty(SegmentCostTable.COLUMN_SERVICE_NAME, rs.getString(SegmentCostTable.COLUMN_SERVICE_NAME)); - topSegmentJson.addProperty(SegmentCostTable.COLUMN_COST, rs.getLong(SegmentCostTable.COLUMN_COST)); - topSegmentJson.addProperty(SegmentCostTable.COLUMN_IS_ERROR, rs.getBoolean(SegmentCostTable.COLUMN_IS_ERROR)); - - num++; - topSegArray.add(topSegmentJson); - cnt++; - } - } catch (SQLException | H2ClientException e) { - logger.error(e.getMessage(), e); - } - topSegPaging.addProperty("recordsTotal", cnt); - return topSegPaging; - } -} diff --git a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/SegmentEsDAO.java b/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/SegmentEsDAO.java deleted file mode 100644 index e2599c4b23..0000000000 --- a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/SegmentEsDAO.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.ui.dao; - -import com.google.protobuf.InvalidProtocolBufferException; -import java.util.Base64; -import java.util.Map; -import org.elasticsearch.action.get.GetResponse; -import org.skywalking.apm.collector.core.util.StringUtils; -import org.skywalking.apm.collector.storage.base.define.segment.SegmentTable; -import org.skywalking.apm.collector.storage.elasticsearch.dao.EsDAO; -import org.skywalking.apm.network.proto.TraceSegmentObject; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class SegmentEsDAO extends EsDAO implements ISegmentDAO { - - private final Logger logger = LoggerFactory.getLogger(SegmentEsDAO.class); - - @Override public TraceSegmentObject load(String segmentId) { - GetResponse response = getClient().prepareGet(SegmentTable.TABLE, segmentId).get(); - Map source = response.getSource(); - String dataBinaryBase64 = (String)source.get(SegmentTable.COLUMN_DATA_BINARY); - if (StringUtils.isNotEmpty(dataBinaryBase64)) { - byte[] dataBinary = Base64.getDecoder().decode(dataBinaryBase64); - try { - return TraceSegmentObject.parseFrom(dataBinary); - } catch (InvalidProtocolBufferException e) { - logger.error(e.getMessage(), e); - } - } - return null; - } -} diff --git a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/SegmentH2DAO.java b/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/SegmentH2DAO.java deleted file mode 100644 index 67baa7f34e..0000000000 --- a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/SegmentH2DAO.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.ui.dao; - -import com.google.protobuf.InvalidProtocolBufferException; -import java.sql.ResultSet; -import java.sql.SQLException; -import org.skywalking.apm.collector.client.h2.H2Client; -import org.skywalking.apm.collector.client.h2.H2ClientException; -import org.skywalking.apm.collector.storage.base.define.segment.SegmentTable; -import org.skywalking.apm.collector.storage.h2.SqlBuilder; -import org.skywalking.apm.collector.storage.h2.base.dao.H2DAO; -import org.skywalking.apm.network.proto.TraceSegmentObject; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng, clevertension - */ -public class SegmentH2DAO extends H2DAO implements ISegmentDAO { - private final Logger logger = LoggerFactory.getLogger(SegmentH2DAO.class); - private static final String GET_SEGMENT_SQL = "select {0} from {1} where {2} = ?"; - - @Override public TraceSegmentObject load(String segmentId) { - H2Client client = getClient(); - String sql = SqlBuilder.buildSql(GET_SEGMENT_SQL, SegmentTable.COLUMN_DATA_BINARY, - SegmentTable.TABLE, SegmentTable.COLUMN_ID); - Object[] params = new Object[] {segmentId}; - try (ResultSet rs = client.executeQuery(sql, params)) { - if (rs.next()) { - byte[] dataBinary = rs.getBytes(SegmentTable.COLUMN_DATA_BINARY); - try { - return TraceSegmentObject.parseFrom(dataBinary); - } catch (InvalidProtocolBufferException e) { - logger.error(e.getMessage(), e); - } - } - } catch (SQLException | H2ClientException e) { - logger.error(e.getMessage(), e); - } - return null; - } -} diff --git a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/ServiceEntryEsDAO.java b/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/ServiceEntryEsDAO.java deleted file mode 100644 index 2895ca7808..0000000000 --- a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/ServiceEntryEsDAO.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.ui.dao; - -import com.google.gson.JsonArray; -import com.google.gson.JsonObject; -import org.elasticsearch.action.search.SearchRequestBuilder; -import org.elasticsearch.action.search.SearchResponse; -import org.elasticsearch.action.search.SearchType; -import org.elasticsearch.index.query.BoolQueryBuilder; -import org.elasticsearch.index.query.QueryBuilders; -import org.elasticsearch.search.SearchHit; -import org.elasticsearch.search.SearchHits; -import org.elasticsearch.search.sort.SortBuilders; -import org.elasticsearch.search.sort.SortOrder; -import org.skywalking.apm.collector.cache.ApplicationCache; -import org.skywalking.apm.collector.core.util.ColumnNameUtils; -import org.skywalking.apm.collector.core.util.StringUtils; -import org.skywalking.apm.collector.storage.base.define.service.ServiceEntryTable; -import org.skywalking.apm.collector.storage.elasticsearch.dao.EsDAO; - -/** - * @author peng-yongsheng - */ -public class ServiceEntryEsDAO extends EsDAO implements IServiceEntryDAO { - - @Override - public JsonObject load(int applicationId, String entryServiceName, long startTime, long endTime, int from, - int size) { - SearchRequestBuilder searchRequestBuilder = getClient().prepareSearch(ServiceEntryTable.TABLE); - searchRequestBuilder.setTypes(ServiceEntryTable.TABLE_TYPE); - searchRequestBuilder.setSearchType(SearchType.DFS_QUERY_THEN_FETCH); - - BoolQueryBuilder boolQueryBuilder = QueryBuilders.boolQuery(); - boolQueryBuilder.must().add(QueryBuilders.rangeQuery(ServiceEntryTable.COLUMN_REGISTER_TIME).lte(endTime)); - boolQueryBuilder.must().add(QueryBuilders.rangeQuery(ServiceEntryTable.COLUMN_NEWEST_TIME).gte(startTime)); - - if (applicationId != 0) { - boolQueryBuilder.must().add(QueryBuilders.matchQuery(ServiceEntryTable.COLUMN_APPLICATION_ID, applicationId)); - } - if (StringUtils.isNotEmpty(entryServiceName)) { - boolQueryBuilder.must().add(QueryBuilders.matchQuery(ServiceEntryTable.COLUMN_ENTRY_SERVICE_NAME, entryServiceName)); - } - - searchRequestBuilder.setQuery(boolQueryBuilder); - searchRequestBuilder.setSize(size); - searchRequestBuilder.setFrom(from); - searchRequestBuilder.addSort(SortBuilders.fieldSort(ServiceEntryTable.COLUMN_ENTRY_SERVICE_NAME).order(SortOrder.ASC)); - - SearchResponse searchResponse = searchRequestBuilder.execute().actionGet(); - - return parseResponse(searchResponse); - } - - private JsonObject parseResponse(SearchResponse searchResponse) { - SearchHits searchHits = searchResponse.getHits(); - - JsonArray serviceArray = new JsonArray(); - for (SearchHit searchHit : searchHits.getHits()) { - int applicationId = ((Number)searchHit.getSource().get(ServiceEntryTable.COLUMN_APPLICATION_ID)).intValue(); - int entryServiceId = ((Number)searchHit.getSource().get(ServiceEntryTable.COLUMN_ENTRY_SERVICE_ID)).intValue(); - String applicationCode = ApplicationCache.get(applicationId); - String entryServiceName = (String)searchHit.getSource().get(ServiceEntryTable.COLUMN_ENTRY_SERVICE_NAME); - - JsonObject row = new JsonObject(); - row.addProperty(ColumnNameUtils.INSTANCE.rename(ServiceEntryTable.COLUMN_ENTRY_SERVICE_ID), entryServiceId); - row.addProperty(ColumnNameUtils.INSTANCE.rename(ServiceEntryTable.COLUMN_ENTRY_SERVICE_NAME), entryServiceName); - row.addProperty(ColumnNameUtils.INSTANCE.rename(ServiceEntryTable.COLUMN_APPLICATION_ID), applicationId); - row.addProperty("applicationCode", applicationCode); - serviceArray.add(row); - } - - JsonObject response = new JsonObject(); - response.addProperty("total", searchHits.totalHits); - response.add("array", serviceArray); - - return response; - } -} diff --git a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/ServiceEntryH2DAO.java b/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/ServiceEntryH2DAO.java deleted file mode 100644 index fe27c2f4d7..0000000000 --- a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/ServiceEntryH2DAO.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.ui.dao; - -import com.google.gson.JsonArray; -import com.google.gson.JsonObject; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.List; -import org.skywalking.apm.collector.cache.ApplicationCache; -import org.skywalking.apm.collector.client.h2.H2Client; -import org.skywalking.apm.collector.client.h2.H2ClientException; -import org.skywalking.apm.collector.core.util.ColumnNameUtils; -import org.skywalking.apm.collector.core.util.StringUtils; -import org.skywalking.apm.collector.storage.base.define.service.ServiceEntryTable; -import org.skywalking.apm.collector.storage.h2.SqlBuilder; -import org.skywalking.apm.collector.storage.h2.base.dao.H2DAO; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class ServiceEntryH2DAO extends H2DAO implements IServiceEntryDAO { - private final Logger logger = LoggerFactory.getLogger(SegmentH2DAO.class); - private static final String GET_SERVICE_ENTRY_SQL = "select * from {0} where {1} >= ? and {2} <= ?"; - - @Override public JsonObject load(int applicationId, String entryServiceName, long startTime, long endTime, int from, - int size) { - H2Client client = getClient(); - String sql = GET_SERVICE_ENTRY_SQL; - List params = new ArrayList<>(); - List columns = new ArrayList<>(); - columns.add(ServiceEntryTable.TABLE); - columns.add(ServiceEntryTable.COLUMN_NEWEST_TIME); - columns.add(ServiceEntryTable.COLUMN_REGISTER_TIME); - params.add(startTime); - params.add(endTime); - int paramIndex = 2; - if (applicationId != 0) { - paramIndex++; - sql = sql + " and {" + paramIndex + "} = ?"; - params.add(applicationId); - columns.add(ServiceEntryTable.COLUMN_APPLICATION_ID); - } - if (StringUtils.isNotEmpty(entryServiceName)) { - paramIndex++; - sql = sql + " and {" + paramIndex + "} = ?"; - params.add(entryServiceName); - columns.add(ServiceEntryTable.COLUMN_ENTRY_SERVICE_NAME); - } - sql = sql + " limit " + from + "," + size; - sql = SqlBuilder.buildSql(sql, columns); - Object[] p = params.toArray(new Object[0]); - JsonArray serviceArray = new JsonArray(); - JsonObject response = new JsonObject(); - int index = 0; - try (ResultSet rs = client.executeQuery(sql, p)) { - while (rs.next()) { - int appId = rs.getInt(ServiceEntryTable.COLUMN_APPLICATION_ID); - int entryServiceId = rs.getInt(ServiceEntryTable.COLUMN_ENTRY_SERVICE_ID); - String applicationCode = ApplicationCache.get(appId); - String entryServiceName1 = rs.getString(ServiceEntryTable.COLUMN_ENTRY_SERVICE_NAME); - - JsonObject row = new JsonObject(); - row.addProperty(ColumnNameUtils.INSTANCE.rename(ServiceEntryTable.COLUMN_ENTRY_SERVICE_ID), entryServiceId); - row.addProperty(ColumnNameUtils.INSTANCE.rename(ServiceEntryTable.COLUMN_ENTRY_SERVICE_NAME), entryServiceName1); - row.addProperty(ColumnNameUtils.INSTANCE.rename(ServiceEntryTable.COLUMN_APPLICATION_ID), appId); - row.addProperty("applicationCode", applicationCode); - serviceArray.add(row); - index++; - } - } catch (SQLException | H2ClientException e) { - logger.error(e.getMessage(), e); - } - response.addProperty("total", index); - response.add("array", serviceArray); - - return response; - } -} diff --git a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/ServiceReferenceEsDAO.java b/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/ServiceReferenceEsDAO.java deleted file mode 100644 index b92c34b9af..0000000000 --- a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/ServiceReferenceEsDAO.java +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.ui.dao; - -import com.google.gson.JsonObject; -import java.util.LinkedHashMap; -import java.util.Map; -import org.elasticsearch.action.search.SearchRequestBuilder; -import org.elasticsearch.action.search.SearchResponse; -import org.elasticsearch.action.search.SearchType; -import org.elasticsearch.index.query.BoolQueryBuilder; -import org.elasticsearch.index.query.QueryBuilders; -import org.elasticsearch.search.aggregations.AggregationBuilders; -import org.elasticsearch.search.aggregations.bucket.terms.Terms; -import org.elasticsearch.search.aggregations.metrics.sum.Sum; -import org.skywalking.apm.collector.cache.ServiceNameCache; -import org.skywalking.apm.collector.core.util.ColumnNameUtils; -import org.skywalking.apm.collector.core.util.Const; -import org.skywalking.apm.collector.storage.base.define.serviceref.ServiceReferenceTable; -import org.skywalking.apm.collector.storage.elasticsearch.dao.EsDAO; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class ServiceReferenceEsDAO extends EsDAO implements IServiceReferenceDAO { - - private final Logger logger = LoggerFactory.getLogger(ServiceReferenceEsDAO.class); - - @Override public Map load(int entryServiceId, long startTime, long endTime) { - SearchRequestBuilder searchRequestBuilder = getClient().prepareSearch(ServiceReferenceTable.TABLE); - searchRequestBuilder.setTypes(ServiceReferenceTable.TABLE_TYPE); - searchRequestBuilder.setSearchType(SearchType.DFS_QUERY_THEN_FETCH); - - BoolQueryBuilder boolQuery = QueryBuilders.boolQuery(); - boolQuery.must().add(QueryBuilders.rangeQuery(ServiceReferenceTable.COLUMN_TIME_BUCKET).gte(startTime).lte(endTime)); - boolQuery.must().add(QueryBuilders.rangeQuery(ServiceReferenceTable.COLUMN_TIME_BUCKET).gte(startTime).lte(endTime)); - - String entryServiceName = ServiceNameCache.getSplitServiceName(ServiceNameCache.get(entryServiceId)); - BoolQueryBuilder entryBoolQuery = QueryBuilders.boolQuery(); - entryBoolQuery.should().add(QueryBuilders.matchQuery(ServiceReferenceTable.COLUMN_ENTRY_SERVICE_ID, entryServiceId)); - entryBoolQuery.should().add(QueryBuilders.matchQuery(ServiceReferenceTable.COLUMN_ENTRY_SERVICE_NAME, entryServiceName)); - boolQuery.must(entryBoolQuery); - - searchRequestBuilder.setQuery(boolQuery); - searchRequestBuilder.setSize(0); - - return load(searchRequestBuilder); - } - - private Map load(SearchRequestBuilder searchRequestBuilder) { - searchRequestBuilder.addAggregation(AggregationBuilders.terms(ServiceReferenceTable.COLUMN_FRONT_SERVICE_ID).field(ServiceReferenceTable.COLUMN_FRONT_SERVICE_ID).size(100) - .subAggregation(AggregationBuilders.terms(ServiceReferenceTable.COLUMN_BEHIND_SERVICE_ID).field(ServiceReferenceTable.COLUMN_BEHIND_SERVICE_ID).size(100) - .subAggregation(AggregationBuilders.sum(ServiceReferenceTable.COLUMN_S1_LTE).field(ServiceReferenceTable.COLUMN_S1_LTE)) - .subAggregation(AggregationBuilders.sum(ServiceReferenceTable.COLUMN_S3_LTE).field(ServiceReferenceTable.COLUMN_S3_LTE)) - .subAggregation(AggregationBuilders.sum(ServiceReferenceTable.COLUMN_S5_LTE).field(ServiceReferenceTable.COLUMN_S5_LTE)) - .subAggregation(AggregationBuilders.sum(ServiceReferenceTable.COLUMN_S5_GT).field(ServiceReferenceTable.COLUMN_S5_GT)) - .subAggregation(AggregationBuilders.sum(ServiceReferenceTable.COLUMN_ERROR).field(ServiceReferenceTable.COLUMN_ERROR)) - .subAggregation(AggregationBuilders.sum(ServiceReferenceTable.COLUMN_SUMMARY).field(ServiceReferenceTable.COLUMN_SUMMARY)) - .subAggregation(AggregationBuilders.sum(ServiceReferenceTable.COLUMN_COST_SUMMARY).field(ServiceReferenceTable.COLUMN_COST_SUMMARY)))); - - Map serviceReferenceMap = new LinkedHashMap<>(); - - SearchResponse searchResponse = searchRequestBuilder.get(); - Terms frontServiceIdTerms = searchResponse.getAggregations().get(ServiceReferenceTable.COLUMN_FRONT_SERVICE_ID); - for (Terms.Bucket frontServiceBucket : frontServiceIdTerms.getBuckets()) { - int frontServiceId = frontServiceBucket.getKeyAsNumber().intValue(); - if (frontServiceId != 0) { - parseSubAggregate(serviceReferenceMap, frontServiceBucket, frontServiceId); - } - } - - return serviceReferenceMap; - } - - private void parseSubAggregate(Map serviceReferenceMap, - Terms.Bucket frontServiceBucket, - int frontServiceId) { - Terms behindServiceIdTerms = frontServiceBucket.getAggregations().get(ServiceReferenceTable.COLUMN_BEHIND_SERVICE_ID); - for (Terms.Bucket behindServiceIdBucket : behindServiceIdTerms.getBuckets()) { - int behindServiceId = behindServiceIdBucket.getKeyAsNumber().intValue(); - if (behindServiceId != 0) { - Sum s1LteSum = behindServiceIdBucket.getAggregations().get(ServiceReferenceTable.COLUMN_S1_LTE); - Sum s3LteSum = behindServiceIdBucket.getAggregations().get(ServiceReferenceTable.COLUMN_S3_LTE); - Sum s5LteSum = behindServiceIdBucket.getAggregations().get(ServiceReferenceTable.COLUMN_S5_LTE); - Sum s5GtSum = behindServiceIdBucket.getAggregations().get(ServiceReferenceTable.COLUMN_S5_GT); - Sum error = behindServiceIdBucket.getAggregations().get(ServiceReferenceTable.COLUMN_ERROR); - Sum summary = behindServiceIdBucket.getAggregations().get(ServiceReferenceTable.COLUMN_SUMMARY); - Sum costSum = behindServiceIdBucket.getAggregations().get(ServiceReferenceTable.COLUMN_COST_SUMMARY); - - String frontServiceName = ServiceNameCache.getSplitServiceName(ServiceNameCache.get(frontServiceId)); - String behindServiceName = ServiceNameCache.getSplitServiceName(ServiceNameCache.get(behindServiceId)); - - JsonObject serviceReference = new JsonObject(); - serviceReference.addProperty(ColumnNameUtils.INSTANCE.rename(ServiceReferenceTable.COLUMN_FRONT_SERVICE_ID), frontServiceId); - serviceReference.addProperty(ColumnNameUtils.INSTANCE.rename(ServiceReferenceTable.COLUMN_FRONT_SERVICE_NAME), frontServiceName); - serviceReference.addProperty(ColumnNameUtils.INSTANCE.rename(ServiceReferenceTable.COLUMN_BEHIND_SERVICE_ID), behindServiceId); - serviceReference.addProperty(ColumnNameUtils.INSTANCE.rename(ServiceReferenceTable.COLUMN_BEHIND_SERVICE_NAME), behindServiceName); - serviceReference.addProperty(ColumnNameUtils.INSTANCE.rename(ServiceReferenceTable.COLUMN_S1_LTE), (long)s1LteSum.getValue()); - serviceReference.addProperty(ColumnNameUtils.INSTANCE.rename(ServiceReferenceTable.COLUMN_S3_LTE), (long)s3LteSum.getValue()); - serviceReference.addProperty(ColumnNameUtils.INSTANCE.rename(ServiceReferenceTable.COLUMN_S5_LTE), (long)s5LteSum.getValue()); - serviceReference.addProperty(ColumnNameUtils.INSTANCE.rename(ServiceReferenceTable.COLUMN_S5_GT), (long)s5GtSum.getValue()); - serviceReference.addProperty(ColumnNameUtils.INSTANCE.rename(ServiceReferenceTable.COLUMN_ERROR), (long)error.getValue()); - serviceReference.addProperty(ColumnNameUtils.INSTANCE.rename(ServiceReferenceTable.COLUMN_SUMMARY), (long)summary.getValue()); - serviceReference.addProperty(ColumnNameUtils.INSTANCE.rename(ServiceReferenceTable.COLUMN_COST_SUMMARY), (long)costSum.getValue()); - - String id = serviceReference.get(ColumnNameUtils.INSTANCE.rename(ServiceReferenceTable.COLUMN_FRONT_SERVICE_ID)) + Const.ID_SPLIT + serviceReference.get(ColumnNameUtils.INSTANCE.rename(ServiceReferenceTable.COLUMN_BEHIND_SERVICE_ID)); - serviceReferenceMap.put(id, serviceReference); - } - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/ServiceReferenceH2DAO.java b/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/ServiceReferenceH2DAO.java deleted file mode 100644 index 768693a6c0..0000000000 --- a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/dao/ServiceReferenceH2DAO.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.ui.dao; - -import com.google.gson.JsonObject; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.LinkedHashMap; -import java.util.Map; -import org.skywalking.apm.collector.cache.ServiceNameCache; -import org.skywalking.apm.collector.client.h2.H2Client; -import org.skywalking.apm.collector.client.h2.H2ClientException; -import org.skywalking.apm.collector.core.util.ColumnNameUtils; -import org.skywalking.apm.collector.core.util.Const; -import org.skywalking.apm.collector.storage.base.define.serviceref.ServiceReferenceTable; -import org.skywalking.apm.collector.storage.h2.SqlBuilder; -import org.skywalking.apm.collector.storage.h2.base.dao.H2DAO; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng, clevertension - */ -public class ServiceReferenceH2DAO extends H2DAO implements IServiceReferenceDAO { - private final Logger logger = LoggerFactory.getLogger(ServiceReferenceH2DAO.class); - - private static final String GET_SRV_REF_LOAD1 = "select {3}, {4}, sum({5}) as {5}, sum({6}) as {6}, sum({7}) as {7}" + - ",sum({8}) as {8}, sum({9}) as {9}, sum({10}) as {10}, sum({11}) as {11} from {0} where {1} >= ? and {1} <= ? and {2} = ? group by {3}, {4}"; - - @Override public Map load(int entryServiceId, long startTime, long endTime) { - H2Client client = getClient(); - String sql = SqlBuilder.buildSql(GET_SRV_REF_LOAD1, ServiceReferenceTable.TABLE, - ServiceReferenceTable.COLUMN_TIME_BUCKET, ServiceReferenceTable.COLUMN_ENTRY_SERVICE_ID, - ServiceReferenceTable.COLUMN_FRONT_SERVICE_ID, ServiceReferenceTable.COLUMN_BEHIND_SERVICE_ID, - ServiceReferenceTable.COLUMN_S1_LTE, ServiceReferenceTable.COLUMN_S3_LTE, ServiceReferenceTable.COLUMN_S5_LTE, - ServiceReferenceTable.COLUMN_S5_GT, ServiceReferenceTable.COLUMN_ERROR, ServiceReferenceTable.COLUMN_SUMMARY, - ServiceReferenceTable.COLUMN_COST_SUMMARY); - Object[] params = new Object[] {startTime, endTime, entryServiceId}; - - return load(client, params, sql); - } - - private Map load(H2Client client, Object[] params, String sql) { - Map serviceReferenceMap = new LinkedHashMap<>(); - - try (ResultSet rs = client.executeQuery(sql, params)) { - while (rs.next()) { - int frontServiceId = rs.getInt(ServiceReferenceTable.COLUMN_FRONT_SERVICE_ID); - parseSubAggregate(serviceReferenceMap, rs, frontServiceId); - } - } catch (SQLException | H2ClientException e) { - logger.error(e.getMessage(), e); - } - return serviceReferenceMap; - } - - private void parseSubAggregate(Map serviceReferenceMap, ResultSet rs, - int frontServiceId) { - try { - int behindServiceId = rs.getInt(ServiceReferenceTable.COLUMN_BEHIND_SERVICE_ID); - if (behindServiceId != 0) { - long s1LteSum = rs.getLong(ServiceReferenceTable.COLUMN_S1_LTE); - long s3LteSum = rs.getLong(ServiceReferenceTable.COLUMN_S3_LTE); - long s5LteSum = rs.getLong(ServiceReferenceTable.COLUMN_S5_LTE); - long s5GtSum = rs.getLong(ServiceReferenceTable.COLUMN_S5_GT); - long error = rs.getLong(ServiceReferenceTable.COLUMN_ERROR); - long summary = rs.getLong(ServiceReferenceTable.COLUMN_SUMMARY); - long costSum = rs.getLong(ServiceReferenceTable.COLUMN_COST_SUMMARY); - - String frontServiceName = ServiceNameCache.getSplitServiceName(ServiceNameCache.get(frontServiceId)); - String behindServiceName = ServiceNameCache.getSplitServiceName(ServiceNameCache.get(behindServiceId)); - - JsonObject serviceReference = new JsonObject(); - serviceReference.addProperty(ColumnNameUtils.INSTANCE.rename(ServiceReferenceTable.COLUMN_FRONT_SERVICE_ID), frontServiceId); - serviceReference.addProperty(ColumnNameUtils.INSTANCE.rename(ServiceReferenceTable.COLUMN_FRONT_SERVICE_NAME), frontServiceName); - serviceReference.addProperty(ColumnNameUtils.INSTANCE.rename(ServiceReferenceTable.COLUMN_BEHIND_SERVICE_ID), behindServiceId); - serviceReference.addProperty(ColumnNameUtils.INSTANCE.rename(ServiceReferenceTable.COLUMN_BEHIND_SERVICE_NAME), behindServiceName); - serviceReference.addProperty(ColumnNameUtils.INSTANCE.rename(ServiceReferenceTable.COLUMN_S1_LTE), s1LteSum); - serviceReference.addProperty(ColumnNameUtils.INSTANCE.rename(ServiceReferenceTable.COLUMN_S3_LTE), s3LteSum); - serviceReference.addProperty(ColumnNameUtils.INSTANCE.rename(ServiceReferenceTable.COLUMN_S5_LTE), s5LteSum); - serviceReference.addProperty(ColumnNameUtils.INSTANCE.rename(ServiceReferenceTable.COLUMN_S5_GT), s5GtSum); - serviceReference.addProperty(ColumnNameUtils.INSTANCE.rename(ServiceReferenceTable.COLUMN_ERROR), error); - serviceReference.addProperty(ColumnNameUtils.INSTANCE.rename(ServiceReferenceTable.COLUMN_SUMMARY), summary); - serviceReference.addProperty(ColumnNameUtils.INSTANCE.rename(ServiceReferenceTable.COLUMN_COST_SUMMARY), costSum); - - String id = serviceReference.get(ColumnNameUtils.INSTANCE.rename(ServiceReferenceTable.COLUMN_FRONT_SERVICE_ID)) + Const.ID_SPLIT + serviceReference.get(ColumnNameUtils.INSTANCE.rename(ServiceReferenceTable.COLUMN_BEHIND_SERVICE_ID)); - serviceReferenceMap.put(id, serviceReference); - } - } catch (SQLException e) { - logger.error(e.getMessage(), e); - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/jetty/UIJettyConfig.java b/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/jetty/UIJettyConfig.java deleted file mode 100644 index bd47afca42..0000000000 --- a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/jetty/UIJettyConfig.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.ui.jetty; - -/** - * @author peng-yongsheng - */ -public class UIJettyConfig { - public static String HOST; - public static int PORT; - public static String CONTEXT_PATH; -} diff --git a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/jetty/UIJettyConfigParser.java b/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/jetty/UIJettyConfigParser.java deleted file mode 100644 index d65e63e3a4..0000000000 --- a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/jetty/UIJettyConfigParser.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.ui.jetty; - -import java.util.Map; -import org.skywalking.apm.collector.core.config.ConfigParseException; -import org.skywalking.apm.collector.core.module.ModuleConfigParser; -import org.skywalking.apm.collector.core.util.ObjectUtils; -import org.skywalking.apm.collector.core.util.StringUtils; - -/** - * @author peng-yongsheng - */ -public class UIJettyConfigParser implements ModuleConfigParser { - - private static final String HOST = "host"; - private static final String PORT = "port"; - public static final String CONTEXT_PATH = "contextPath"; - - @Override public void parse(Map config) throws ConfigParseException { - UIJettyConfig.CONTEXT_PATH = "/"; - - if (ObjectUtils.isEmpty(config) || StringUtils.isEmpty(config.get(HOST))) { - UIJettyConfig.HOST = "localhost"; - } else { - UIJettyConfig.HOST = (String)config.get(HOST); - } - - if (ObjectUtils.isEmpty(config) || StringUtils.isEmpty(config.get(PORT))) { - UIJettyConfig.PORT = 12800; - } else { - UIJettyConfig.PORT = (Integer)config.get(PORT); - } - if (ObjectUtils.isNotEmpty(config) && StringUtils.isNotEmpty(config.get(CONTEXT_PATH))) { - UIJettyConfig.CONTEXT_PATH = (String)config.get(CONTEXT_PATH); - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/jetty/UIJettyDataListener.java b/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/jetty/UIJettyDataListener.java deleted file mode 100644 index c3fca97025..0000000000 --- a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/jetty/UIJettyDataListener.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.ui.jetty; - -import org.skywalking.apm.collector.cluster.ClusterModuleDefine; -import org.skywalking.apm.collector.core.cluster.ClusterDataListener; -import org.skywalking.apm.collector.ui.UIModuleGroupDefine; - -/** - * @author peng-yongsheng - */ -public class UIJettyDataListener extends ClusterDataListener { - - public static final String PATH = ClusterModuleDefine.BASE_CATALOG + "." + UIModuleGroupDefine.GROUP_NAME + "." + UIJettyModuleDefine.MODULE_NAME; - - @Override public String path() { - return PATH; - } - - @Override public void serverJoinNotify(String serverAddress) { - - } - - @Override public void serverQuitNotify(String serverAddress) { - } -} diff --git a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/jetty/UIJettyModuleDefine.java b/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/jetty/UIJettyModuleDefine.java deleted file mode 100644 index 7f01ba0f35..0000000000 --- a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/jetty/UIJettyModuleDefine.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.ui.jetty; - -import java.util.LinkedList; -import java.util.List; -import org.skywalking.apm.collector.core.cluster.ClusterDataListener; -import org.skywalking.apm.collector.core.framework.Handler; -import org.skywalking.apm.collector.core.module.ModuleConfigParser; -import org.skywalking.apm.collector.core.module.ModuleRegistration; -import org.skywalking.apm.collector.core.server.Server; -import org.skywalking.apm.collector.server.jetty.JettyServer; -import org.skywalking.apm.collector.ui.UIModuleDefine; -import org.skywalking.apm.collector.ui.UIModuleGroupDefine; -import org.skywalking.apm.collector.ui.jetty.handler.SegmentTopGetHandler; -import org.skywalking.apm.collector.ui.jetty.handler.SpanGetHandler; -import org.skywalking.apm.collector.ui.jetty.handler.TraceDagGetHandler; -import org.skywalking.apm.collector.ui.jetty.handler.TraceStackGetHandler; -import org.skywalking.apm.collector.ui.jetty.handler.application.ApplicationsGetHandler; -import org.skywalking.apm.collector.ui.jetty.handler.instancehealth.InstanceHealthGetHandler; -import org.skywalking.apm.collector.ui.jetty.handler.instancemetric.InstanceMetricGetOneTimeBucketHandler; -import org.skywalking.apm.collector.ui.jetty.handler.instancemetric.InstanceMetricGetRangeTimeBucketHandler; -import org.skywalking.apm.collector.ui.jetty.handler.instancemetric.InstanceOsInfoGetHandler; -import org.skywalking.apm.collector.ui.jetty.handler.servicetree.EntryServiceGetHandler; -import org.skywalking.apm.collector.ui.jetty.handler.servicetree.ServiceTreeGetByIdHandler; -import org.skywalking.apm.collector.ui.jetty.handler.time.AllInstanceLastTimeGetHandler; -import org.skywalking.apm.collector.ui.jetty.handler.time.OneInstanceLastTimeGetHandler; - -/** - * @author peng-yongsheng - */ -public class UIJettyModuleDefine extends UIModuleDefine { - - public static final String MODULE_NAME = "jetty"; - - @Override protected String group() { - return UIModuleGroupDefine.GROUP_NAME; - } - - @Override public String name() { - return MODULE_NAME; - } - - @Override protected ModuleConfigParser configParser() { - return new UIJettyConfigParser(); - } - - @Override protected Server server() { - return new JettyServer(UIJettyConfig.HOST, UIJettyConfig.PORT, UIJettyConfig.CONTEXT_PATH); - } - - @Override protected ModuleRegistration registration() { - return new UIJettyModuleRegistration(); - } - - @Override public ClusterDataListener listener() { - return new UIJettyDataListener(); - } - - @Override public List handlerList() { - List handlers = new LinkedList<>(); - handlers.add(new TraceDagGetHandler()); - handlers.add(new SegmentTopGetHandler()); - handlers.add(new TraceStackGetHandler()); - handlers.add(new SpanGetHandler()); - handlers.add(new OneInstanceLastTimeGetHandler()); - handlers.add(new AllInstanceLastTimeGetHandler()); - handlers.add(new InstanceHealthGetHandler()); - handlers.add(new ApplicationsGetHandler()); - handlers.add(new InstanceOsInfoGetHandler()); - handlers.add(new InstanceMetricGetOneTimeBucketHandler()); - handlers.add(new InstanceMetricGetRangeTimeBucketHandler()); - handlers.add(new EntryServiceGetHandler()); - handlers.add(new ServiceTreeGetByIdHandler()); - return handlers; - } -} diff --git a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/jetty/UIJettyModuleRegistration.java b/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/jetty/UIJettyModuleRegistration.java deleted file mode 100644 index 1541ab41a1..0000000000 --- a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/jetty/UIJettyModuleRegistration.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.ui.jetty; - -import org.skywalking.apm.collector.core.module.ModuleRegistration; - -/** - * @author peng-yongsheng - */ -public class UIJettyModuleRegistration extends ModuleRegistration { - - @Override public Value buildValue() { - return new Value(UIJettyConfig.HOST, UIJettyConfig.PORT, UIJettyConfig.CONTEXT_PATH); - } -} diff --git a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/jetty/handler/SegmentTopGetHandler.java b/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/jetty/handler/SegmentTopGetHandler.java deleted file mode 100644 index 79c9c0d65b..0000000000 --- a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/jetty/handler/SegmentTopGetHandler.java +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.ui.jetty.handler; - -import com.google.gson.JsonElement; -import javax.servlet.http.HttpServletRequest; -import org.skywalking.apm.collector.core.util.StringUtils; -import org.skywalking.apm.collector.server.jetty.ArgumentsParseException; -import org.skywalking.apm.collector.server.jetty.JettyHandler; -import org.skywalking.apm.collector.ui.dao.ISegmentCostDAO; -import org.skywalking.apm.collector.ui.service.SegmentTopService; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class SegmentTopGetHandler extends JettyHandler { - - private final Logger logger = LoggerFactory.getLogger(SegmentTopGetHandler.class); - - @Override public String pathSpec() { - return "/segment/top"; - } - - private SegmentTopService service = new SegmentTopService(); - - @Override protected JsonElement doGet(HttpServletRequest req) throws ArgumentsParseException { - if (!req.getParameterMap().containsKey("startTime") || !req.getParameterMap().containsKey("endTime") || !req.getParameterMap().containsKey("from") || !req.getParameterMap().containsKey("limit")) { - throw new ArgumentsParseException("the request parameter must contains startTime, endTime, from, limit"); - } - - if (logger.isDebugEnabled()) { - logger.debug("startTime: {}, endTime: {}, from: {}", req.getParameter("startTime"), req.getParameter("endTime"), req.getParameter("from")); - } - - long startTime; - try { - startTime = Long.valueOf(req.getParameter("startTime")); - } catch (NumberFormatException e) { - throw new ArgumentsParseException("the request parameter startTime must be a long"); - } - - long endTime; - try { - endTime = Long.valueOf(req.getParameter("endTime")); - } catch (NumberFormatException e) { - throw new ArgumentsParseException("the request parameter endTime must be a long"); - } - - int from; - try { - from = Integer.valueOf(req.getParameter("from")); - } catch (NumberFormatException e) { - throw new ArgumentsParseException("the request parameter from must be an integer"); - } - - int limit; - try { - limit = Integer.valueOf(req.getParameter("limit")); - } catch (NumberFormatException e) { - throw new ArgumentsParseException("the request parameter from must be an integer"); - } - - int minCost = -1; - if (req.getParameterMap().containsKey("minCost")) { - minCost = Integer.valueOf(req.getParameter("minCost")); - } - int maxCost = -1; - if (req.getParameterMap().containsKey("maxCost")) { - maxCost = Integer.valueOf(req.getParameter("maxCost")); - } - - String globalTraceId = null; - if (req.getParameterMap().containsKey("globalTraceId")) { - globalTraceId = req.getParameter("globalTraceId"); - } - - String operationName = null; - if (req.getParameterMap().containsKey("operationName")) { - operationName = req.getParameter("operationName"); - } - - int applicationId; - try { - applicationId = Integer.valueOf(req.getParameter("applicationId")); - } catch (NumberFormatException e) { - throw new ArgumentsParseException("the request parameter applicationId must be a int"); - } - - ISegmentCostDAO.Error error; - String errorStr = req.getParameter("error"); - if (StringUtils.isNotEmpty(errorStr)) { - if ("true".equals(errorStr)) { - error = ISegmentCostDAO.Error.True; - } else if ("false".equals(errorStr)) { - error = ISegmentCostDAO.Error.False; - } else { - error = ISegmentCostDAO.Error.All; - } - } else { - error = ISegmentCostDAO.Error.All; - } - - ISegmentCostDAO.Sort sort = ISegmentCostDAO.Sort.Cost; - if (req.getParameterMap().containsKey("sort")) { - String sortStr = req.getParameter("sort"); - if (sortStr.toLowerCase().equals(ISegmentCostDAO.Sort.Time.name().toLowerCase())) { - sort = ISegmentCostDAO.Sort.Time; - } - } - - return service.loadTop(startTime, endTime, minCost, maxCost, operationName, globalTraceId, error, applicationId, limit, from, sort); - } - - @Override protected JsonElement doPost(HttpServletRequest req) throws ArgumentsParseException { - throw new UnsupportedOperationException(); - } -} diff --git a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/jetty/handler/SpanGetHandler.java b/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/jetty/handler/SpanGetHandler.java deleted file mode 100644 index 9bdfdac2c3..0000000000 --- a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/jetty/handler/SpanGetHandler.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.ui.jetty.handler; - -import com.google.gson.JsonElement; -import javax.servlet.http.HttpServletRequest; -import org.skywalking.apm.collector.server.jetty.ArgumentsParseException; -import org.skywalking.apm.collector.server.jetty.JettyHandler; -import org.skywalking.apm.collector.ui.service.SpanService; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class SpanGetHandler extends JettyHandler { - - private final Logger logger = LoggerFactory.getLogger(SpanGetHandler.class); - - @Override public String pathSpec() { - return "/span/spanId"; - } - - private SpanService service = new SpanService(); - - @Override protected JsonElement doGet(HttpServletRequest req) throws ArgumentsParseException { - String segmentId = req.getParameter("segmentId"); - String spanIdStr = req.getParameter("spanId"); - logger.debug("segmentSpanId: {}, spanIdStr: {}", segmentId, spanIdStr); - - int spanId; - try { - spanId = Integer.parseInt(spanIdStr); - } catch (NumberFormatException e) { - throw new ArgumentsParseException("span id must be integer"); - } - - return service.load(segmentId, spanId); - } - - @Override protected JsonElement doPost(HttpServletRequest req) throws ArgumentsParseException { - throw new UnsupportedOperationException(); - } -} diff --git a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/jetty/handler/TraceDagGetHandler.java b/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/jetty/handler/TraceDagGetHandler.java deleted file mode 100644 index 9a2d507958..0000000000 --- a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/jetty/handler/TraceDagGetHandler.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.ui.jetty.handler; - -import com.google.gson.JsonElement; -import javax.servlet.http.HttpServletRequest; -import org.skywalking.apm.collector.server.jetty.ArgumentsParseException; -import org.skywalking.apm.collector.server.jetty.JettyHandler; -import org.skywalking.apm.collector.ui.service.TraceDagService; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class TraceDagGetHandler extends JettyHandler { - - private final Logger logger = LoggerFactory.getLogger(TraceDagGetHandler.class); - - @Override public String pathSpec() { - return "/traceDag"; - } - - private TraceDagService service = new TraceDagService(); - - @Override protected JsonElement doGet(HttpServletRequest req) throws ArgumentsParseException { - if (!req.getParameterMap().containsKey("startTime") || !req.getParameterMap().containsKey("endTime")) { - throw new ArgumentsParseException("the request parameter must contains startTime, endTime"); - } - - String startTimeStr = req.getParameter("startTime"); - String endTimeStr = req.getParameter("endTime"); - logger.debug("startTime: {}, endTimeStr: {}", startTimeStr, endTimeStr); - - long startTime; - try { - startTime = Long.valueOf(req.getParameter("startTime")); - } catch (NumberFormatException e) { - throw new ArgumentsParseException("the request parameter startTime must be a long"); - } - - long endTime; - try { - endTime = Long.valueOf(req.getParameter("endTime")); - } catch (NumberFormatException e) { - throw new ArgumentsParseException("the request parameter endTime must be a long"); - } - - return service.load(startTime, endTime); - } - - @Override protected JsonElement doPost(HttpServletRequest req) throws ArgumentsParseException { - throw new UnsupportedOperationException(); - } -} diff --git a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/jetty/handler/TraceStackGetHandler.java b/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/jetty/handler/TraceStackGetHandler.java deleted file mode 100644 index 9358d6f6ce..0000000000 --- a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/jetty/handler/TraceStackGetHandler.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.ui.jetty.handler; - -import com.google.gson.JsonElement; -import javax.servlet.http.HttpServletRequest; -import org.skywalking.apm.collector.server.jetty.ArgumentsParseException; -import org.skywalking.apm.collector.server.jetty.JettyHandler; -import org.skywalking.apm.collector.ui.service.TraceStackService; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class TraceStackGetHandler extends JettyHandler { - - private final Logger logger = LoggerFactory.getLogger(TraceStackGetHandler.class); - - @Override public String pathSpec() { - return "/traceStack/globalTraceId"; - } - - private TraceStackService service = new TraceStackService(); - - @Override protected JsonElement doGet(HttpServletRequest req) throws ArgumentsParseException { - String globalTraceId = req.getParameter("globalTraceId"); - logger.debug("globalTraceId: {}", globalTraceId); - - return service.load(globalTraceId); - } - - @Override protected JsonElement doPost(HttpServletRequest req) throws ArgumentsParseException { - throw new UnsupportedOperationException(); - } -} diff --git a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/jetty/handler/application/ApplicationsGetHandler.java b/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/jetty/handler/application/ApplicationsGetHandler.java deleted file mode 100644 index 7377213a1f..0000000000 --- a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/jetty/handler/application/ApplicationsGetHandler.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.ui.jetty.handler.application; - -import com.google.gson.JsonElement; -import javax.servlet.http.HttpServletRequest; -import org.skywalking.apm.collector.server.jetty.ArgumentsParseException; -import org.skywalking.apm.collector.server.jetty.JettyHandler; -import org.skywalking.apm.collector.ui.service.ApplicationService; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class ApplicationsGetHandler extends JettyHandler { - - private final Logger logger = LoggerFactory.getLogger(ApplicationsGetHandler.class); - - @Override public String pathSpec() { - return "/applications"; - } - - private ApplicationService service = new ApplicationService(); - - @Override protected JsonElement doGet(HttpServletRequest req) throws ArgumentsParseException { - if (!req.getParameterMap().containsKey("startTime") || !req.getParameterMap().containsKey("endTime")) { - throw new ArgumentsParseException("must contains startTime. endTime parameter"); - } - - String startTimeStr = req.getParameter("startTime"); - String endTimeStr = req.getParameter("endTime"); - logger.debug("applications get start time: {}, end time: {}", startTimeStr, endTimeStr); - - long startTime; - try { - startTime = Long.parseLong(startTimeStr); - } catch (NumberFormatException e) { - throw new ArgumentsParseException("start time must be long"); - } - - long endTime; - try { - endTime = Long.parseLong(endTimeStr); - } catch (NumberFormatException e) { - throw new ArgumentsParseException("end time must be long"); - } - - return service.getApplications(startTime, endTime); - } - - @Override protected JsonElement doPost(HttpServletRequest req) throws ArgumentsParseException { - throw new UnsupportedOperationException(); - } -} diff --git a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/jetty/handler/instancehealth/InstanceHealthGetHandler.java b/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/jetty/handler/instancehealth/InstanceHealthGetHandler.java deleted file mode 100644 index 31ad765acb..0000000000 --- a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/jetty/handler/instancehealth/InstanceHealthGetHandler.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.ui.jetty.handler.instancehealth; - -import com.google.gson.JsonArray; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import javax.servlet.http.HttpServletRequest; -import org.skywalking.apm.collector.server.jetty.ArgumentsParseException; -import org.skywalking.apm.collector.server.jetty.JettyHandler; -import org.skywalking.apm.collector.ui.service.InstanceHealthService; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class InstanceHealthGetHandler extends JettyHandler { - - private final Logger logger = LoggerFactory.getLogger(InstanceHealthGetHandler.class); - - @Override public String pathSpec() { - return "/instance/health/applicationId"; - } - - private InstanceHealthService service = new InstanceHealthService(); - - @Override protected JsonElement doGet(HttpServletRequest req) throws ArgumentsParseException { - String timeBucketStr = req.getParameter("timeBucket"); - String[] applicationIdsStr = req.getParameterValues("applicationIds"); - logger.debug("instance health get timeBucket: {}, applicationIdsStr: {}", timeBucketStr, applicationIdsStr); - - long timeBucket; - try { - timeBucket = Long.parseLong(timeBucketStr); - } catch (NumberFormatException e) { - throw new ArgumentsParseException("timestamp must be long"); - } - - int[] applicationIds = new int[applicationIdsStr.length]; - for (int i = 0; i < applicationIdsStr.length; i++) { - try { - applicationIds[i] = Integer.parseInt(applicationIdsStr[i]); - } catch (NumberFormatException e) { - throw new ArgumentsParseException("application id must be integer"); - } - } - - JsonObject response = new JsonObject(); - response.addProperty("timeBucket", timeBucket); - JsonArray appInstances = new JsonArray(); - response.add("appInstances", appInstances); - - for (int applicationId : applicationIds) { - appInstances.add(service.getInstances(timeBucket, applicationId)); - } - return response; - } - - @Override protected JsonElement doPost(HttpServletRequest req) throws ArgumentsParseException { - throw new UnsupportedOperationException(); - } -} diff --git a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/jetty/handler/instancemetric/InstanceMetricGetOneTimeBucketHandler.java b/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/jetty/handler/instancemetric/InstanceMetricGetOneTimeBucketHandler.java deleted file mode 100644 index bf3a833e8f..0000000000 --- a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/jetty/handler/instancemetric/InstanceMetricGetOneTimeBucketHandler.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.ui.jetty.handler.instancemetric; - -import com.google.gson.JsonElement; -import java.util.LinkedHashSet; -import java.util.Set; -import javax.servlet.http.HttpServletRequest; -import org.skywalking.apm.collector.server.jetty.ArgumentsParseException; -import org.skywalking.apm.collector.server.jetty.JettyHandler; -import org.skywalking.apm.collector.ui.service.InstanceJVMService; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class InstanceMetricGetOneTimeBucketHandler extends JettyHandler { - - private final Logger logger = LoggerFactory.getLogger(InstanceMetricGetOneTimeBucketHandler.class); - - @Override public String pathSpec() { - return "/instance/jvm/instanceId/oneBucket"; - } - - private InstanceJVMService service = new InstanceJVMService(); - - @Override protected JsonElement doGet(HttpServletRequest req) throws ArgumentsParseException { - String timeBucketStr = req.getParameter("timeBucket"); - String instanceIdStr = req.getParameter("instanceId"); - String[] metricTypes = req.getParameterValues("metricTypes"); - - logger.debug("instance jvm metric get timeBucket: {}, instance id: {}, metric types: {}", timeBucketStr, instanceIdStr, metricTypes); - - long timeBucket; - try { - timeBucket = Long.parseLong(timeBucketStr); - } catch (NumberFormatException e) { - throw new ArgumentsParseException("timeBucket must be long"); - } - - int instanceId; - try { - instanceId = Integer.parseInt(instanceIdStr); - } catch (NumberFormatException e) { - throw new ArgumentsParseException("instance id must be integer"); - } - - if (metricTypes.length == 0) { - throw new ArgumentsParseException("at least one metric type"); - } - - Set metricTypeSet = new LinkedHashSet<>(); - for (String metricType : metricTypes) { - metricTypeSet.add(metricType); - } - - return service.getInstanceJvmMetric(instanceId, metricTypeSet, timeBucket); - } - - @Override protected JsonElement doPost(HttpServletRequest req) throws ArgumentsParseException { - throw new UnsupportedOperationException(); - } -} diff --git a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/jetty/handler/instancemetric/InstanceMetricGetRangeTimeBucketHandler.java b/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/jetty/handler/instancemetric/InstanceMetricGetRangeTimeBucketHandler.java deleted file mode 100644 index e81400acbf..0000000000 --- a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/jetty/handler/instancemetric/InstanceMetricGetRangeTimeBucketHandler.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.ui.jetty.handler.instancemetric; - -import com.google.gson.JsonElement; -import java.util.LinkedHashSet; -import java.util.Set; -import javax.servlet.http.HttpServletRequest; -import org.skywalking.apm.collector.server.jetty.ArgumentsParseException; -import org.skywalking.apm.collector.server.jetty.JettyHandler; -import org.skywalking.apm.collector.ui.service.InstanceJVMService; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class InstanceMetricGetRangeTimeBucketHandler extends JettyHandler { - - private final Logger logger = LoggerFactory.getLogger(InstanceMetricGetRangeTimeBucketHandler.class); - - @Override public String pathSpec() { - return "/instance/jvm/instanceId/rangeBucket"; - } - - private InstanceJVMService service = new InstanceJVMService(); - - @Override protected JsonElement doGet(HttpServletRequest req) throws ArgumentsParseException { - String startTimeBucketStr = req.getParameter("startTimeBucket"); - String endTimeBucketStr = req.getParameter("endTimeBucket"); - String instanceIdStr = req.getParameter("instanceId"); - String[] metricTypes = req.getParameterValues("metricTypes"); - - logger.debug("instance jvm metric get start timeBucket: {}, end timeBucket:{} , instance id: {}, metric types: {}", startTimeBucketStr, endTimeBucketStr, instanceIdStr, metricTypes); - - long startTimeBucket; - try { - startTimeBucket = Long.parseLong(startTimeBucketStr); - } catch (NumberFormatException e) { - throw new ArgumentsParseException("start timeBucket must be long"); - } - - long endTimeBucket; - try { - endTimeBucket = Long.parseLong(endTimeBucketStr); - } catch (NumberFormatException e) { - throw new ArgumentsParseException("end timeBucket must be long"); - } - - int instanceId; - try { - instanceId = Integer.parseInt(instanceIdStr); - } catch (NumberFormatException e) { - throw new ArgumentsParseException("instance id must be integer"); - } - - if (metricTypes.length == 0) { - throw new ArgumentsParseException("at least one metric type"); - } - - Set metricTypeSet = new LinkedHashSet<>(); - for (String metricType : metricTypes) { - metricTypeSet.add(metricType); - } - - return service.getInstanceJvmMetrics(instanceId, metricTypeSet, startTimeBucket, endTimeBucket); - } - - @Override protected JsonElement doPost(HttpServletRequest req) throws ArgumentsParseException { - throw new UnsupportedOperationException(); - } -} diff --git a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/jetty/handler/instancemetric/InstanceOsInfoGetHandler.java b/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/jetty/handler/instancemetric/InstanceOsInfoGetHandler.java deleted file mode 100644 index 65f3ab603d..0000000000 --- a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/jetty/handler/instancemetric/InstanceOsInfoGetHandler.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.ui.jetty.handler.instancemetric; - -import com.google.gson.JsonElement; -import javax.servlet.http.HttpServletRequest; -import org.skywalking.apm.collector.server.jetty.ArgumentsParseException; -import org.skywalking.apm.collector.server.jetty.JettyHandler; -import org.skywalking.apm.collector.ui.service.InstanceJVMService; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class InstanceOsInfoGetHandler extends JettyHandler { - - private final Logger logger = LoggerFactory.getLogger(InstanceOsInfoGetHandler.class); - - @Override public String pathSpec() { - return "/instance/os/instanceId"; - } - - private InstanceJVMService service = new InstanceJVMService(); - - @Override protected JsonElement doGet(HttpServletRequest req) throws ArgumentsParseException { - String instanceIdStr = req.getParameter("instanceId"); - logger.debug("instance os info get, instance id: {}", instanceIdStr); - - int instanceId; - try { - instanceId = Integer.parseInt(instanceIdStr); - } catch (NumberFormatException e) { - throw new ArgumentsParseException("instance id must be integer"); - } - - return service.getInstanceOsInfo(instanceId); - } - - @Override protected JsonElement doPost(HttpServletRequest req) throws ArgumentsParseException { - throw new UnsupportedOperationException(); - } -} diff --git a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/jetty/handler/servicetree/EntryServiceGetHandler.java b/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/jetty/handler/servicetree/EntryServiceGetHandler.java deleted file mode 100644 index cd36b47116..0000000000 --- a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/jetty/handler/servicetree/EntryServiceGetHandler.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.ui.jetty.handler.servicetree; - -import com.google.gson.JsonElement; -import javax.servlet.http.HttpServletRequest; -import org.skywalking.apm.collector.server.jetty.ArgumentsParseException; -import org.skywalking.apm.collector.server.jetty.JettyHandler; -import org.skywalking.apm.collector.ui.service.ServiceTreeService; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class EntryServiceGetHandler extends JettyHandler { - - private final Logger logger = LoggerFactory.getLogger(EntryServiceGetHandler.class); - - @Override public String pathSpec() { - return "/service/entry"; - } - - private ServiceTreeService service = new ServiceTreeService(); - - @Override protected JsonElement doGet(HttpServletRequest req) throws ArgumentsParseException { - if (!req.getParameterMap().containsKey("applicationId") || !req.getParameterMap().containsKey("entryServiceName") - || !req.getParameterMap().containsKey("startTime") || !req.getParameterMap().containsKey("endTime") - || !req.getParameterMap().containsKey("from") || !req.getParameterMap().containsKey("size")) { - throw new ArgumentsParseException("must contains parameters: applicationId, entryServiceName, startTime, endTime, from, size"); - } - - String applicationIdStr = req.getParameter("applicationId"); - String entryServiceName = req.getParameter("entryServiceName"); - String startTimeStr = req.getParameter("startTime"); - String endTimeStr = req.getParameter("endTime"); - String fromStr = req.getParameter("from"); - String sizeStr = req.getParameter("size"); - logger.debug("service entry get applicationId: {}, entryServiceName: {}, startTime: {}, endTime: {}, from: {}, size: {}", applicationIdStr, entryServiceName, startTimeStr, endTimeStr, fromStr, sizeStr); - - int applicationId; - try { - applicationId = Integer.parseInt(applicationIdStr); - } catch (NumberFormatException e) { - throw new ArgumentsParseException("application id must be integer"); - } - - long startTime; - try { - startTime = Long.parseLong(startTimeStr); - } catch (NumberFormatException e) { - throw new ArgumentsParseException("start time must be long"); - } - - long endTime; - try { - endTime = Long.parseLong(endTimeStr); - } catch (NumberFormatException e) { - throw new ArgumentsParseException("end time must be long"); - } - - int from; - try { - from = Integer.parseInt(fromStr); - } catch (NumberFormatException e) { - throw new ArgumentsParseException("from must be integer"); - } - - int size; - try { - size = Integer.parseInt(sizeStr); - } catch (NumberFormatException e) { - throw new ArgumentsParseException("size must be integer"); - } - - return service.loadEntryService(applicationId, entryServiceName, startTime, endTime, from, size); - } - - @Override protected JsonElement doPost(HttpServletRequest req) throws ArgumentsParseException { - throw new UnsupportedOperationException(); - } -} diff --git a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/jetty/handler/servicetree/ServiceTreeGetByIdHandler.java b/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/jetty/handler/servicetree/ServiceTreeGetByIdHandler.java deleted file mode 100644 index f68cc9802b..0000000000 --- a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/jetty/handler/servicetree/ServiceTreeGetByIdHandler.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.ui.jetty.handler.servicetree; - -import com.google.gson.JsonElement; -import javax.servlet.http.HttpServletRequest; -import org.skywalking.apm.collector.server.jetty.ArgumentsParseException; -import org.skywalking.apm.collector.server.jetty.JettyHandler; -import org.skywalking.apm.collector.ui.service.ServiceTreeService; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class ServiceTreeGetByIdHandler extends JettyHandler { - - private final Logger logger = LoggerFactory.getLogger(ServiceTreeGetByIdHandler.class); - - @Override public String pathSpec() { - return "/service/tree/entryServiceId"; - } - - private ServiceTreeService service = new ServiceTreeService(); - - @Override protected JsonElement doGet(HttpServletRequest req) throws ArgumentsParseException { - if (!req.getParameterMap().containsKey("entryServiceId") || !req.getParameterMap().containsKey("startTime") || !req.getParameterMap().containsKey("endTime")) { - throw new ArgumentsParseException("must contains parameters: entryServiceId, startTime, endTime"); - } - - String entryServiceIdStr = req.getParameter("entryServiceId"); - String startTimeStr = req.getParameter("startTime"); - String endTimeStr = req.getParameter("endTime"); - logger.debug("service entry get entryServiceId: {}, startTime: {}, endTime: {}", entryServiceIdStr, startTimeStr, endTimeStr); - - int entryServiceId; - try { - entryServiceId = Integer.parseInt(entryServiceIdStr); - } catch (NumberFormatException e) { - throw new ArgumentsParseException("entry service id must be integer"); - } - - long startTime; - try { - startTime = Long.parseLong(startTimeStr); - } catch (NumberFormatException e) { - throw new ArgumentsParseException("start time must be long"); - } - - long endTime; - try { - endTime = Long.parseLong(endTimeStr); - } catch (NumberFormatException e) { - throw new ArgumentsParseException("end time must be long"); - } - - return service.loadServiceTree(entryServiceId, startTime, endTime); - } - - @Override protected JsonElement doPost(HttpServletRequest req) throws ArgumentsParseException { - throw new UnsupportedOperationException(); - } -} diff --git a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/jetty/handler/time/AllInstanceLastTimeGetHandler.java b/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/jetty/handler/time/AllInstanceLastTimeGetHandler.java deleted file mode 100644 index 9da2beca28..0000000000 --- a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/jetty/handler/time/AllInstanceLastTimeGetHandler.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.ui.jetty.handler.time; - -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import java.util.Calendar; -import javax.servlet.http.HttpServletRequest; -import org.skywalking.apm.collector.core.util.TimeBucketUtils; -import org.skywalking.apm.collector.server.jetty.ArgumentsParseException; -import org.skywalking.apm.collector.server.jetty.JettyHandler; -import org.skywalking.apm.collector.ui.service.TimeSynchronousService; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class AllInstanceLastTimeGetHandler extends JettyHandler { - - private final Logger logger = LoggerFactory.getLogger(AllInstanceLastTimeGetHandler.class); - - @Override public String pathSpec() { - return "/time/allInstance"; - } - - private TimeSynchronousService service = new TimeSynchronousService(); - - @Override protected JsonElement doGet(HttpServletRequest req) throws ArgumentsParseException { - Long timeBucket = service.allInstanceLastTime(); - logger.debug("all instance last time: {}", timeBucket); - - if (timeBucket == 0) { - timeBucket = TimeBucketUtils.INSTANCE.getSecondTimeBucket(System.currentTimeMillis()); - } - Calendar calendar = Calendar.getInstance(); - calendar.setTimeInMillis(TimeBucketUtils.INSTANCE.changeTimeBucket2TimeStamp(TimeBucketUtils.TimeBucketType.SECOND.name(), timeBucket)); - calendar.add(Calendar.SECOND, -5); - timeBucket = calendar.getTimeInMillis(); - - JsonObject timeJson = new JsonObject(); - timeJson.addProperty("timeBucket", TimeBucketUtils.INSTANCE.getSecondTimeBucket(timeBucket)); - return timeJson; - } - - @Override protected JsonElement doPost(HttpServletRequest req) throws ArgumentsParseException { - throw new UnsupportedOperationException(); - } -} diff --git a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/jetty/handler/time/OneInstanceLastTimeGetHandler.java b/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/jetty/handler/time/OneInstanceLastTimeGetHandler.java deleted file mode 100644 index fc6b6705f9..0000000000 --- a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/jetty/handler/time/OneInstanceLastTimeGetHandler.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.ui.jetty.handler.time; - -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import javax.servlet.http.HttpServletRequest; -import org.skywalking.apm.collector.server.jetty.ArgumentsParseException; -import org.skywalking.apm.collector.server.jetty.JettyHandler; -import org.skywalking.apm.collector.ui.service.TimeSynchronousService; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class OneInstanceLastTimeGetHandler extends JettyHandler { - - private final Logger logger = LoggerFactory.getLogger(OneInstanceLastTimeGetHandler.class); - - @Override public String pathSpec() { - return "/time/oneInstance"; - } - - private TimeSynchronousService service = new TimeSynchronousService(); - - @Override protected JsonElement doGet(HttpServletRequest req) throws ArgumentsParseException { - String instanceIdStr = req.getParameter("instanceId"); - logger.debug("instanceId: {}", instanceIdStr); - - int instanceId; - try { - instanceId = Integer.parseInt(instanceIdStr); - } catch (NumberFormatException e) { - throw new ArgumentsParseException("application instance id must be integer"); - } - - Long time = service.instanceLastTime(instanceId); - logger.debug("application instance id: {}, instance last time: {}", instanceId, time); - JsonObject timeJson = new JsonObject(); - timeJson.addProperty("timeBucket", time); - return timeJson; - } - - @Override protected JsonElement doPost(HttpServletRequest req) throws ArgumentsParseException { - throw new UnsupportedOperationException(); - } -} diff --git a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/service/ApplicationService.java b/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/service/ApplicationService.java deleted file mode 100644 index 9ec9af0a9c..0000000000 --- a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/service/ApplicationService.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.ui.service; - -import com.google.gson.JsonArray; -import org.skywalking.apm.collector.storage.base.dao.DAOContainer; -import org.skywalking.apm.collector.ui.dao.IInstanceDAO; - -/** - * @author peng-yongsheng - */ -public class ApplicationService { - - public JsonArray getApplications(long startTime, long endTime) { - IInstanceDAO instanceDAO = (IInstanceDAO)DAOContainer.INSTANCE.get(IInstanceDAO.class.getName()); - return instanceDAO.getApplications(startTime, endTime); - } -} diff --git a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/service/InstanceHealthService.java b/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/service/InstanceHealthService.java deleted file mode 100644 index 1e07d75025..0000000000 --- a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/service/InstanceHealthService.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.ui.service; - -import com.google.gson.JsonArray; -import com.google.gson.JsonObject; -import java.util.List; -import org.skywalking.apm.collector.cache.ApplicationCache; -import org.skywalking.apm.collector.core.util.TimeBucketUtils; -import org.skywalking.apm.collector.storage.base.dao.DAOContainer; -import org.skywalking.apm.collector.storage.base.define.register.InstanceDataDefine; -import org.skywalking.apm.collector.ui.dao.IGCMetricDAO; -import org.skywalking.apm.collector.ui.dao.IInstPerformanceDAO; -import org.skywalking.apm.collector.ui.dao.IInstanceDAO; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class InstanceHealthService { - - private final Logger logger = LoggerFactory.getLogger(InstanceHealthService.class); - - public JsonObject getInstances(long timeBucket, int applicationId) { - JsonObject response = new JsonObject(); - - long[] timeBuckets = TimeBucketUtils.INSTANCE.getFiveSecondTimeBuckets(timeBucket); - long halfHourBeforeTimeBucket = TimeBucketUtils.INSTANCE.addSecondForSecondTimeBucket(TimeBucketUtils.TimeBucketType.SECOND.name(), timeBucket, -60 * 30); - IInstanceDAO instanceDAO = (IInstanceDAO)DAOContainer.INSTANCE.get(IInstanceDAO.class.getName()); - List instanceList = instanceDAO.getInstances(applicationId, halfHourBeforeTimeBucket); - - JsonArray instances = new JsonArray(); - response.add("instances", instances); - - instanceList.forEach(instance -> { - response.addProperty("applicationCode", ApplicationCache.get(applicationId)); - response.addProperty("applicationId", applicationId); - - IInstPerformanceDAO instPerformanceDAO = (IInstPerformanceDAO)DAOContainer.INSTANCE.get(IInstPerformanceDAO.class.getName()); - IInstPerformanceDAO.InstPerformance performance = instPerformanceDAO.get(timeBuckets, instance.getInstanceId()); - - IGCMetricDAO gcMetricDAO = (IGCMetricDAO)DAOContainer.INSTANCE.get(IGCMetricDAO.class.getName()); - JsonObject instanceJson = new JsonObject(); - instanceJson.addProperty("id", instance.getInstanceId()); - if (performance != null) { - instanceJson.addProperty("tps", performance.getCalls()); - } else { - instanceJson.addProperty("tps", 0); - } - - int avg = 0; - if (performance != null && performance.getCalls() != 0) { - avg = (int)(performance.getCostTotal() / performance.getCalls()); - } - instanceJson.addProperty("avg", avg); - - if (avg > 5000) { - instanceJson.addProperty("healthLevel", 0); - } else if (avg > 3000 && avg <= 5000) { - instanceJson.addProperty("healthLevel", 1); - } else if (avg > 1000 && avg <= 3000) { - instanceJson.addProperty("healthLevel", 2); - } else { - instanceJson.addProperty("healthLevel", 3); - } - - long heartBeatTime = TimeBucketUtils.INSTANCE.changeTimeBucket2TimeStamp(TimeBucketUtils.TimeBucketType.SECOND.name(), instance.getHeartBeatTime()); - long currentTime = TimeBucketUtils.INSTANCE.changeTimeBucket2TimeStamp(TimeBucketUtils.TimeBucketType.SECOND.name(), timeBucket); - - if (currentTime - heartBeatTime < 1000 * 60 * 2) { - instanceJson.addProperty("status", 0); - } else { - instanceJson.addProperty("status", 1); - } - - IGCMetricDAO.GCCount gcCount = gcMetricDAO.getGCCount(timeBuckets, instance.getInstanceId()); - instanceJson.addProperty("ygc", gcCount.getYoung()); - instanceJson.addProperty("ogc", gcCount.getOld()); - - instances.add(instanceJson); - }); - - return response; - } -} diff --git a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/service/InstanceJVMService.java b/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/service/InstanceJVMService.java deleted file mode 100644 index 7bd078dad2..0000000000 --- a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/service/InstanceJVMService.java +++ /dev/null @@ -1,149 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.ui.service; - -import com.google.gson.Gson; -import com.google.gson.JsonObject; -import java.util.Set; -import org.skywalking.apm.collector.core.framework.UnexpectedException; -import org.skywalking.apm.collector.core.util.ObjectUtils; -import org.skywalking.apm.collector.storage.base.dao.DAOContainer; -import org.skywalking.apm.collector.storage.base.define.register.InstanceDataDefine; -import org.skywalking.apm.collector.ui.dao.ICpuMetricDAO; -import org.skywalking.apm.collector.ui.dao.IGCMetricDAO; -import org.skywalking.apm.collector.ui.dao.IInstPerformanceDAO; -import org.skywalking.apm.collector.ui.dao.IInstanceDAO; -import org.skywalking.apm.collector.ui.dao.IMemoryMetricDAO; -import org.skywalking.apm.collector.ui.dao.IMemoryPoolMetricDAO; -import org.skywalking.apm.network.proto.PoolType; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class InstanceJVMService { - - private final Logger logger = LoggerFactory.getLogger(InstanceJVMService.class); - - private Gson gson = new Gson(); - - public JsonObject getInstanceOsInfo(int instanceId) { - IInstanceDAO instanceDAO = (IInstanceDAO)DAOContainer.INSTANCE.get(IInstanceDAO.class.getName()); - InstanceDataDefine.Instance instance = instanceDAO.getInstance(instanceId); - if (ObjectUtils.isEmpty(instance)) { - throw new UnexpectedException("instance id: " + instanceId + " not exist."); - } - - return gson.fromJson(instance.getOsInfo(), JsonObject.class); - } - - public JsonObject getInstanceJvmMetric(int instanceId, Set metricTypes, long timeBucket) { - JsonObject metrics = new JsonObject(); - for (String metricType : metricTypes) { - if (metricType.toLowerCase().equals(MetricType.cpu.name())) { - ICpuMetricDAO cpuMetricDAO = (ICpuMetricDAO)DAOContainer.INSTANCE.get(ICpuMetricDAO.class.getName()); - metrics.addProperty(MetricType.cpu.name(), cpuMetricDAO.getMetric(instanceId, timeBucket)); - } else if (metricType.toLowerCase().equals(MetricType.gc.name())) { - IGCMetricDAO gcMetricDAO = (IGCMetricDAO)DAOContainer.INSTANCE.get(IGCMetricDAO.class.getName()); - metrics.add(MetricType.gc.name(), gcMetricDAO.getMetric(instanceId, timeBucket)); - } else if (metricType.toLowerCase().equals(MetricType.tps.name())) { - IInstPerformanceDAO instPerformanceDAO = (IInstPerformanceDAO)DAOContainer.INSTANCE.get(IInstPerformanceDAO.class.getName()); - metrics.addProperty(MetricType.tps.name(), instPerformanceDAO.getTpsMetric(instanceId, timeBucket)); - } else if (metricType.toLowerCase().equals(MetricType.resptime.name())) { - IInstPerformanceDAO instPerformanceDAO = (IInstPerformanceDAO)DAOContainer.INSTANCE.get(IInstPerformanceDAO.class.getName()); - metrics.addProperty(MetricType.resptime.name(), instPerformanceDAO.getRespTimeMetric(instanceId, timeBucket)); - } else if (metricType.toLowerCase().equals(MetricType.heapmemory.name())) { - IMemoryMetricDAO memoryMetricDAO = (IMemoryMetricDAO)DAOContainer.INSTANCE.get(IMemoryMetricDAO.class.getName()); - metrics.add(MetricType.heapmemory.name(), memoryMetricDAO.getMetric(instanceId, timeBucket, true)); - } else if (metricType.toLowerCase().equals(MetricType.nonheapmemory.name())) { - IMemoryMetricDAO memoryMetricDAO = (IMemoryMetricDAO)DAOContainer.INSTANCE.get(IMemoryMetricDAO.class.getName()); - metrics.add(MetricType.nonheapmemory.name(), memoryMetricDAO.getMetric(instanceId, timeBucket, false)); - } else if (metricType.toLowerCase().equals(MetricType.permgen.name())) { - IMemoryPoolMetricDAO memoryPoolMetricDAO = (IMemoryPoolMetricDAO)DAOContainer.INSTANCE.get(IMemoryPoolMetricDAO.class.getName()); - metrics.add(MetricType.permgen.name(), memoryPoolMetricDAO.getMetric(instanceId, timeBucket, PoolType.PERMGEN_USAGE_VALUE)); - } else if (metricType.toLowerCase().equals(MetricType.metaspace.name())) { - IMemoryPoolMetricDAO memoryPoolMetricDAO = (IMemoryPoolMetricDAO)DAOContainer.INSTANCE.get(IMemoryPoolMetricDAO.class.getName()); - metrics.add(MetricType.metaspace.name(), memoryPoolMetricDAO.getMetric(instanceId, timeBucket, PoolType.METASPACE_USAGE_VALUE)); - } else if (metricType.toLowerCase().equals(MetricType.newgen.name())) { - IMemoryPoolMetricDAO memoryPoolMetricDAO = (IMemoryPoolMetricDAO)DAOContainer.INSTANCE.get(IMemoryPoolMetricDAO.class.getName()); - metrics.add(MetricType.newgen.name(), memoryPoolMetricDAO.getMetric(instanceId, timeBucket, PoolType.NEWGEN_USAGE_VALUE)); - } else if (metricType.toLowerCase().equals(MetricType.oldgen.name())) { - IMemoryPoolMetricDAO memoryPoolMetricDAO = (IMemoryPoolMetricDAO)DAOContainer.INSTANCE.get(IMemoryPoolMetricDAO.class.getName()); - metrics.add(MetricType.oldgen.name(), memoryPoolMetricDAO.getMetric(instanceId, timeBucket, PoolType.OLDGEN_USAGE_VALUE)); - } else if (metricType.toLowerCase().equals(MetricType.survivor.name())) { - IMemoryPoolMetricDAO memoryPoolMetricDAO = (IMemoryPoolMetricDAO)DAOContainer.INSTANCE.get(IMemoryPoolMetricDAO.class.getName()); - metrics.add(MetricType.survivor.name(), memoryPoolMetricDAO.getMetric(instanceId, timeBucket, PoolType.SURVIVOR_USAGE_VALUE)); - } else { - throw new UnexpectedException("unexpected metric type"); - } - } - return metrics; - } - - public JsonObject getInstanceJvmMetrics(int instanceId, Set metricTypes, long startTimeBucket, - long endTimeBucket) { - JsonObject metrics = new JsonObject(); - for (String metricType : metricTypes) { - if (metricType.toLowerCase().equals(MetricType.cpu.name())) { - ICpuMetricDAO cpuMetricDAO = (ICpuMetricDAO)DAOContainer.INSTANCE.get(ICpuMetricDAO.class.getName()); - metrics.add(MetricType.cpu.name(), cpuMetricDAO.getMetric(instanceId, startTimeBucket, endTimeBucket)); - } else if (metricType.toLowerCase().equals(MetricType.gc.name())) { - IGCMetricDAO gcMetricDAO = (IGCMetricDAO)DAOContainer.INSTANCE.get(IGCMetricDAO.class.getName()); - metrics.add(MetricType.gc.name(), gcMetricDAO.getMetric(instanceId, startTimeBucket, endTimeBucket)); - } else if (metricType.toLowerCase().equals(MetricType.tps.name())) { - IInstPerformanceDAO instPerformanceDAO = (IInstPerformanceDAO)DAOContainer.INSTANCE.get(IInstPerformanceDAO.class.getName()); - metrics.add(MetricType.tps.name(), instPerformanceDAO.getTpsMetric(instanceId, startTimeBucket, endTimeBucket)); - } else if (metricType.toLowerCase().equals(MetricType.resptime.name())) { - IInstPerformanceDAO instPerformanceDAO = (IInstPerformanceDAO)DAOContainer.INSTANCE.get(IInstPerformanceDAO.class.getName()); - metrics.add(MetricType.resptime.name(), instPerformanceDAO.getRespTimeMetric(instanceId, startTimeBucket, endTimeBucket)); - } else if (metricType.toLowerCase().equals(MetricType.heapmemory.name())) { - IMemoryMetricDAO memoryMetricDAO = (IMemoryMetricDAO)DAOContainer.INSTANCE.get(IMemoryMetricDAO.class.getName()); - metrics.add(MetricType.heapmemory.name(), memoryMetricDAO.getMetric(instanceId, startTimeBucket, endTimeBucket, true)); - } else if (metricType.toLowerCase().equals(MetricType.nonheapmemory.name())) { - IMemoryMetricDAO memoryMetricDAO = (IMemoryMetricDAO)DAOContainer.INSTANCE.get(IMemoryMetricDAO.class.getName()); - metrics.add(MetricType.nonheapmemory.name(), memoryMetricDAO.getMetric(instanceId, startTimeBucket, endTimeBucket, false)); - } else if (metricType.toLowerCase().equals(MetricType.permgen.name())) { - IMemoryPoolMetricDAO memoryPoolMetricDAO = (IMemoryPoolMetricDAO)DAOContainer.INSTANCE.get(IMemoryPoolMetricDAO.class.getName()); - metrics.add(MetricType.permgen.name(), memoryPoolMetricDAO.getMetric(instanceId, startTimeBucket, endTimeBucket, PoolType.PERMGEN_USAGE_VALUE)); - } else if (metricType.toLowerCase().equals(MetricType.metaspace.name())) { - IMemoryPoolMetricDAO memoryPoolMetricDAO = (IMemoryPoolMetricDAO)DAOContainer.INSTANCE.get(IMemoryPoolMetricDAO.class.getName()); - metrics.add(MetricType.metaspace.name(), memoryPoolMetricDAO.getMetric(instanceId, startTimeBucket, endTimeBucket, PoolType.METASPACE_USAGE_VALUE)); - } else if (metricType.toLowerCase().equals(MetricType.newgen.name())) { - IMemoryPoolMetricDAO memoryPoolMetricDAO = (IMemoryPoolMetricDAO)DAOContainer.INSTANCE.get(IMemoryPoolMetricDAO.class.getName()); - metrics.add(MetricType.newgen.name(), memoryPoolMetricDAO.getMetric(instanceId, startTimeBucket, endTimeBucket, PoolType.NEWGEN_USAGE_VALUE)); - } else if (metricType.toLowerCase().equals(MetricType.oldgen.name())) { - IMemoryPoolMetricDAO memoryPoolMetricDAO = (IMemoryPoolMetricDAO)DAOContainer.INSTANCE.get(IMemoryPoolMetricDAO.class.getName()); - metrics.add(MetricType.oldgen.name(), memoryPoolMetricDAO.getMetric(instanceId, startTimeBucket, endTimeBucket, PoolType.OLDGEN_USAGE_VALUE)); - } else if (metricType.toLowerCase().equals(MetricType.survivor.name())) { - IMemoryPoolMetricDAO memoryPoolMetricDAO = (IMemoryPoolMetricDAO)DAOContainer.INSTANCE.get(IMemoryPoolMetricDAO.class.getName()); - metrics.add(MetricType.survivor.name(), memoryPoolMetricDAO.getMetric(instanceId, startTimeBucket, endTimeBucket, PoolType.SURVIVOR_USAGE_VALUE)); - } else { - throw new UnexpectedException("unexpected metric type"); - } - } - - return metrics; - } - - public enum MetricType { - cpu, gc, tps, resptime, heapmemory, nonheapmemory, permgen, metaspace, newgen, - oldgen, survivor - } -} diff --git a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/service/SegmentTopService.java b/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/service/SegmentTopService.java deleted file mode 100644 index b34a2dd8ab..0000000000 --- a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/service/SegmentTopService.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.ui.service; - -import com.google.gson.JsonObject; -import java.util.LinkedList; -import java.util.List; -import org.skywalking.apm.collector.core.util.StringUtils; -import org.skywalking.apm.collector.storage.base.dao.DAOContainer; -import org.skywalking.apm.collector.ui.dao.IGlobalTraceDAO; -import org.skywalking.apm.collector.ui.dao.ISegmentCostDAO; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class SegmentTopService { - - private final Logger logger = LoggerFactory.getLogger(SegmentTopService.class); - - public JsonObject loadTop(long startTime, long endTime, long minCost, long maxCost, String operationName, - String globalTraceId, ISegmentCostDAO.Error error, int applicationId, int limit, int from, - ISegmentCostDAO.Sort sort) { - logger.debug("startTime: {}, endTime: {}, minCost: {}, maxCost: {}, operationName: {}, globalTraceId: {}, error: {}, applicationId: {}, limit: {}, from: {}", startTime, endTime, minCost, maxCost, operationName, globalTraceId, error, applicationId, limit, from); - - List segmentIds = new LinkedList<>(); - if (StringUtils.isNotEmpty(globalTraceId)) { - IGlobalTraceDAO globalTraceDAO = (IGlobalTraceDAO)DAOContainer.INSTANCE.get(IGlobalTraceDAO.class.getName()); - segmentIds = globalTraceDAO.getSegmentIds(globalTraceId); - } - ISegmentCostDAO segmentCostDAO = (ISegmentCostDAO)DAOContainer.INSTANCE.get(ISegmentCostDAO.class.getName()); - return segmentCostDAO.loadTop(startTime, endTime, minCost, maxCost, operationName, error, applicationId, segmentIds, limit, from, sort); - } -} diff --git a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/service/ServiceTreeService.java b/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/service/ServiceTreeService.java deleted file mode 100644 index bb4a846d74..0000000000 --- a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/service/ServiceTreeService.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.ui.service; - -import com.google.gson.JsonArray; -import com.google.gson.JsonObject; -import java.util.Iterator; -import java.util.Map; -import org.skywalking.apm.collector.core.util.ColumnNameUtils; -import org.skywalking.apm.collector.core.util.Const; -import org.skywalking.apm.collector.core.util.ObjectUtils; -import org.skywalking.apm.collector.storage.base.dao.DAOContainer; -import org.skywalking.apm.collector.storage.base.define.serviceref.ServiceReferenceTable; -import org.skywalking.apm.collector.ui.dao.IServiceEntryDAO; -import org.skywalking.apm.collector.ui.dao.IServiceReferenceDAO; - -/** - * @author peng-yongsheng - */ -public class ServiceTreeService { - - public JsonObject loadEntryService(int applicationId, String entryServiceName, long startTime, long endTime, - int from, int size) { - IServiceEntryDAO serviceEntryDAO = (IServiceEntryDAO)DAOContainer.INSTANCE.get(IServiceEntryDAO.class.getName()); - return serviceEntryDAO.load(applicationId, entryServiceName, startTime, endTime, from, size); - } - - public JsonArray loadServiceTree(int entryServiceId, long startTime, long endTime) { - IServiceReferenceDAO serviceReferenceDAO = (IServiceReferenceDAO)DAOContainer.INSTANCE.get(IServiceReferenceDAO.class.getName()); - Map serviceReferenceMap = serviceReferenceDAO.load(entryServiceId, startTime, endTime); - return buildTreeData(serviceReferenceMap); - } - - private JsonArray buildTreeData(Map serviceReferenceMap) { - JsonArray serviceReferenceArray = new JsonArray(); - JsonObject rootServiceReference = findRoot(serviceReferenceMap); - if (ObjectUtils.isNotEmpty(rootServiceReference)) { - serviceReferenceArray.add(rootServiceReference); - String id = rootServiceReference.get(ColumnNameUtils.INSTANCE.rename(ServiceReferenceTable.COLUMN_FRONT_SERVICE_ID)) + Const.ID_SPLIT + rootServiceReference.get(ColumnNameUtils.INSTANCE.rename(ServiceReferenceTable.COLUMN_BEHIND_SERVICE_ID)); - serviceReferenceMap.remove(id); - - int rootServiceId = rootServiceReference.get(ColumnNameUtils.INSTANCE.rename(ServiceReferenceTable.COLUMN_BEHIND_SERVICE_ID)).getAsInt(); - sortAsTree(rootServiceId, serviceReferenceArray, serviceReferenceMap); - } - - return serviceReferenceArray; - } - - private JsonObject findRoot(Map serviceReferenceMap) { - for (JsonObject serviceReference : serviceReferenceMap.values()) { - int frontServiceId = serviceReference.get(ColumnNameUtils.INSTANCE.rename(ServiceReferenceTable.COLUMN_FRONT_SERVICE_ID)).getAsInt(); - if (frontServiceId == 1) { - return serviceReference; - } - } - return null; - } - - private void sortAsTree(int serviceId, JsonArray serviceReferenceArray, - Map serviceReferenceMap) { - Iterator iterator = serviceReferenceMap.values().iterator(); - while (iterator.hasNext()) { - JsonObject serviceReference = iterator.next(); - int frontServiceId = serviceReference.get(ColumnNameUtils.INSTANCE.rename(ServiceReferenceTable.COLUMN_FRONT_SERVICE_ID)).getAsInt(); - if (serviceId == frontServiceId) { - serviceReferenceArray.add(serviceReference); - - int behindServiceId = serviceReference.get(ColumnNameUtils.INSTANCE.rename(ServiceReferenceTable.COLUMN_BEHIND_SERVICE_ID)).getAsInt(); - sortAsTree(behindServiceId, serviceReferenceArray, serviceReferenceMap); - } - } - } - - private void merge(Map serviceReferenceMap, JsonObject serviceReference) { - String id = serviceReference.get(ColumnNameUtils.INSTANCE.rename(ServiceReferenceTable.COLUMN_FRONT_SERVICE_ID)) + Const.ID_SPLIT + serviceReference.get(ColumnNameUtils.INSTANCE.rename(ServiceReferenceTable.COLUMN_BEHIND_SERVICE_ID)); - - if (serviceReferenceMap.containsKey(id)) { - JsonObject reference = serviceReferenceMap.get(id); - add(reference, serviceReference, ColumnNameUtils.INSTANCE.rename(ServiceReferenceTable.COLUMN_S1_LTE)); - add(reference, serviceReference, ColumnNameUtils.INSTANCE.rename(ServiceReferenceTable.COLUMN_S3_LTE)); - add(reference, serviceReference, ColumnNameUtils.INSTANCE.rename(ServiceReferenceTable.COLUMN_S5_LTE)); - add(reference, serviceReference, ColumnNameUtils.INSTANCE.rename(ServiceReferenceTable.COLUMN_S5_GT)); - add(reference, serviceReference, ColumnNameUtils.INSTANCE.rename(ServiceReferenceTable.COLUMN_ERROR)); - add(reference, serviceReference, ColumnNameUtils.INSTANCE.rename(ServiceReferenceTable.COLUMN_SUMMARY)); - add(reference, serviceReference, ColumnNameUtils.INSTANCE.rename(ServiceReferenceTable.COLUMN_COST_SUMMARY)); - } else { - serviceReferenceMap.put(id, serviceReference); - } - } - - private void add(JsonObject oldReference, JsonObject newReference, String key) { - long oldValue = oldReference.get(key).getAsLong(); - long newValue = newReference.get(key).getAsLong(); - oldReference.addProperty(key, oldValue + newValue); - } -} \ No newline at end of file diff --git a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/service/SpanService.java b/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/service/SpanService.java deleted file mode 100644 index b6a6c8aa7b..0000000000 --- a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/service/SpanService.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.ui.service; - -import com.google.gson.JsonArray; -import com.google.gson.JsonObject; -import java.util.List; -import org.skywalking.apm.collector.cache.ApplicationCache; -import org.skywalking.apm.collector.cache.ServiceNameCache; -import org.skywalking.apm.collector.core.util.Const; -import org.skywalking.apm.collector.core.util.StringUtils; -import org.skywalking.apm.collector.storage.base.dao.DAOContainer; -import org.skywalking.apm.collector.ui.dao.ISegmentDAO; -import org.skywalking.apm.network.proto.KeyWithStringValue; -import org.skywalking.apm.network.proto.LogMessage; -import org.skywalking.apm.network.proto.SpanObject; -import org.skywalking.apm.network.proto.TraceSegmentObject; -import org.skywalking.apm.network.trace.component.ComponentsDefine; - -/** - * @author peng-yongsheng - */ -public class SpanService { - - public JsonObject load(String segmentId, int spanId) { - ISegmentDAO segmentDAO = (ISegmentDAO)DAOContainer.INSTANCE.get(ISegmentDAO.class.getName()); - TraceSegmentObject segmentObject = segmentDAO.load(segmentId); - - JsonObject spanJson = new JsonObject(); - List spans = segmentObject.getSpansList(); - for (SpanObject spanObject : spans) { - if (spanId == spanObject.getSpanId()) { - String operationName = spanObject.getOperationName(); - if (spanObject.getOperationNameId() != 0) { - String serviceName = ServiceNameCache.get(spanObject.getOperationNameId()); - if (StringUtils.isNotEmpty(serviceName)) { - operationName = serviceName.split(Const.ID_SPLIT)[1]; - } - } - spanJson.addProperty("operationName", operationName); - spanJson.addProperty("startTime", spanObject.getStartTime()); - spanJson.addProperty("endTime", spanObject.getEndTime()); - - JsonArray logsArray = new JsonArray(); - List logs = spanObject.getLogsList(); - for (LogMessage logMessage : logs) { - JsonObject logJson = new JsonObject(); - logJson.addProperty("time", logMessage.getTime()); - - JsonArray logInfoArray = new JsonArray(); - for (KeyWithStringValue value : logMessage.getDataList()) { - JsonObject valueJson = new JsonObject(); - valueJson.addProperty("key", value.getKey()); - valueJson.addProperty("value", value.getValue()); - logInfoArray.add(valueJson); - } - logJson.add("logInfo", logInfoArray); - logsArray.add(logJson); - } - spanJson.add("logMessage", logsArray); - - JsonArray tagsArray = new JsonArray(); - - JsonObject spanTypeJson = new JsonObject(); - spanTypeJson.addProperty("key", "span type"); - spanTypeJson.addProperty("value", spanObject.getSpanType().name()); - tagsArray.add(spanTypeJson); - - JsonObject componentJson = new JsonObject(); - componentJson.addProperty("key", "component"); - if (spanObject.getComponentId() == 0) { - componentJson.addProperty("value", spanObject.getComponent()); - } else { - componentJson.addProperty("value", ComponentsDefine.getInstance().getComponentName(spanObject.getComponentId())); - } - tagsArray.add(componentJson); - - JsonObject peerJson = new JsonObject(); - peerJson.addProperty("key", "peer"); - if (spanObject.getPeerId() == 0) { - peerJson.addProperty("value", spanObject.getPeer()); - } else { - peerJson.addProperty("value", ApplicationCache.get(spanObject.getPeerId())); - } - tagsArray.add(peerJson); - - for (KeyWithStringValue tagValue : spanObject.getTagsList()) { - JsonObject tagJson = new JsonObject(); - tagJson.addProperty("key", tagValue.getKey()); - tagJson.addProperty("value", tagValue.getValue()); - tagsArray.add(tagJson); - } - - JsonObject isErrorJson = new JsonObject(); - isErrorJson.addProperty("key", "is error"); - isErrorJson.addProperty("value", spanObject.getIsError()); - tagsArray.add(isErrorJson); - - spanJson.add("tags", tagsArray); - } - } - - return spanJson; - } -} \ No newline at end of file diff --git a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/service/TimeSynchronousService.java b/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/service/TimeSynchronousService.java deleted file mode 100644 index 3f115141d6..0000000000 --- a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/service/TimeSynchronousService.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.ui.service; - -import org.skywalking.apm.collector.storage.base.dao.DAOContainer; -import org.skywalking.apm.collector.ui.dao.IInstanceDAO; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class TimeSynchronousService { - - private final Logger logger = LoggerFactory.getLogger(SegmentTopService.class); - - public Long allInstanceLastTime() { - IInstanceDAO instanceDAO = (IInstanceDAO)DAOContainer.INSTANCE.get(IInstanceDAO.class.getName()); - return instanceDAO.lastHeartBeatTime(); - } - - public Long instanceLastTime(int applicationInstanceId) { - IInstanceDAO instanceDAO = (IInstanceDAO)DAOContainer.INSTANCE.get(IInstanceDAO.class.getName()); - return instanceDAO.instanceLastHeartBeatTime(applicationInstanceId); - } -} diff --git a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/service/TraceDagDataBuilder.java b/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/service/TraceDagDataBuilder.java deleted file mode 100644 index 18608033ce..0000000000 --- a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/service/TraceDagDataBuilder.java +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.ui.service; - -import com.google.gson.JsonArray; -import com.google.gson.JsonObject; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.Map; -import org.skywalking.apm.collector.core.util.Const; -import org.skywalking.apm.collector.storage.base.define.noderef.NodeReferenceTable; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class TraceDagDataBuilder { - private final Logger logger = LoggerFactory.getLogger(TraceDagDataBuilder.class); - - private Integer nodeId = new Integer(-1); - private Map mappingMap = new HashMap<>(); - private Map nodeCompMap = new HashMap<>(); - private Map nodeIdMap = new HashMap<>(); - private JsonArray pointArray = new JsonArray(); - private JsonArray lineArray = new JsonArray(); - - public JsonObject build(JsonArray nodeCompArray, JsonArray nodesMappingArray, JsonArray resSumArray) { - changeNodeComp2Map(nodeCompArray); - changeMapping2Map(nodesMappingArray); - - Map mergedResSumMap = merge(resSumArray); - - mergedResSumMap.values().forEach(nodeRefJsonObj -> { - String front = nodeRefJsonObj.get("front").getAsString(); - String behind = nodeRefJsonObj.get("behind").getAsString(); - - if (hasMapping(behind)) { - return; - } - - JsonObject lineJsonObj = new JsonObject(); - lineJsonObj.addProperty("from", findOrCreateNode(front)); - lineJsonObj.addProperty("to", findOrCreateNode(behind)); - lineJsonObj.addProperty("resSum", nodeRefJsonObj.get(NodeReferenceTable.COLUMN_SUMMARY).getAsInt()); - - lineArray.add(lineJsonObj); - logger.debug("line: {}", lineJsonObj); - }); - - JsonObject dagJsonObj = new JsonObject(); - dagJsonObj.add("nodes", pointArray); - dagJsonObj.add("nodeRefs", lineArray); - return dagJsonObj; - } - - private Integer findOrCreateNode(String peers) { - if (nodeIdMap.containsKey(peers) && !peers.equals(Const.USER_CODE)) { - return nodeIdMap.get(peers); - } else { - nodeId++; - JsonObject nodeJsonObj = new JsonObject(); - nodeJsonObj.addProperty("id", nodeId); - nodeJsonObj.addProperty("peer", peers); - if (peers.equals(Const.USER_CODE)) { - nodeJsonObj.addProperty("component", Const.USER_CODE); - } else { - nodeJsonObj.addProperty("component", nodeCompMap.get(peers)); - } - pointArray.add(nodeJsonObj); - - nodeIdMap.put(peers, nodeId); - logger.debug("node: {}", nodeJsonObj); - } - return nodeId; - } - - private void changeMapping2Map(JsonArray nodesMappingArray) { - for (int i = 0; i < nodesMappingArray.size(); i++) { - JsonObject nodesMappingJsonObj = nodesMappingArray.get(i).getAsJsonObject(); - String applicationCode = nodesMappingJsonObj.get("applicationCode").getAsString(); - String address = nodesMappingJsonObj.get("address").getAsString(); - mappingMap.put(address, applicationCode); - } - } - - private void changeNodeComp2Map(JsonArray nodeCompArray) { - for (int i = 0; i < nodeCompArray.size(); i++) { - JsonObject nodesJsonObj = nodeCompArray.get(i).getAsJsonObject(); - logger.debug(nodesJsonObj.toString()); - String componentName = nodesJsonObj.get("componentName").getAsString(); - String peer = nodesJsonObj.get("peer").getAsString(); - nodeCompMap.put(peer, componentName); - } - } - - private boolean hasMapping(String peers) { - return mappingMap.containsKey(peers); - } - - private Map merge(JsonArray nodeReference) { - Map mergedRef = new LinkedHashMap<>(); - for (int i = 0; i < nodeReference.size(); i++) { - JsonObject nodeRefJsonObj = nodeReference.get(i).getAsJsonObject(); - String front = nodeRefJsonObj.get("front").getAsString(); - String behind = nodeRefJsonObj.get("behind").getAsString(); - - String id = front + Const.ID_SPLIT + behind; - if (mergedRef.containsKey(id)) { - JsonObject oldValue = mergedRef.get(id); - oldValue.addProperty(NodeReferenceTable.COLUMN_S1_LTE, oldValue.get(NodeReferenceTable.COLUMN_S1_LTE).getAsLong() + nodeRefJsonObj.get(NodeReferenceTable.COLUMN_S1_LTE).getAsLong()); - oldValue.addProperty(NodeReferenceTable.COLUMN_S3_LTE, oldValue.get(NodeReferenceTable.COLUMN_S3_LTE).getAsLong() + nodeRefJsonObj.get(NodeReferenceTable.COLUMN_S3_LTE).getAsLong()); - oldValue.addProperty(NodeReferenceTable.COLUMN_S5_LTE, oldValue.get(NodeReferenceTable.COLUMN_S5_LTE).getAsLong() + nodeRefJsonObj.get(NodeReferenceTable.COLUMN_S5_LTE).getAsLong()); - oldValue.addProperty(NodeReferenceTable.COLUMN_S5_GT, oldValue.get(NodeReferenceTable.COLUMN_S5_GT).getAsLong() + nodeRefJsonObj.get(NodeReferenceTable.COLUMN_S5_GT).getAsLong()); - oldValue.addProperty(NodeReferenceTable.COLUMN_ERROR, oldValue.get(NodeReferenceTable.COLUMN_ERROR).getAsLong() + nodeRefJsonObj.get(NodeReferenceTable.COLUMN_ERROR).getAsLong()); - oldValue.addProperty(NodeReferenceTable.COLUMN_SUMMARY, oldValue.get(NodeReferenceTable.COLUMN_SUMMARY).getAsLong() + nodeRefJsonObj.get(NodeReferenceTable.COLUMN_SUMMARY).getAsLong()); - } else { - mergedRef.put(id, nodeReference.get(i).getAsJsonObject()); - } - } - - return mergedRef; - } -} diff --git a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/service/TraceDagService.java b/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/service/TraceDagService.java deleted file mode 100644 index 4fa53875cd..0000000000 --- a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/service/TraceDagService.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.ui.service; - -import com.google.gson.JsonArray; -import com.google.gson.JsonObject; -import org.skywalking.apm.collector.storage.base.dao.DAOContainer; -import org.skywalking.apm.collector.ui.dao.INodeComponentDAO; -import org.skywalking.apm.collector.ui.dao.INodeMappingDAO; -import org.skywalking.apm.collector.ui.dao.INodeReferenceDAO; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class TraceDagService { - - private final Logger logger = LoggerFactory.getLogger(TraceDagService.class); - - public JsonObject load(long startTime, long endTime) { - logger.debug("startTime: {}, endTime: {}", startTime, endTime); - INodeComponentDAO nodeComponentDAO = (INodeComponentDAO)DAOContainer.INSTANCE.get(INodeComponentDAO.class.getName()); - JsonArray nodeComponentArray = nodeComponentDAO.load(startTime, endTime); - - INodeMappingDAO nodeMappingDAO = (INodeMappingDAO)DAOContainer.INSTANCE.get(INodeMappingDAO.class.getName()); - JsonArray nodeMappingArray = nodeMappingDAO.load(startTime, endTime); - - INodeReferenceDAO nodeRefSumDAO = (INodeReferenceDAO)DAOContainer.INSTANCE.get(INodeReferenceDAO.class.getName()); - JsonArray nodeRefSumArray = nodeRefSumDAO.load(startTime, endTime); - - TraceDagDataBuilder builder = new TraceDagDataBuilder(); - JsonObject traceDag = builder.build(nodeComponentArray, nodeMappingArray, nodeRefSumArray); - - return traceDag; - } -} diff --git a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/service/TraceStackService.java b/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/service/TraceStackService.java deleted file mode 100644 index 201b13b94c..0000000000 --- a/apm-collector-3.2.3/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/service/TraceStackService.java +++ /dev/null @@ -1,257 +0,0 @@ -/* - * Copyright 2017, OpenSkywalking Organization All rights reserved. - * - * 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. - * - * Project repository: https://github.com/OpenSkywalking/skywalking - */ - -package org.skywalking.apm.collector.ui.service; - -import com.google.gson.JsonArray; -import com.google.gson.JsonObject; -import java.util.ArrayList; -import java.util.List; -import org.skywalking.apm.collector.cache.ApplicationCache; -import org.skywalking.apm.collector.cache.ServiceNameCache; -import org.skywalking.apm.collector.core.util.CollectionUtils; -import org.skywalking.apm.collector.core.util.Const; -import org.skywalking.apm.collector.core.util.ObjectUtils; -import org.skywalking.apm.collector.core.util.StringUtils; -import org.skywalking.apm.collector.storage.base.dao.DAOContainer; -import org.skywalking.apm.collector.ui.dao.IGlobalTraceDAO; -import org.skywalking.apm.collector.ui.dao.ISegmentDAO; -import org.skywalking.apm.network.proto.SpanObject; -import org.skywalking.apm.network.proto.TraceSegmentObject; -import org.skywalking.apm.network.proto.TraceSegmentReference; -import org.skywalking.apm.network.proto.UniqueId; - -/** - * @author peng-yongsheng - */ -public class TraceStackService { - - public JsonArray load(String globalTraceId) { - IGlobalTraceDAO globalTraceDAO = (IGlobalTraceDAO)DAOContainer.INSTANCE.get(IGlobalTraceDAO.class.getName()); - ISegmentDAO segmentDAO = (ISegmentDAO)DAOContainer.INSTANCE.get(ISegmentDAO.class.getName()); - - List spans = new ArrayList<>(); - List segmentIds = globalTraceDAO.getSegmentIds(globalTraceId); - if (CollectionUtils.isNotEmpty(segmentIds)) { - for (String segmentId : segmentIds) { - TraceSegmentObject segment = segmentDAO.load(segmentId); - if (ObjectUtils.isNotEmpty(segment)) { - spans.addAll(buildSpanList(segmentId, segment)); - } - } - } - - List sortedSpans = new ArrayList<>(); - if (CollectionUtils.isNotEmpty(spans)) { - List rootSpans = findRoot(spans); - - if (CollectionUtils.isNotEmpty(rootSpans)) { - rootSpans.forEach(span -> { - List childrenSpan = new ArrayList<>(); - childrenSpan.add(span); - findChildren(spans, span, childrenSpan); - sortedSpans.addAll(childrenSpan); - }); - } - } - minStartTime(sortedSpans); - - return toJsonArray(sortedSpans); - } - - private JsonArray toJsonArray(List sortedSpans) { - JsonArray traceStackArray = new JsonArray(); - sortedSpans.forEach(span -> { - JsonObject spanJson = new JsonObject(); - spanJson.addProperty("spanId", span.getSpanId()); - spanJson.addProperty("parentSpanId", span.getParentSpanId()); - spanJson.addProperty("segmentSpanId", span.getSegmentSpanId()); - spanJson.addProperty("segmentParentSpanId", span.getSegmentParentSpanId()); - spanJson.addProperty("startTime", span.getStartTime()); - spanJson.addProperty("operationName", span.getOperationName()); - spanJson.addProperty("applicationCode", span.getApplicationCode()); - spanJson.addProperty("cost", span.getCost()); - spanJson.addProperty("isRoot", span.isRoot()); - traceStackArray.add(spanJson); - }); - return traceStackArray; - } - - private void minStartTime(List spans) { - long minStartTime = Long.MAX_VALUE; - for (Span span : spans) { - if (span.getStartTime() < minStartTime) { - minStartTime = span.getStartTime(); - } - } - - for (Span span : spans) { - span.setStartTime(span.getStartTime() - minStartTime); - } - } - - private List buildSpanList(String segmentId, TraceSegmentObject segment) { - List spans = new ArrayList<>(); - if (segment.getSpansCount() > 0) { - for (SpanObject spanObject : segment.getSpansList()) { - int spanId = spanObject.getSpanId(); - int parentSpanId = spanObject.getParentSpanId(); - String segmentSpanId = segmentId + Const.SEGMENT_SPAN_SPLIT + String.valueOf(spanId); - String segmentParentSpanId = segmentId + Const.SEGMENT_SPAN_SPLIT + String.valueOf(parentSpanId); - long startTime = spanObject.getStartTime(); - - String operationName = spanObject.getOperationName(); - if (spanObject.getOperationNameId() != 0) { - String serviceName = ServiceNameCache.get(spanObject.getOperationNameId()); - if (StringUtils.isNotEmpty(serviceName)) { - operationName = serviceName.split(Const.ID_SPLIT)[1]; - } else { - operationName = Const.EMPTY_STRING; - } - } - String applicationCode = ApplicationCache.get(segment.getApplicationId()); - - long cost = spanObject.getEndTime() - spanObject.getStartTime(); - if (cost == 0) { - cost = 1; - } - - if (parentSpanId == -1 && segment.getRefsCount() > 0) { - for (TraceSegmentReference reference : segment.getRefsList()) { - parentSpanId = reference.getParentSpanId(); - UniqueId uniqueId = reference.getParentTraceSegmentId(); - - StringBuilder segmentIdBuilder = new StringBuilder(); - for (int i = 0; i < uniqueId.getIdPartsList().size(); i++) { - if (i == 0) { - segmentIdBuilder.append(String.valueOf(uniqueId.getIdPartsList().get(i))); - } else { - segmentIdBuilder.append(".").append(String.valueOf(uniqueId.getIdPartsList().get(i))); - } - } - - String parentSegmentId = segmentIdBuilder.toString(); - segmentParentSpanId = parentSegmentId + Const.SEGMENT_SPAN_SPLIT + String.valueOf(parentSpanId); - - spans.add(new Span(spanId, parentSpanId, segmentSpanId, segmentParentSpanId, startTime, operationName, applicationCode, cost)); - } - } else { - spans.add(new Span(spanId, parentSpanId, segmentSpanId, segmentParentSpanId, startTime, operationName, applicationCode, cost)); - } - } - } - return spans; - } - - private List findRoot(List spans) { - List rootSpans = new ArrayList<>(); - spans.forEach(span -> { - String segmentParentSpanId = span.getSegmentParentSpanId(); - - boolean hasParent = false; - for (Span span1 : spans) { - if (segmentParentSpanId.equals(span1.getSegmentSpanId())) { - hasParent = true; - } - } - - if (!hasParent) { - span.setRoot(true); - rootSpans.add(span); - } - }); - return rootSpans; - } - - private void findChildren(List spans, Span parentSpan, List childrenSpan) { - spans.forEach(span -> { - if (span.getSegmentParentSpanId().equals(parentSpan.getSegmentSpanId())) { - childrenSpan.add(span); - findChildren(spans, span, childrenSpan); - } - }); - } - - class Span { - private int spanId; - private int parentSpanId; - private String segmentSpanId; - private String segmentParentSpanId; - private long startTime; - private String operationName; - private String applicationCode; - private long cost; - private boolean isRoot = false; - - Span(int spanId, int parentSpanId, String segmentSpanId, String segmentParentSpanId, long startTime, - String operationName, String applicationCode, long cost) { - this.spanId = spanId; - this.parentSpanId = parentSpanId; - this.segmentSpanId = segmentSpanId; - this.segmentParentSpanId = segmentParentSpanId; - this.startTime = startTime; - this.operationName = operationName; - this.applicationCode = applicationCode; - this.cost = cost; - } - - int getSpanId() { - return spanId; - } - - int getParentSpanId() { - return parentSpanId; - } - - String getSegmentSpanId() { - return segmentSpanId; - } - - String getSegmentParentSpanId() { - return segmentParentSpanId; - } - - long getStartTime() { - return startTime; - } - - String getOperationName() { - return operationName; - } - - String getApplicationCode() { - return applicationCode; - } - - long getCost() { - return cost; - } - - public boolean isRoot() { - return isRoot; - } - - public void setRoot(boolean root) { - isRoot = root; - } - - public void setStartTime(long startTime) { - this.startTime = startTime; - } - } -} diff --git a/apm-collector-3.2.3/apm-collector-ui/src/main/resources/META-INF/defines/es_dao.define b/apm-collector-3.2.3/apm-collector-ui/src/main/resources/META-INF/defines/es_dao.define deleted file mode 100644 index a606efedb7..0000000000 --- a/apm-collector-3.2.3/apm-collector-ui/src/main/resources/META-INF/defines/es_dao.define +++ /dev/null @@ -1,14 +0,0 @@ -org.skywalking.apm.collector.ui.dao.NodeComponentEsDAO -org.skywalking.apm.collector.ui.dao.NodeMappingEsDAO -org.skywalking.apm.collector.ui.dao.NodeReferenceEsDAO -org.skywalking.apm.collector.ui.dao.SegmentCostEsDAO -org.skywalking.apm.collector.ui.dao.GlobalTraceEsDAO -org.skywalking.apm.collector.ui.dao.SegmentEsDAO -org.skywalking.apm.collector.ui.dao.InstanceEsDAO -org.skywalking.apm.collector.ui.dao.InstPerformanceEsDAO -org.skywalking.apm.collector.ui.dao.CpuMetricEsDAO -org.skywalking.apm.collector.ui.dao.GCMetricEsDAO -org.skywalking.apm.collector.ui.dao.MemoryMetricEsDAO -org.skywalking.apm.collector.ui.dao.MemoryPoolMetricEsDAO -org.skywalking.apm.collector.ui.dao.ServiceEntryEsDAO -org.skywalking.apm.collector.ui.dao.ServiceReferenceEsDAO \ No newline at end of file diff --git a/apm-collector-3.2.3/apm-collector-ui/src/main/resources/META-INF/defines/group.define b/apm-collector-3.2.3/apm-collector-ui/src/main/resources/META-INF/defines/group.define deleted file mode 100644 index 35b83f180b..0000000000 --- a/apm-collector-3.2.3/apm-collector-ui/src/main/resources/META-INF/defines/group.define +++ /dev/null @@ -1 +0,0 @@ -org.skywalking.apm.collector.ui.UIModuleGroupDefine \ No newline at end of file diff --git a/apm-collector-3.2.3/apm-collector-ui/src/main/resources/META-INF/defines/h2_dao.define b/apm-collector-3.2.3/apm-collector-ui/src/main/resources/META-INF/defines/h2_dao.define deleted file mode 100644 index bc4d41f8b9..0000000000 --- a/apm-collector-3.2.3/apm-collector-ui/src/main/resources/META-INF/defines/h2_dao.define +++ /dev/null @@ -1,14 +0,0 @@ -org.skywalking.apm.collector.ui.dao.NodeComponentH2DAO -org.skywalking.apm.collector.ui.dao.NodeMappingH2DAO -org.skywalking.apm.collector.ui.dao.NodeReferenceH2DAO -org.skywalking.apm.collector.ui.dao.SegmentCostH2DAO -org.skywalking.apm.collector.ui.dao.GlobalTraceH2DAO -org.skywalking.apm.collector.ui.dao.SegmentH2DAO -org.skywalking.apm.collector.ui.dao.InstanceH2DAO -org.skywalking.apm.collector.ui.dao.InstPerformanceH2DAO -org.skywalking.apm.collector.ui.dao.CpuMetricH2DAO -org.skywalking.apm.collector.ui.dao.GCMetricH2DAO -org.skywalking.apm.collector.ui.dao.MemoryMetricH2DAO -org.skywalking.apm.collector.ui.dao.MemoryPoolMetricH2DAO -org.skywalking.apm.collector.ui.dao.ServiceEntryH2DAO -org.skywalking.apm.collector.ui.dao.ServiceReferenceH2DAO \ No newline at end of file diff --git a/apm-collector-3.2.3/apm-collector-ui/src/main/resources/META-INF/defines/module.define b/apm-collector-3.2.3/apm-collector-ui/src/main/resources/META-INF/defines/module.define deleted file mode 100644 index 285a6d99da..0000000000 --- a/apm-collector-3.2.3/apm-collector-ui/src/main/resources/META-INF/defines/module.define +++ /dev/null @@ -1 +0,0 @@ -org.skywalking.apm.collector.ui.jetty.UIJettyModuleDefine \ No newline at end of file diff --git a/apm-collector-3.2.3/pom.xml b/apm-collector-3.2.3/pom.xml deleted file mode 100644 index 549f426e7a..0000000000 --- a/apm-collector-3.2.3/pom.xml +++ /dev/null @@ -1,84 +0,0 @@ - - - - - 4.0.0 - - apm-collector-cluster - apm-collector-core - apm-collector-queue - apm-collector-storage - apm-collector-client - apm-collector-server - apm-collector-agentstream - apm-collector-ui - apm-collector-boot - apm-collector-stream - apm-collector-agentserver - apm-collector-agentregister - apm-collector-agentjvm - apm-collector-remote - apm-collector-cache - - - apm - org.skywalking - 3.2.4-2017 - - apm-collector-3.2.3 - pom - - - - - - - org.slf4j - slf4j-api - 1.7.25 - - - org.slf4j - log4j-over-slf4j - 1.7.25 - - - org.apache.logging.log4j - log4j-core - 2.9.0 - - - com.google.guava - guava - 22.0 - - - org.apache.logging.log4j - log4j-slf4j-impl - 2.9.0 - - - org.apache.logging.log4j - log4j-core - - - - - -- GitLab