Separation the remote gRPC server from the receiver gRPC server. (#2335)
* #2327 Add a new module for share receiver server or to be a bridge of core server. * Rename the module name.
This commit is contained in:
parent
7c726905c3
commit
6d00642386
|
|
@ -66,6 +66,8 @@ storage:
|
|||
# url: ${SW_STORAGE_H2_URL:jdbc:h2:mem:skywalking-oap-db}
|
||||
# user: ${SW_STORAGE_H2_USER:sa}
|
||||
# mysql:
|
||||
receiver-sharing-server:
|
||||
default:
|
||||
receiver-register:
|
||||
default:
|
||||
receiver-trace:
|
||||
|
|
|
|||
|
|
@ -112,10 +112,12 @@ public class GRPCServer implements Server {
|
|||
}
|
||||
|
||||
public void addHandler(BindableService handler) {
|
||||
logger.info("Bind handler {} into gRPC server {}:{}", handler.getClass().getSimpleName(), host, port);
|
||||
nettyServerBuilder.addService(handler);
|
||||
}
|
||||
|
||||
public void addHandler(ServerServiceDefinition definition) {
|
||||
logger.info("Bind handler {} into gRPC server {}:{}", definition.getClass().getSimpleName(), host, port);
|
||||
nettyServerBuilder.addService(definition);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -71,6 +71,8 @@ public class JettyServer implements Server {
|
|||
}
|
||||
|
||||
public void addHandler(JettyHandler handler) {
|
||||
logger.info("Bind handler {} into jetty server {}:{}", handler.getClass().getSimpleName(), host, port);
|
||||
|
||||
ServletHolder servletHolder = new ServletHolder();
|
||||
servletHolder.setServlet(handler);
|
||||
servletContextHandler.addServlet(servletHolder, handler.pathSpec());
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@
|
|||
<module>skywalking-register-receiver-plugin</module>
|
||||
<module>skywalking-jvm-receiver-plugin</module>
|
||||
<module>envoy-metrics-receiver-plugin</module>
|
||||
<module>skywalking-sharing-server-plugin</module>
|
||||
</modules>
|
||||
|
||||
<dependencies>
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ import org.apache.skywalking.oap.server.core.CoreModule;
|
|||
import org.apache.skywalking.oap.server.core.server.GRPCHandlerRegister;
|
||||
import org.apache.skywalking.oap.server.library.module.*;
|
||||
import org.apache.skywalking.oap.server.receiver.istio.telemetry.module.IstioTelemetryReceiverModule;
|
||||
import org.apache.skywalking.oap.server.receiver.sharing.server.SharingServerModule;
|
||||
import org.apache.skywalking.oap.server.telemetry.TelemetryModule;
|
||||
|
||||
public class IstioTelemetryReceiverProvider extends ModuleProvider {
|
||||
|
|
@ -42,7 +43,7 @@ public class IstioTelemetryReceiverProvider extends ModuleProvider {
|
|||
}
|
||||
|
||||
@Override public void start() throws ServiceNotProvidedException, ModuleStartException {
|
||||
GRPCHandlerRegister service = getManager().find(CoreModule.NAME).provider().getService(GRPCHandlerRegister.class);
|
||||
GRPCHandlerRegister service = getManager().find(SharingServerModule.NAME).provider().getService(GRPCHandlerRegister.class);
|
||||
service.addHandler(new IstioTelemetryGRPCHandler(getManager()));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,8 @@
|
|||
~
|
||||
-->
|
||||
|
||||
<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">
|
||||
<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>server-receiver-plugin</artifactId>
|
||||
<groupId>org.apache.skywalking</groupId>
|
||||
|
|
@ -27,4 +28,12 @@
|
|||
|
||||
<artifactId>skywalking-jvm-receiver-plugin</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.skywalking</groupId>
|
||||
<artifactId>skywalking-sharing-server-plugin</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
@ -20,12 +20,10 @@ package org.apache.skywalking.oap.server.receiver.jvm.provider;
|
|||
|
||||
import org.apache.skywalking.oap.server.core.CoreModule;
|
||||
import org.apache.skywalking.oap.server.core.server.GRPCHandlerRegister;
|
||||
import org.apache.skywalking.oap.server.library.module.ModuleConfig;
|
||||
import org.apache.skywalking.oap.server.library.module.ModuleDefine;
|
||||
import org.apache.skywalking.oap.server.library.module.ModuleProvider;
|
||||
import org.apache.skywalking.oap.server.library.module.*;
|
||||
import org.apache.skywalking.oap.server.receiver.jvm.module.JVMModule;
|
||||
import org.apache.skywalking.oap.server.receiver.jvm.provider.handler.JVMMetricReportServiceHandler;
|
||||
import org.apache.skywalking.oap.server.receiver.jvm.provider.handler.JVMMetricsServiceHandler;
|
||||
import org.apache.skywalking.oap.server.receiver.jvm.provider.handler.*;
|
||||
import org.apache.skywalking.oap.server.receiver.sharing.server.SharingServerModule;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
|
|
@ -48,7 +46,7 @@ public class JVMModuleProvider extends ModuleProvider {
|
|||
}
|
||||
|
||||
@Override public void start() {
|
||||
GRPCHandlerRegister grpcHandlerRegister = getManager().find(CoreModule.NAME).provider().getService(GRPCHandlerRegister.class);
|
||||
GRPCHandlerRegister grpcHandlerRegister = getManager().find(SharingServerModule.NAME).provider().getService(GRPCHandlerRegister.class);
|
||||
grpcHandlerRegister.addHandler(new JVMMetricsServiceHandler(getManager()));
|
||||
grpcHandlerRegister.addHandler(new JVMMetricReportServiceHandler(getManager()));
|
||||
}
|
||||
|
|
@ -58,6 +56,6 @@ public class JVMModuleProvider extends ModuleProvider {
|
|||
}
|
||||
|
||||
@Override public String[] requiredModules() {
|
||||
return new String[] {CoreModule.NAME};
|
||||
return new String[] {CoreModule.NAME, SharingServerModule.NAME};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,8 @@
|
|||
~
|
||||
-->
|
||||
|
||||
<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">
|
||||
<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>server-receiver-plugin</artifactId>
|
||||
<groupId>org.apache.skywalking</groupId>
|
||||
|
|
@ -28,4 +29,11 @@
|
|||
<artifactId>skywalking-mesh-receiver-plugin</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.skywalking</groupId>
|
||||
<artifactId>skywalking-sharing-server-plugin</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
@ -22,7 +22,7 @@ import java.io.IOException;
|
|||
import org.apache.skywalking.oap.server.core.CoreModule;
|
||||
import org.apache.skywalking.oap.server.core.server.GRPCHandlerRegister;
|
||||
import org.apache.skywalking.oap.server.library.module.*;
|
||||
import org.apache.skywalking.oap.server.library.module.ModuleDefine;
|
||||
import org.apache.skywalking.oap.server.receiver.sharing.server.SharingServerModule;
|
||||
import org.apache.skywalking.oap.server.telemetry.TelemetryModule;
|
||||
|
||||
public class MeshReceiverProvider extends ModuleProvider {
|
||||
|
|
@ -56,7 +56,7 @@ public class MeshReceiverProvider extends ModuleProvider {
|
|||
throw new ModuleStartException(e.getMessage(), e);
|
||||
}
|
||||
CoreRegisterLinker.setModuleManager(getManager());
|
||||
GRPCHandlerRegister service = getManager().find(CoreModule.NAME).provider().getService(GRPCHandlerRegister.class);
|
||||
GRPCHandlerRegister service = getManager().find(SharingServerModule.NAME).provider().getService(GRPCHandlerRegister.class);
|
||||
service.addHandler(new MeshGRPCHandler(getManager()));
|
||||
}
|
||||
|
||||
|
|
@ -65,6 +65,6 @@ public class MeshReceiverProvider extends ModuleProvider {
|
|||
}
|
||||
|
||||
@Override public String[] requiredModules() {
|
||||
return new String[] {TelemetryModule.NAME, CoreModule.NAME};
|
||||
return new String[] {TelemetryModule.NAME, CoreModule.NAME, SharingServerModule.NAME};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,8 @@
|
|||
~
|
||||
-->
|
||||
|
||||
<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">
|
||||
<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>server-receiver-plugin</artifactId>
|
||||
<groupId>org.apache.skywalking</groupId>
|
||||
|
|
@ -34,5 +35,10 @@
|
|||
<artifactId>apm-network</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.skywalking</groupId>
|
||||
<artifactId>skywalking-sharing-server-plugin</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
@ -19,23 +19,13 @@
|
|||
package org.apache.skywalking.oap.server.receiver.register.provider;
|
||||
|
||||
import org.apache.skywalking.oap.server.core.CoreModule;
|
||||
import org.apache.skywalking.oap.server.core.server.GRPCHandlerRegister;
|
||||
import org.apache.skywalking.oap.server.core.server.JettyHandlerRegister;
|
||||
import org.apache.skywalking.oap.server.library.module.ModuleConfig;
|
||||
import org.apache.skywalking.oap.server.library.module.ModuleDefine;
|
||||
import org.apache.skywalking.oap.server.library.module.ModuleProvider;
|
||||
import org.apache.skywalking.oap.server.core.server.*;
|
||||
import org.apache.skywalking.oap.server.library.module.*;
|
||||
import org.apache.skywalking.oap.server.receiver.register.module.RegisterModule;
|
||||
import org.apache.skywalking.oap.server.receiver.register.provider.handler.v5.grpc.ApplicationRegisterHandler;
|
||||
import org.apache.skywalking.oap.server.receiver.register.provider.handler.v5.grpc.InstanceDiscoveryServiceHandler;
|
||||
import org.apache.skywalking.oap.server.receiver.register.provider.handler.v5.grpc.NetworkAddressRegisterServiceHandler;
|
||||
import org.apache.skywalking.oap.server.receiver.register.provider.handler.v5.grpc.ServiceNameDiscoveryHandler;
|
||||
import org.apache.skywalking.oap.server.receiver.register.provider.handler.v5.rest.ApplicationRegisterServletHandler;
|
||||
import org.apache.skywalking.oap.server.receiver.register.provider.handler.v5.rest.InstanceDiscoveryServletHandler;
|
||||
import org.apache.skywalking.oap.server.receiver.register.provider.handler.v5.rest.InstanceHeartBeatServletHandler;
|
||||
import org.apache.skywalking.oap.server.receiver.register.provider.handler.v5.rest.NetworkAddressRegisterServletHandler;
|
||||
import org.apache.skywalking.oap.server.receiver.register.provider.handler.v5.rest.ServiceNameDiscoveryServiceHandler;
|
||||
import org.apache.skywalking.oap.server.receiver.register.provider.handler.v6.grpc.RegisterServiceHandler;
|
||||
import org.apache.skywalking.oap.server.receiver.register.provider.handler.v6.grpc.ServiceInstancePingServiceHandler;
|
||||
import org.apache.skywalking.oap.server.receiver.register.provider.handler.v5.grpc.*;
|
||||
import org.apache.skywalking.oap.server.receiver.register.provider.handler.v5.rest.*;
|
||||
import org.apache.skywalking.oap.server.receiver.register.provider.handler.v6.grpc.*;
|
||||
import org.apache.skywalking.oap.server.receiver.sharing.server.SharingServerModule;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
|
|
@ -58,7 +48,7 @@ public class RegisterModuleProvider extends ModuleProvider {
|
|||
}
|
||||
|
||||
@Override public void start() {
|
||||
GRPCHandlerRegister grpcHandlerRegister = getManager().find(CoreModule.NAME).provider().getService(GRPCHandlerRegister.class);
|
||||
GRPCHandlerRegister grpcHandlerRegister = getManager().find(SharingServerModule.NAME).provider().getService(GRPCHandlerRegister.class);
|
||||
grpcHandlerRegister.addHandler(new ApplicationRegisterHandler(getManager()));
|
||||
grpcHandlerRegister.addHandler(new InstanceDiscoveryServiceHandler(getManager()));
|
||||
grpcHandlerRegister.addHandler(new ServiceNameDiscoveryHandler(getManager()));
|
||||
|
|
@ -68,7 +58,7 @@ public class RegisterModuleProvider extends ModuleProvider {
|
|||
grpcHandlerRegister.addHandler(new RegisterServiceHandler(getManager()));
|
||||
grpcHandlerRegister.addHandler(new ServiceInstancePingServiceHandler(getManager()));
|
||||
|
||||
JettyHandlerRegister jettyHandlerRegister = getManager().find(CoreModule.NAME).provider().getService(JettyHandlerRegister.class);
|
||||
JettyHandlerRegister jettyHandlerRegister = getManager().find(SharingServerModule.NAME).provider().getService(JettyHandlerRegister.class);
|
||||
jettyHandlerRegister.addHandler(new ApplicationRegisterServletHandler(getManager()));
|
||||
jettyHandlerRegister.addHandler(new InstanceDiscoveryServletHandler(getManager()));
|
||||
jettyHandlerRegister.addHandler(new InstanceHeartBeatServletHandler(getManager()));
|
||||
|
|
@ -81,6 +71,6 @@ public class RegisterModuleProvider extends ModuleProvider {
|
|||
}
|
||||
|
||||
@Override public String[] requiredModules() {
|
||||
return new String[] {CoreModule.NAME};
|
||||
return new String[] {CoreModule.NAME, SharingServerModule.NAME};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,32 @@
|
|||
<?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>server-receiver-plugin</artifactId>
|
||||
<groupId>org.apache.skywalking</groupId>
|
||||
<version>6.1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>skywalking-sharing-server-plugin</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
</project>
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
/*
|
||||
* 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.oap.server.receiver.sharing.server;
|
||||
|
||||
import io.grpc.*;
|
||||
import lombok.Setter;
|
||||
import org.apache.skywalking.oap.server.core.server.GRPCHandlerRegister;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public class ReceiverGRPCHandlerRegister implements GRPCHandlerRegister {
|
||||
|
||||
@Setter private GRPCHandlerRegister grpcHandlerRegister;
|
||||
|
||||
@Override public void addHandler(BindableService handler) {
|
||||
grpcHandlerRegister.addHandler(handler);
|
||||
}
|
||||
|
||||
@Override public void addHandler(ServerServiceDefinition definition) {
|
||||
grpcHandlerRegister.addHandler(definition);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
* 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.oap.server.receiver.sharing.server;
|
||||
|
||||
import lombok.Setter;
|
||||
import org.apache.skywalking.oap.server.core.server.JettyHandlerRegister;
|
||||
import org.apache.skywalking.oap.server.library.server.jetty.JettyHandler;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public class ReceiverJettyHandlerRegister implements JettyHandlerRegister {
|
||||
|
||||
@Setter private JettyHandlerRegister jettyHandlerRegister;
|
||||
|
||||
@Override public void addHandler(JettyHandler serverHandler) {
|
||||
jettyHandlerRegister.addHandler(serverHandler);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
* 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.oap.server.receiver.sharing.server;
|
||||
|
||||
import lombok.*;
|
||||
import org.apache.skywalking.oap.server.library.module.ModuleConfig;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
public class SharingServerConfig extends ModuleConfig {
|
||||
private String restHost;
|
||||
private int restPort;
|
||||
private String restContextPath;
|
||||
private String gRPCHost;
|
||||
private int gRPCPort;
|
||||
private int maxConcurrentCallsPerConnection;
|
||||
private int maxMessageSize;
|
||||
}
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* 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.oap.server.receiver.sharing.server;
|
||||
|
||||
import org.apache.skywalking.oap.server.core.server.*;
|
||||
import org.apache.skywalking.oap.server.library.module.ModuleDefine;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public class SharingServerModule extends ModuleDefine {
|
||||
|
||||
public static final String NAME = "receiver-sharing-server";
|
||||
|
||||
public SharingServerModule() {
|
||||
super(NAME);
|
||||
}
|
||||
|
||||
@Override public Class[] services() {
|
||||
return new Class[] {GRPCHandlerRegister.class, JettyHandlerRegister.class};
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,116 @@
|
|||
/*
|
||||
* 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.oap.server.receiver.sharing.server;
|
||||
|
||||
import java.util.Objects;
|
||||
import org.apache.logging.log4j.util.Strings;
|
||||
import org.apache.skywalking.oap.server.core.CoreModule;
|
||||
import org.apache.skywalking.oap.server.core.remote.health.HealthCheckServiceHandler;
|
||||
import org.apache.skywalking.oap.server.core.server.*;
|
||||
import org.apache.skywalking.oap.server.library.module.*;
|
||||
import org.apache.skywalking.oap.server.library.server.ServerException;
|
||||
import org.apache.skywalking.oap.server.library.server.grpc.GRPCServer;
|
||||
import org.apache.skywalking.oap.server.library.server.jetty.JettyServer;
|
||||
|
||||
/**
|
||||
* @author peng-yongsheng
|
||||
*/
|
||||
public class SharingServerModuleProvider extends ModuleProvider {
|
||||
|
||||
private final SharingServerConfig config;
|
||||
private GRPCServer grpcServer;
|
||||
private JettyServer jettyServer;
|
||||
private ReceiverGRPCHandlerRegister receiverGRPCHandlerRegister;
|
||||
private ReceiverJettyHandlerRegister receiverJettyHandlerRegister;
|
||||
|
||||
public SharingServerModuleProvider() {
|
||||
super();
|
||||
this.config = new SharingServerConfig();
|
||||
}
|
||||
|
||||
@Override public String name() {
|
||||
return "default";
|
||||
}
|
||||
|
||||
@Override public Class<? extends ModuleDefine> module() {
|
||||
return SharingServerModule.class;
|
||||
}
|
||||
|
||||
@Override public ModuleConfig createConfigBeanIfAbsent() {
|
||||
return config;
|
||||
}
|
||||
|
||||
@Override public void prepare() {
|
||||
if (config.getRestPort() != 0) {
|
||||
jettyServer = new JettyServer(Strings.isBlank(config.getRestHost()) ? "0.0.0.0" : config.getRestHost(), config.getRestPort(), config.getRestContextPath());
|
||||
jettyServer.initialize();
|
||||
|
||||
this.registerServiceImplementation(JettyHandlerRegister.class, new JettyHandlerRegisterImpl(jettyServer));
|
||||
} else {
|
||||
this.receiverJettyHandlerRegister = new ReceiverJettyHandlerRegister();
|
||||
this.registerServiceImplementation(JettyHandlerRegister.class, receiverJettyHandlerRegister);
|
||||
}
|
||||
|
||||
if (config.getGRPCPort() != 0) {
|
||||
grpcServer = new GRPCServer(Strings.isBlank(config.getGRPCHost()) ? "0.0.0.0" : config.getGRPCHost(), config.getGRPCPort());
|
||||
if (config.getMaxMessageSize() > 0) {
|
||||
grpcServer.setMaxMessageSize(config.getMaxMessageSize());
|
||||
}
|
||||
if (config.getMaxConcurrentCallsPerConnection() > 0) {
|
||||
grpcServer.setMaxConcurrentCallsPerConnection(config.getMaxConcurrentCallsPerConnection());
|
||||
}
|
||||
grpcServer.initialize();
|
||||
|
||||
this.registerServiceImplementation(GRPCHandlerRegister.class, new GRPCHandlerRegisterImpl(grpcServer));
|
||||
} else {
|
||||
this.receiverGRPCHandlerRegister = new ReceiverGRPCHandlerRegister();
|
||||
this.registerServiceImplementation(GRPCHandlerRegister.class, receiverGRPCHandlerRegister);
|
||||
}
|
||||
}
|
||||
|
||||
@Override public void start() {
|
||||
if (Objects.nonNull(grpcServer)) {
|
||||
grpcServer.addHandler(new HealthCheckServiceHandler());
|
||||
}
|
||||
|
||||
if (Objects.nonNull(receiverGRPCHandlerRegister)) {
|
||||
receiverGRPCHandlerRegister.setGrpcHandlerRegister(getManager().find(CoreModule.NAME).provider().getService(GRPCHandlerRegister.class));
|
||||
}
|
||||
if (Objects.nonNull(receiverJettyHandlerRegister)) {
|
||||
receiverJettyHandlerRegister.setJettyHandlerRegister(getManager().find(CoreModule.NAME).provider().getService(JettyHandlerRegister.class));
|
||||
}
|
||||
}
|
||||
|
||||
@Override public void notifyAfterCompleted() throws ModuleStartException {
|
||||
try {
|
||||
if (Objects.nonNull(grpcServer)) {
|
||||
grpcServer.start();
|
||||
}
|
||||
if (Objects.nonNull(jettyServer)) {
|
||||
jettyServer.start();
|
||||
}
|
||||
} catch (ServerException e) {
|
||||
throw new ModuleStartException(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override public String[] requiredModules() {
|
||||
return new String[] {CoreModule.NAME};
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
#
|
||||
# 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.oap.server.receiver.sharing.server.SharingServerModule
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
#
|
||||
# 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.oap.server.receiver.sharing.server.SharingServerModuleProvider
|
||||
|
|
@ -17,7 +17,8 @@
|
|||
~
|
||||
-->
|
||||
|
||||
<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">
|
||||
<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>server-receiver-plugin</artifactId>
|
||||
<groupId>org.apache.skywalking</groupId>
|
||||
|
|
@ -27,4 +28,12 @@
|
|||
|
||||
<artifactId>skywalking-trace-receiver-plugin</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.skywalking</groupId>
|
||||
<artifactId>skywalking-sharing-server-plugin</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
@ -22,6 +22,7 @@ import java.io.IOException;
|
|||
import org.apache.skywalking.oap.server.core.CoreModule;
|
||||
import org.apache.skywalking.oap.server.core.server.*;
|
||||
import org.apache.skywalking.oap.server.library.module.*;
|
||||
import org.apache.skywalking.oap.server.receiver.sharing.server.SharingServerModule;
|
||||
import org.apache.skywalking.oap.server.receiver.trace.module.TraceModule;
|
||||
import org.apache.skywalking.oap.server.receiver.trace.provider.handler.v5.grpc.TraceSegmentServiceHandler;
|
||||
import org.apache.skywalking.oap.server.receiver.trace.provider.handler.v5.rest.TraceSegmentServletHandler;
|
||||
|
|
@ -79,8 +80,8 @@ public class TraceModuleProvider extends ModuleProvider {
|
|||
}
|
||||
|
||||
@Override public void start() throws ModuleStartException {
|
||||
GRPCHandlerRegister grpcHandlerRegister = getManager().find(CoreModule.NAME).provider().getService(GRPCHandlerRegister.class);
|
||||
JettyHandlerRegister jettyHandlerRegister = getManager().find(CoreModule.NAME).provider().getService(JettyHandlerRegister.class);
|
||||
GRPCHandlerRegister grpcHandlerRegister = getManager().find(SharingServerModule.NAME).provider().getService(GRPCHandlerRegister.class);
|
||||
JettyHandlerRegister jettyHandlerRegister = getManager().find(SharingServerModule.NAME).provider().getService(JettyHandlerRegister.class);
|
||||
try {
|
||||
|
||||
grpcHandlerRegister.addHandler(new TraceSegmentServiceHandler(segmentProducer));
|
||||
|
|
@ -106,6 +107,6 @@ public class TraceModuleProvider extends ModuleProvider {
|
|||
}
|
||||
|
||||
@Override public String[] requiredModules() {
|
||||
return new String[] {TelemetryModule.NAME, CoreModule.NAME};
|
||||
return new String[] {TelemetryModule.NAME, CoreModule.NAME, SharingServerModule.NAME};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -66,6 +66,8 @@ storage:
|
|||
# flushInterval: ${SW_STORAGE_ES_FLUSH_INTERVAL:10} # flush the bulk every 10 seconds whatever the number of requests
|
||||
# concurrentRequests: ${SW_STORAGE_ES_CONCURRENT_REQUESTS:2} # the number of concurrent requests
|
||||
# mysql:
|
||||
receiver-sharing-server:
|
||||
default:
|
||||
receiver-register:
|
||||
default:
|
||||
receiver-trace:
|
||||
|
|
|
|||
|
|
@ -66,6 +66,8 @@ storage:
|
|||
# url: ${SW_STORAGE_H2_URL:jdbc:h2:mem:skywalking-oap-db}
|
||||
# user: ${SW_STORAGE_H2_USER:sa}
|
||||
# mysql:
|
||||
receiver-sharing-server:
|
||||
default:
|
||||
receiver-register:
|
||||
default:
|
||||
receiver-trace:
|
||||
|
|
|
|||
Loading…
Reference in New Issue