提交 46ac6ee4 编写于 作者: P peng-yongsheng

Define analysis layer register module that use for register application, instance, service id.

上级 7c4c914a
......@@ -63,10 +63,6 @@ public class AgentStreamModuleProvider extends ModuleProvider {
}
@Override public void prepare(Properties config) throws ServiceNotProvidedException {
this.registerServiceImplementation(IApplicationIDService.class, new ApplicationIDService(getManager()));
this.registerServiceImplementation(IInstanceIDService.class, new InstanceIDService(getManager()));
this.registerServiceImplementation(IServiceNameService.class, new ServiceNameService(getManager()));
this.registerServiceImplementation(ICpuMetricService.class, new CpuMetricService());
this.registerServiceImplementation(IGCMetricService.class, new GCMetricService());
this.registerServiceImplementation(IMemoryMetricService.class, new MemoryMetricService());
......
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Licensed to the Apache Software Foundation (ASF) under one or more
~ contributor license agreements. See the NOTICE file distributed with
~ this work for additional information regarding copyright ownership.
~ The ASF licenses this file to You under the Apache License, Version 2.0
~ (the "License"); you may not use this file except in compliance with
~ the License. You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
~
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>analysis-layer-register</artifactId>
<groupId>org.apache.skywalking</groupId>
<version>5.0.0-alpha</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>layer-register-define</artifactId>
<packaging>jar</packaging>
</project>
\ No newline at end of file
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.skywalking.apm.collector.analysis.layer.register.define;
import org.apache.skywalking.apm.collector.analysis.layer.register.define.service.IApplicationIDService;
import org.apache.skywalking.apm.collector.analysis.layer.register.define.service.IInstanceIDService;
import org.apache.skywalking.apm.collector.analysis.layer.register.define.service.IServiceNameService;
import org.apache.skywalking.apm.collector.core.module.Module;
/**
* @author peng-yongsheng
*/
public class AnalysisLayerRegisterModule extends Module {
public static final String NAME = "analysis_layer_register";
@Override public String name() {
return NAME;
}
@Override public Class[] services() {
return new Class[] {IApplicationIDService.class, IInstanceIDService.class, IServiceNameService.class};
}
}
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
org.apache.skywalking.apm.collector.analysis.layer.register.define.AnalysisLayerRegisterModule
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Licensed to the Apache Software Foundation (ASF) under one or more
~ contributor license agreements. See the NOTICE file distributed with
~ this work for additional information regarding copyright ownership.
~ The ASF licenses this file to You under the Apache License, Version 2.0
~ (the "License"); you may not use this file except in compliance with
~ the License. You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
~
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>analysis-layer-register</artifactId>
<groupId>org.apache.skywalking</groupId>
<version>5.0.0-alpha</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>layer-register-provider</artifactId>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>org.apache.skywalking</groupId>
<artifactId>layer-register-define</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.skywalking</groupId>
<artifactId>collector-cache-define</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</project>
\ No newline at end of file
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.skywalking.apm.collector.analysis.layer.register.provider;
import java.util.Properties;
import org.apache.skywalking.apm.collector.analysis.layer.register.define.AnalysisLayerRegisterModule;
import org.apache.skywalking.apm.collector.analysis.layer.register.define.service.IApplicationIDService;
import org.apache.skywalking.apm.collector.analysis.layer.register.define.service.IInstanceIDService;
import org.apache.skywalking.apm.collector.analysis.layer.register.define.service.IServiceNameService;
import org.apache.skywalking.apm.collector.analysis.layer.register.provider.service.ApplicationIDService;
import org.apache.skywalking.apm.collector.analysis.layer.register.provider.service.InstanceIDService;
import org.apache.skywalking.apm.collector.analysis.layer.register.provider.service.ServiceNameService;
import org.apache.skywalking.apm.collector.core.module.Module;
import org.apache.skywalking.apm.collector.core.module.ModuleProvider;
import org.apache.skywalking.apm.collector.core.module.ServiceNotProvidedException;
/**
* @author peng-yongsheng
*/
public class AnalysisLayerRegisterModuleProvider extends ModuleProvider {
public static final String NAME = "default";
@Override public String name() {
return NAME;
}
@Override public Class<? extends Module> module() {
return AnalysisLayerRegisterModule.class;
}
@Override public void prepare(Properties config) throws ServiceNotProvidedException {
this.registerServiceImplementation(IApplicationIDService.class, new ApplicationIDService(getManager()));
this.registerServiceImplementation(IInstanceIDService.class, new InstanceIDService(getManager()));
this.registerServiceImplementation(IServiceNameService.class, new ServiceNameService(getManager()));
}
@Override public void start(Properties config) throws ServiceNotProvidedException {
}
@Override public void notifyAfterCompleted() throws ServiceNotProvidedException {
}
@Override public String[] requiredModules() {
return new String[0];
}
}
......@@ -16,18 +16,15 @@
*
*/
package org.apache.skywalking.apm.collector.analysis.layer.register.provider.service;
package org.apache.skywalking.apm.collector.agent.stream.worker.register;
import org.apache.skywalking.apm.collector.agent.stream.service.register.IApplicationIDService;
import org.apache.skywalking.apm.collector.analysis.layer.register.define.service.IApplicationIDService;
import org.apache.skywalking.apm.collector.cache.CacheModule;
import org.apache.skywalking.apm.collector.cache.service.ApplicationCacheService;
import org.apache.skywalking.apm.collector.core.graph.Graph;
import org.apache.skywalking.apm.collector.core.graph.GraphManager;
import org.apache.skywalking.apm.collector.core.module.ModuleManager;
import org.apache.skywalking.apm.collector.core.util.ObjectUtils;
import org.apache.skywalking.apm.collector.storage.table.register.Application;
import org.apache.skywalking.apm.collector.agent.stream.service.graph.RegisterStreamGraphDefine;
import org.apache.skywalking.apm.collector.cache.service.ApplicationCacheService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -48,7 +45,7 @@ public class ApplicationIDService implements IApplicationIDService {
private Graph<Application> getApplicationRegisterGraph() {
if (ObjectUtils.isEmpty(applicationRegisterGraph)) {
this.applicationRegisterGraph = GraphManager.INSTANCE.createIfAbsent(RegisterStreamGraphDefine.APPLICATION_REGISTER_GRAPH_ID, Application.class);
// this.applicationRegisterGraph = GraphManager.INSTANCE.createIfAbsent(RegisterStreamGraphDefine.APPLICATION_REGISTER_GRAPH_ID, Application.class);
}
return this.applicationRegisterGraph;
}
......
......@@ -16,20 +16,17 @@
*
*/
package org.apache.skywalking.apm.collector.analysis.layer.register.provider.service;
package org.apache.skywalking.apm.collector.agent.stream.worker.register;
import org.apache.skywalking.apm.collector.agent.stream.service.register.IInstanceIDService;
import org.apache.skywalking.apm.collector.analysis.layer.register.define.service.IInstanceIDService;
import org.apache.skywalking.apm.collector.cache.CacheModule;
import org.apache.skywalking.apm.collector.cache.service.InstanceCacheService;
import org.apache.skywalking.apm.collector.core.graph.Graph;
import org.apache.skywalking.apm.collector.core.graph.GraphManager;
import org.apache.skywalking.apm.collector.core.module.ModuleManager;
import org.apache.skywalking.apm.collector.core.util.ObjectUtils;
import org.apache.skywalking.apm.collector.storage.StorageModule;
import org.apache.skywalking.apm.collector.storage.dao.IInstanceRegisterDAO;
import org.apache.skywalking.apm.collector.storage.table.register.Instance;
import org.apache.skywalking.apm.collector.agent.stream.service.graph.RegisterStreamGraphDefine;
import org.apache.skywalking.apm.collector.storage.StorageModule;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -58,7 +55,7 @@ public class InstanceIDService implements IInstanceIDService {
private Graph<Instance> getInstanceRegisterGraph() {
if (ObjectUtils.isEmpty(instanceRegisterGraph)) {
this.instanceRegisterGraph = GraphManager.INSTANCE.createIfAbsent(RegisterStreamGraphDefine.INSTANCE_REGISTER_GRAPH_ID, Instance.class);
// this.instanceRegisterGraph = GraphManager.INSTANCE.createIfAbsent(RegisterStreamGraphDefine.INSTANCE_REGISTER_GRAPH_ID, Instance.class);
}
return instanceRegisterGraph;
}
......
......@@ -16,17 +16,14 @@
*
*/
package org.apache.skywalking.apm.collector.analysis.layer.register.provider.service;
package org.apache.skywalking.apm.collector.agent.stream.worker.register;
import org.apache.skywalking.apm.collector.analysis.layer.register.define.service.IServiceNameService;
import org.apache.skywalking.apm.collector.cache.CacheModule;
import org.apache.skywalking.apm.collector.cache.service.ServiceIdCacheService;
import org.apache.skywalking.apm.collector.core.graph.Graph;
import org.apache.skywalking.apm.collector.core.graph.GraphManager;
import org.apache.skywalking.apm.collector.core.module.ModuleManager;
import org.apache.skywalking.apm.collector.core.util.ObjectUtils;
import org.apache.skywalking.apm.collector.agent.stream.service.graph.RegisterStreamGraphDefine;
import org.apache.skywalking.apm.collector.agent.stream.service.register.IServiceNameService;
import org.apache.skywalking.apm.collector.cache.service.ServiceIdCacheService;
import org.apache.skywalking.apm.collector.storage.table.register.ServiceName;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -55,7 +52,7 @@ public class ServiceNameService implements IServiceNameService {
private Graph<ServiceName> getServiceNameRegisterGraph() {
if (ObjectUtils.isEmpty(serviceNameRegisterGraph)) {
this.serviceNameRegisterGraph = GraphManager.INSTANCE.createIfAbsent(RegisterStreamGraphDefine.SERVICE_NAME_REGISTER_GRAPH_ID, ServiceName.class);
// this.serviceNameRegisterGraph = GraphManager.INSTANCE.createIfAbsent(RegisterStreamGraphDefine.SERVICE_NAME_REGISTER_GRAPH_ID, ServiceName.class);
}
return serviceNameRegisterGraph;
}
......
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
org.apache.skywalking.apm.collector.analysis.layer.register.provider.AnalysisLayerRegisterModuleProvider
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Licensed to the Apache Software Foundation (ASF) under one or more
~ contributor license agreements. See the NOTICE file distributed with
~ this work for additional information regarding copyright ownership.
~ The ASF licenses this file to You under the Apache License, Version 2.0
~ (the "License"); you may not use this file except in compliance with
~ the License. You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
~
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>apm-collector-analysis</artifactId>
<groupId>org.apache.skywalking</groupId>
<version>5.0.0-alpha</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>analysis-layer-register</artifactId>
<packaging>pom</packaging>
<modules>
<module>layer-register-define</module>
<module>layer-register-provider</module>
</modules>
</project>
\ No newline at end of file
......@@ -36,5 +36,15 @@
<artifactId>segment-parser-define</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.skywalking</groupId>
<artifactId>layer-register-define</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.skywalking</groupId>
<artifactId>collector-cache-define</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</project>
\ No newline at end of file
......@@ -32,7 +32,7 @@ import org.apache.skywalking.apm.collector.core.module.ServiceNotProvidedExcepti
/**
* @author peng-yongsheng
*/
public class AnalysisTraceParseModuleProvider extends ModuleProvider {
public class AnalysisSegmentParserModuleProvider extends ModuleProvider {
public static final String NAME = "default";
private SegmentParserListenerManager listenerManager;
......
......@@ -16,16 +16,16 @@
*
*/
package org.apache.skywalking.apm.collector.analysis.segment.parser.provider.parser.standardization;
import org.apache.skywalking.apm.collector.analysis.layer.register.define.AnalysisLayerRegisterModule;
import org.apache.skywalking.apm.collector.analysis.layer.register.define.service.IApplicationIDService;
import org.apache.skywalking.apm.collector.analysis.layer.register.define.service.IServiceNameService;
import org.apache.skywalking.apm.collector.analysis.segment.parser.define.decorator.ReferenceDecorator;
import org.apache.skywalking.apm.collector.core.util.Const;
import org.apache.skywalking.apm.collector.agent.stream.worker.register.ApplicationIDService;
import org.apache.skywalking.apm.collector.agent.stream.worker.register.ServiceNameService;
import org.apache.skywalking.apm.collector.cache.CacheModule;
import org.apache.skywalking.apm.collector.cache.service.InstanceCacheService;
import org.apache.skywalking.apm.collector.core.module.ModuleManager;
import org.apache.skywalking.apm.collector.core.util.Const;
import org.apache.skywalking.apm.collector.core.util.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -38,8 +38,8 @@ public class ReferenceIdExchanger implements IdExchanger<ReferenceDecorator> {
private final Logger logger = LoggerFactory.getLogger(ReferenceIdExchanger.class);
private static ReferenceIdExchanger EXCHANGER;
private final ServiceNameService serviceNameService;
private final ApplicationIDService applicationIDService;
private final IApplicationIDService applicationIDService;
private final IServiceNameService serviceNameService;
private final InstanceCacheService instanceCacheService;
public static ReferenceIdExchanger getInstance(ModuleManager moduleManager) {
......@@ -50,8 +50,8 @@ public class ReferenceIdExchanger implements IdExchanger<ReferenceDecorator> {
}
private ReferenceIdExchanger(ModuleManager moduleManager) {
applicationIDService = new ApplicationIDService(moduleManager);
serviceNameService = new ServiceNameService(moduleManager);
applicationIDService = moduleManager.find(AnalysisLayerRegisterModule.NAME).getService(IApplicationIDService.class);
serviceNameService = moduleManager.find(AnalysisLayerRegisterModule.NAME).getService(IServiceNameService.class);
instanceCacheService = moduleManager.find(CacheModule.NAME).getService(InstanceCacheService.class);
}
......
......@@ -18,8 +18,9 @@
package org.apache.skywalking.apm.collector.analysis.segment.parser.provider.parser.standardization;
import org.apache.skywalking.apm.collector.agent.stream.worker.register.ApplicationIDService;
import org.apache.skywalking.apm.collector.agent.stream.worker.register.ServiceNameService;
import org.apache.skywalking.apm.collector.analysis.layer.register.define.AnalysisLayerRegisterModule;
import org.apache.skywalking.apm.collector.analysis.layer.register.define.service.IApplicationIDService;
import org.apache.skywalking.apm.collector.analysis.layer.register.define.service.IServiceNameService;
import org.apache.skywalking.apm.collector.analysis.segment.parser.define.decorator.SpanDecorator;
import org.apache.skywalking.apm.collector.core.module.ModuleManager;
import org.apache.skywalking.apm.collector.core.util.Const;
......@@ -35,8 +36,8 @@ public class SpanIdExchanger implements IdExchanger<SpanDecorator> {
private final Logger logger = LoggerFactory.getLogger(SpanIdExchanger.class);
private static SpanIdExchanger EXCHANGER;
private final ApplicationIDService applicationIDService;
private final ServiceNameService serviceNameService;
private final IApplicationIDService applicationIDService;
private final IServiceNameService serviceNameService;
public static SpanIdExchanger getInstance(ModuleManager moduleManager) {
if (EXCHANGER == null) {
......@@ -46,8 +47,8 @@ public class SpanIdExchanger implements IdExchanger<SpanDecorator> {
}
private SpanIdExchanger(ModuleManager moduleManager) {
this.applicationIDService = new ApplicationIDService(moduleManager);
this.serviceNameService = new ServiceNameService(moduleManager);
applicationIDService = moduleManager.find(AnalysisLayerRegisterModule.NAME).getService(IApplicationIDService.class);
serviceNameService = moduleManager.find(AnalysisLayerRegisterModule.NAME).getService(IServiceNameService.class);
}
@Override public boolean exchange(SpanDecorator standardBuilder, int applicationId) {
......
......@@ -16,22 +16,4 @@
#
#
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
org.apache.skywalking.apm.collector.analysis.segment.parser.provider.AnalysisTraceParseModuleProvider
\ No newline at end of file
org.apache.skywalking.apm.collector.analysis.segment.parser.provider.AnalysisSegmentParserModuleProvider
\ No newline at end of file
......@@ -31,6 +31,7 @@
<packaging>pom</packaging>
<modules>
<module>analysis-segment-parser</module>
<module>analysis-layer-register</module>
</modules>
<dependencies>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册