Support Jetty server advanced configuration. (#5147)
This commit is contained in:
parent
1439e7588d
commit
db9f8e6e00
|
|
@ -18,25 +18,47 @@ We have following receivers, and `default` implementors are provided in our Apac
|
|||
The sample settings of these receivers should be already in default `application.yml`, and also list here
|
||||
```yaml
|
||||
receiver-register:
|
||||
selector: ${SW_RECEIVER_REGISTER:default}
|
||||
default:
|
||||
|
||||
receiver-trace:
|
||||
selector: ${SW_RECEIVER_TRACE:default}
|
||||
default:
|
||||
sampleRate: ${SW_TRACE_SAMPLE_RATE:1000} # The sample rate precision is 1/10000. 10000 means 100% sample in default.
|
||||
sampleRate: ${SW_TRACE_SAMPLE_RATE:10000} # The sample rate precision is 1/10000. 10000 means 100% sample in default.
|
||||
slowDBAccessThreshold: ${SW_SLOW_DB_THRESHOLD:default:200,mongodb:100} # The slow database access thresholds. Unit ms.
|
||||
|
||||
receiver-jvm:
|
||||
selector: ${SW_RECEIVER_JVM:default}
|
||||
default:
|
||||
|
||||
service-mesh:
|
||||
selector: ${SW_SERVICE_MESH:default}
|
||||
default:
|
||||
|
||||
istio-telemetry:
|
||||
selector: ${SW_ISTIO_TELEMETRY:default}
|
||||
default:
|
||||
|
||||
envoy-metric:
|
||||
selector: ${SW_ENVOY_METRIC:default}
|
||||
default:
|
||||
acceptMetricsService: ${SW_ENVOY_METRIC_SERVICE:true}
|
||||
alsHTTPAnalysis: ${SW_ENVOY_METRIC_ALS_HTTP_ANALYSIS:""}
|
||||
|
||||
receiver_zipkin:
|
||||
selector: ${SW_RECEIVER_ZIPKIN:-}
|
||||
default:
|
||||
host: 0.0.0.0
|
||||
port: 9411
|
||||
contextPath: /
|
||||
host: ${SW_RECEIVER_ZIPKIN_HOST:0.0.0.0}
|
||||
port: ${SW_RECEIVER_ZIPKIN_PORT:9411}
|
||||
contextPath: ${SW_RECEIVER_ZIPKIN_CONTEXT_PATH:/}
|
||||
jettyMinThreads: ${SW_RECEIVER_ZIPKIN_JETTY_MIN_THREADS:1}
|
||||
jettyMaxThreads: ${SW_RECEIVER_ZIPKIN_JETTY_MAX_THREADS:200}
|
||||
jettyIdleTimeOut: ${SW_RECEIVER_ZIPKIN_JETTY_IDLE_TIMEOUT:30000}
|
||||
jettyAcceptorPriorityDelta: ${SW_RECEIVER_ZIPKIN_JETTY_DELTA:0}
|
||||
jettyAcceptQueueSize: ${SW_RECEIVER_ZIPKIN_QUEUE_SIZE:0}
|
||||
|
||||
receiver-profile:
|
||||
selector: ${SW_RECEIVER_PROFILE:default}
|
||||
default:
|
||||
```
|
||||
|
||||
|
|
@ -46,12 +68,16 @@ But the `receiver-sharing-server` module provide a way to make all receivers ser
|
|||
different ip:port, if you set them explicitly.
|
||||
```yaml
|
||||
receiver-sharing-server:
|
||||
selector: ${SW_RECEIVER_SHARING_SERVER:default}
|
||||
default:
|
||||
restHost: ${SW_SHARING_SERVER_REST_HOST:0.0.0.0}
|
||||
restPort: ${SW_SHARING_SERVER_REST_PORT:12800}
|
||||
restContextPath: ${SW_SHARING_SERVER_REST_CONTEXT_PATH:/}
|
||||
gRPCHost: ${SW_SHARING_SERVER_GRPC_HOST:0.0.0.0}
|
||||
gRPCPort: ${SW_SHARING_SERVER_GRPC_PORT:11800}
|
||||
host: ${SW_RECEIVER_JETTY_HOST:0.0.0.0}
|
||||
contextPath: ${SW_RECEIVER_JETTY_CONTEXT_PATH:/}
|
||||
authentication: ${SW_AUTHENTICATION:""}
|
||||
jettyMinThreads: ${SW_RECEIVER_SHARING_JETTY_MIN_THREADS:1}
|
||||
jettyMaxThreads: ${SW_RECEIVER_SHARING_JETTY_MAX_THREADS:200}
|
||||
jettyIdleTimeOut: ${SW_RECEIVER_SHARING_JETTY_IDLE_TIMEOUT:30000}
|
||||
jettyAcceptorPriorityDelta: ${SW_RECEIVER_SHARING_JETTY_DELTA:0}
|
||||
jettyAcceptQueueSize: ${SW_RECEIVER_SHARING_JETTY_QUEUE_SIZE:0}
|
||||
```
|
||||
|
||||
Notice, if you add these settings, make sure they are not as same as core module,
|
||||
|
|
@ -70,10 +96,16 @@ how to active.
|
|||
Use following config to active.
|
||||
```yaml
|
||||
receiver_zipkin:
|
||||
selector: ${SW_RECEIVER_ZIPKIN:-}
|
||||
default:
|
||||
host: ${SW_RECEIVER_ZIPKIN_HOST:0.0.0.0}
|
||||
port: ${SW_RECEIVER_ZIPKIN_PORT:9411}
|
||||
contextPath: ${SW_RECEIVER_ZIPKIN_CONTEXT_PATH:/}
|
||||
jettyMinThreads: ${SW_RECEIVER_ZIPKIN_JETTY_MIN_THREADS:1}
|
||||
jettyMaxThreads: ${SW_RECEIVER_ZIPKIN_JETTY_MAX_THREADS:200}
|
||||
jettyIdleTimeOut: ${SW_RECEIVER_ZIPKIN_JETTY_IDLE_TIMEOUT:30000}
|
||||
jettyAcceptorPriorityDelta: ${SW_RECEIVER_ZIPKIN_JETTY_DELTA:0}
|
||||
jettyAcceptQueueSize: ${SW_RECEIVER_ZIPKIN_QUEUE_SIZE:0}
|
||||
```
|
||||
|
||||
2. Analysis mode(Not production ready), receive Zipkin v1/v2 formats through HTTP service. Transform the trace to skywalking
|
||||
|
|
@ -83,11 +115,17 @@ because of Zipkin tag/endpoint value unpredictable, we can't make sure it fits p
|
|||
Active `analysis mode`, you should set `needAnalysis` config.
|
||||
```yaml
|
||||
receiver_zipkin:
|
||||
selector: ${SW_RECEIVER_ZIPKIN:-}
|
||||
default:
|
||||
host: ${SW_RECEIVER_ZIPKIN_HOST:0.0.0.0}
|
||||
port: ${SW_RECEIVER_ZIPKIN_PORT:9411}
|
||||
contextPath: ${SW_RECEIVER_ZIPKIN_CONTEXT_PATH:/}
|
||||
needAnalysis: true
|
||||
jettyMinThreads: ${SW_RECEIVER_ZIPKIN_JETTY_MIN_THREADS:1}
|
||||
jettyMaxThreads: ${SW_RECEIVER_ZIPKIN_JETTY_MAX_THREADS:200}
|
||||
jettyIdleTimeOut: ${SW_RECEIVER_ZIPKIN_JETTY_IDLE_TIMEOUT:30000}
|
||||
jettyAcceptorPriorityDelta: ${SW_RECEIVER_ZIPKIN_JETTY_DELTA:0}
|
||||
jettyAcceptQueueSize: ${SW_RECEIVER_ZIPKIN_QUEUE_SIZE:0}
|
||||
needAnalysis: true
|
||||
```
|
||||
|
||||
NOTICE, Zipkin receiver is only provided in `apache-skywalking-apm-x.y.z.tar.gz` tar.
|
||||
|
|
@ -105,6 +143,7 @@ to get more details.
|
|||
Active the receiver.
|
||||
```yaml
|
||||
receiver_jaeger:
|
||||
selector: ${SW_RECEIVER_JAEGER:-}
|
||||
default:
|
||||
gRPCHost: ${SW_RECEIVER_JAEGER_HOST:0.0.0.0}
|
||||
gRPCPort: ${SW_RECEIVER_JAEGER_PORT:14250}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,11 @@ core|default|role|Option values, `Mixed/Receiver/Aggregator`. **Receiver** mode
|
|||
| - | - | restHost| Binding IP of restful service. Services include GraphQL query and HTTP data report|SW_CORE_REST_HOST|0.0.0.0|
|
||||
| - | - | restPort | Binding port of restful service | SW_CORE_REST_PORT|12800|
|
||||
| - | - | restContextPath| Web context path of restful service| SW_CORE_REST_CONTEXT_PATH|/|
|
||||
| - | - | restMinThreads| Min threads number of restful service| SW_CORE_REST_JETTY_MIN_THREADS|1|
|
||||
| - | - | restMaxThreads| Max threads number of restful service| SW_CORE_REST_JETTY_MAX_THREADS|200|
|
||||
| - | - | restIdleTimeOut| Connector idle timeout in milliseconds of restful service| SW_CORE_REST_JETTY_IDLE_TIMEOUT|30000|
|
||||
| - | - | restAcceptorPriorityDelta| Thread priority delta to give to acceptor threads of restful service| SW_CORE_REST_JETTY_DELTA|0|
|
||||
| - | - | restAcceptQueueSize| ServerSocketChannel backlog of restful service| SW_CORE_REST_JETTY_QUEUE_SIZE|0|
|
||||
| - | - | gRPCHost|Binding IP of gRPC service. Services include gRPC data report and internal communication among OAP nodes|SW_CORE_GRPC_HOST|0.0.0.0|
|
||||
| - | - | gRPCPort| Binding port of gRPC service | SW_CORE_GRPC_PORT|11800|
|
||||
| - | - | gRPCSslEnabled| Activate SSL for gRPC service | SW_CORE_GRPC_SSL_ENABLED|false|
|
||||
|
|
|
|||
|
|
@ -57,6 +57,11 @@ core:
|
|||
restHost: ${SW_CORE_REST_HOST:0.0.0.0}
|
||||
restPort: ${SW_CORE_REST_PORT:12800}
|
||||
restContextPath: ${SW_CORE_REST_CONTEXT_PATH:/}
|
||||
restMinThreads: ${SW_CORE_REST_JETTY_MIN_THREADS:1}
|
||||
restMaxThreads: ${SW_CORE_REST_JETTY_MAX_THREADS:200}
|
||||
restIdleTimeOut: ${SW_CORE_REST_JETTY_IDLE_TIMEOUT:30000}
|
||||
restAcceptorPriorityDelta: ${SW_CORE_REST_JETTY_DELTA:0}
|
||||
restAcceptQueueSize: ${SW_CORE_REST_JETTY_QUEUE_SIZE:0}
|
||||
gRPCHost: ${SW_CORE_GRPC_HOST:0.0.0.0}
|
||||
gRPCPort: ${SW_CORE_GRPC_PORT:11800}
|
||||
gRPCSslEnabled: ${SW_CORE_GRPC_SSL_ENABLED:false}
|
||||
|
|
@ -156,7 +161,14 @@ storage:
|
|||
receiver-sharing-server:
|
||||
selector: ${SW_RECEIVER_SHARING_SERVER:default}
|
||||
default:
|
||||
host: ${SW_RECEIVER_JETTY_HOST:0.0.0.0}
|
||||
contextPath: ${SW_RECEIVER_JETTY_CONTEXT_PATH:/}
|
||||
authentication: ${SW_AUTHENTICATION:""}
|
||||
jettyMinThreads: ${SW_RECEIVER_SHARING_JETTY_MIN_THREADS:1}
|
||||
jettyMaxThreads: ${SW_RECEIVER_SHARING_JETTY_MAX_THREADS:200}
|
||||
jettyIdleTimeOut: ${SW_RECEIVER_SHARING_JETTY_IDLE_TIMEOUT:30000}
|
||||
jettyAcceptorPriorityDelta: ${SW_RECEIVER_SHARING_JETTY_DELTA:0}
|
||||
jettyAcceptQueueSize: ${SW_RECEIVER_SHARING_JETTY_QUEUE_SIZE:0}
|
||||
receiver-register:
|
||||
selector: ${SW_RECEIVER_REGISTER:default}
|
||||
default:
|
||||
|
|
@ -210,6 +222,11 @@ receiver_zipkin:
|
|||
host: ${SW_RECEIVER_ZIPKIN_HOST:0.0.0.0}
|
||||
port: ${SW_RECEIVER_ZIPKIN_PORT:9411}
|
||||
contextPath: ${SW_RECEIVER_ZIPKIN_CONTEXT_PATH:/}
|
||||
jettyMinThreads: ${SW_RECEIVER_ZIPKIN_JETTY_MIN_THREADS:1}
|
||||
jettyMaxThreads: ${SW_RECEIVER_ZIPKIN_JETTY_MAX_THREADS:200}
|
||||
jettyIdleTimeOut: ${SW_RECEIVER_ZIPKIN_JETTY_IDLE_TIMEOUT:30000}
|
||||
jettyAcceptorPriorityDelta: ${SW_RECEIVER_ZIPKIN_JETTY_DELTA:0}
|
||||
jettyAcceptQueueSize: ${SW_RECEIVER_ZIPKIN_QUEUE_SIZE:0}
|
||||
|
||||
receiver_jaeger:
|
||||
selector: ${SW_RECEIVER_JAEGER:-}
|
||||
|
|
|
|||
|
|
@ -30,8 +30,13 @@ public class CoreModuleConfig extends ModuleConfig {
|
|||
private String nameSpace;
|
||||
private String restHost;
|
||||
private int restPort;
|
||||
private int jettySelectors = 1;
|
||||
private String restContextPath;
|
||||
private int restMinThreads = 1;
|
||||
private int restMaxThreads = 200;
|
||||
private long restIdleTimeOut = 30000;
|
||||
private int restAcceptorPriorityDelta = 0;
|
||||
private int restAcceptQueueSize = 0;
|
||||
|
||||
private String gRPCHost;
|
||||
private int gRPCPort;
|
||||
private boolean gRPCSslEnabled = false;
|
||||
|
|
|
|||
|
|
@ -90,6 +90,7 @@ import org.apache.skywalking.oap.server.library.module.ServiceNotProvidedExcepti
|
|||
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;
|
||||
import org.apache.skywalking.oap.server.library.server.jetty.JettyServerConfig;
|
||||
import org.apache.skywalking.oap.server.library.util.ResourceUtils;
|
||||
import org.apache.skywalking.oap.server.telemetry.TelemetryModule;
|
||||
import org.apache.skywalking.oap.server.telemetry.api.TelemetryRelatedContext;
|
||||
|
|
@ -199,9 +200,19 @@ public class CoreModuleProvider extends ModuleProvider {
|
|||
}
|
||||
grpcServer.initialize();
|
||||
|
||||
jettyServer = new JettyServer(
|
||||
moduleConfig.getRestHost(), moduleConfig.getRestPort(), moduleConfig.getRestContextPath(), moduleConfig
|
||||
.getJettySelectors());
|
||||
JettyServerConfig jettyServerConfig = JettyServerConfig.builder()
|
||||
.host(moduleConfig.getRestHost())
|
||||
.port(moduleConfig.getRestPort())
|
||||
.contextPath(moduleConfig.getRestContextPath())
|
||||
.jettyIdleTimeOut(moduleConfig.getRestIdleTimeOut())
|
||||
.jettyAcceptorPriorityDelta(
|
||||
moduleConfig.getRestAcceptorPriorityDelta())
|
||||
.jettyMinThreads(moduleConfig.getRestMinThreads())
|
||||
.jettyMaxThreads(moduleConfig.getRestMaxThreads())
|
||||
.jettyAcceptQueueSize(
|
||||
moduleConfig.getRestAcceptQueueSize())
|
||||
.build();
|
||||
jettyServer = new JettyServer(jettyServerConfig);
|
||||
jettyServer.initialize();
|
||||
|
||||
this.registerServiceImplementation(ConfigService.class, new ConfigService(moduleConfig));
|
||||
|
|
|
|||
|
|
@ -18,13 +18,15 @@
|
|||
|
||||
package org.apache.skywalking.oap.server.library.server.jetty;
|
||||
|
||||
import java.net.InetSocketAddress;
|
||||
import java.util.Objects;
|
||||
import org.apache.skywalking.oap.server.library.server.Server;
|
||||
import org.apache.skywalking.oap.server.library.server.ServerException;
|
||||
import org.eclipse.jetty.server.Connector;
|
||||
import org.eclipse.jetty.server.ServerConnector;
|
||||
import org.eclipse.jetty.servlet.ServletContextHandler;
|
||||
import org.eclipse.jetty.servlet.ServletHolder;
|
||||
import org.eclipse.jetty.servlet.ServletMapping;
|
||||
import org.eclipse.jetty.util.thread.QueuedThreadPool;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
|
@ -32,27 +34,17 @@ public class JettyServer implements Server {
|
|||
|
||||
private static final Logger logger = LoggerFactory.getLogger(JettyServer.class);
|
||||
|
||||
private final String host;
|
||||
private final int port;
|
||||
private final String contextPath;
|
||||
private final int selectorNum;
|
||||
private org.eclipse.jetty.server.Server server;
|
||||
private ServletContextHandler servletContextHandler;
|
||||
private JettyServerConfig jettyServerConfig;
|
||||
|
||||
public JettyServer(String host, int port, String contextPath) {
|
||||
this(host, port, contextPath, -1);
|
||||
}
|
||||
|
||||
public JettyServer(String host, int port, String contextPath, int selectorNum) {
|
||||
this.host = host;
|
||||
this.port = port;
|
||||
this.contextPath = contextPath;
|
||||
this.selectorNum = selectorNum;
|
||||
public JettyServer(JettyServerConfig config) {
|
||||
this.jettyServerConfig = config;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String hostPort() {
|
||||
return host + ":" + port;
|
||||
return jettyServerConfig.getHost() + ":" + jettyServerConfig.getPort();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -62,17 +54,32 @@ public class JettyServer implements Server {
|
|||
|
||||
@Override
|
||||
public void initialize() {
|
||||
server = new org.eclipse.jetty.server.Server(new InetSocketAddress(host, port));
|
||||
QueuedThreadPool threadPool = new QueuedThreadPool();
|
||||
threadPool.setMinThreads(jettyServerConfig.getJettyMinThreads());
|
||||
threadPool.setMaxThreads(jettyServerConfig.getJettyMaxThreads());
|
||||
|
||||
server = new org.eclipse.jetty.server.Server(threadPool);
|
||||
|
||||
ServerConnector connector = new ServerConnector(server);
|
||||
connector.setHost(jettyServerConfig.getHost());
|
||||
connector.setPort(jettyServerConfig.getPort());
|
||||
connector.setIdleTimeout(jettyServerConfig.getJettyIdleTimeOut());
|
||||
connector.setAcceptorPriorityDelta(jettyServerConfig.getJettyAcceptorPriorityDelta());
|
||||
connector.setAcceptQueueSize(jettyServerConfig.getJettyAcceptQueueSize());
|
||||
server.setConnectors(new Connector[] {connector});
|
||||
|
||||
servletContextHandler = new ServletContextHandler(ServletContextHandler.NO_SESSIONS);
|
||||
servletContextHandler.setContextPath(contextPath);
|
||||
logger.info("http server root context path: {}", contextPath);
|
||||
servletContextHandler.setContextPath(jettyServerConfig.getContextPath());
|
||||
logger.info("http server root context path: {}", jettyServerConfig.getContextPath());
|
||||
|
||||
server.setHandler(servletContextHandler);
|
||||
}
|
||||
|
||||
public void addHandler(JettyHandler handler) {
|
||||
logger.info("Bind handler {} into jetty server {}:{}", handler.getClass().getSimpleName(), host, port);
|
||||
logger.info(
|
||||
"Bind handler {} into jetty server {}:{}",
|
||||
handler.getClass().getSimpleName(), jettyServerConfig.getHost(), jettyServerConfig.getPort()
|
||||
);
|
||||
|
||||
ServletHolder servletHolder = new ServletHolder();
|
||||
servletHolder.setServlet(handler);
|
||||
|
|
@ -91,15 +98,16 @@ public class JettyServer implements Server {
|
|||
|
||||
@Override
|
||||
public void start() throws ServerException {
|
||||
logger.info("start server, host: {}, port: {}", host, port);
|
||||
logger.info("start server, host: {}, port: {}", jettyServerConfig.getHost(), jettyServerConfig.getPort());
|
||||
try {
|
||||
if (logger.isDebugEnabled()) {
|
||||
if (servletContextHandler.getServletHandler() != null && servletContextHandler.getServletHandler()
|
||||
.getServletMappings() != null) {
|
||||
for (ServletMapping servletMapping : servletContextHandler.getServletHandler()
|
||||
.getServletMappings()) {
|
||||
logger.debug("jetty servlet mappings: {} register by {}", servletMapping.getPathSpecs(), servletMapping
|
||||
.getServletName());
|
||||
logger.debug(
|
||||
"jetty servlet mappings: {} register by {}", servletMapping.getPathSpecs(), servletMapping
|
||||
.getServletName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -117,11 +125,12 @@ public class JettyServer implements Server {
|
|||
if (o == null || getClass() != o.getClass())
|
||||
return false;
|
||||
JettyServer that = (JettyServer) o;
|
||||
return port == that.port && Objects.equals(host, that.host);
|
||||
return jettyServerConfig.getPort() == that.jettyServerConfig.getPort() && Objects.equals(
|
||||
jettyServerConfig.getHost(), that.jettyServerConfig.getHost());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(host, port);
|
||||
return Objects.hash(jettyServerConfig.getHost(), jettyServerConfig.getPort());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,33 +18,27 @@
|
|||
|
||||
package org.apache.skywalking.oap.server.library.server.jetty;
|
||||
|
||||
public abstract class JettyServerConfig {
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Setter
|
||||
@Getter
|
||||
@Builder
|
||||
public class JettyServerConfig {
|
||||
|
||||
private String host;
|
||||
private int port;
|
||||
private String contextPath;
|
||||
|
||||
public String getHost() {
|
||||
return host;
|
||||
}
|
||||
|
||||
public void setHost(String host) {
|
||||
this.host = host;
|
||||
}
|
||||
|
||||
public int getPort() {
|
||||
return port;
|
||||
}
|
||||
|
||||
public void setPort(int port) {
|
||||
this.port = port;
|
||||
}
|
||||
|
||||
public String getContextPath() {
|
||||
return contextPath;
|
||||
}
|
||||
|
||||
public void setContextPath(String contextPath) {
|
||||
this.contextPath = contextPath;
|
||||
}
|
||||
@Builder.Default
|
||||
private int jettyMinThreads = 1;
|
||||
@Builder.Default
|
||||
private int jettyMaxThreads = 200;
|
||||
@Builder.Default
|
||||
private long jettyIdleTimeOut = 30000;
|
||||
@Builder.Default
|
||||
private int jettyAcceptorPriorityDelta = 0;
|
||||
@Builder.Default
|
||||
private int jettyAcceptQueueSize = 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,12 +25,18 @@ import org.apache.skywalking.oap.server.library.module.ModuleConfig;
|
|||
@Getter
|
||||
@Setter
|
||||
public class SharingServerConfig extends ModuleConfig {
|
||||
private String restHost;
|
||||
private String host;
|
||||
/**
|
||||
* Only setting the real port(not 0) makes the jetty server online.
|
||||
*/
|
||||
private int restPort;
|
||||
private String restContextPath;
|
||||
private int port;
|
||||
private String contextPath;
|
||||
private int jettyMinThreads = 1;
|
||||
private int jettyMaxThreads = 200;
|
||||
private long jettyIdleTimeOut = 30000;
|
||||
private int jettyAcceptorPriorityDelta = 0;
|
||||
private int jettyAcceptQueueSize = 0;
|
||||
|
||||
private String gRPCHost;
|
||||
/**
|
||||
* Only setting the real port(not 0) makes the gRPC server online.
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ import org.apache.skywalking.oap.server.library.module.ModuleStartException;
|
|||
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;
|
||||
import org.apache.skywalking.oap.server.library.server.jetty.JettyServerConfig;
|
||||
|
||||
public class SharingServerModuleProvider extends ModuleProvider {
|
||||
|
||||
|
|
@ -67,9 +68,22 @@ public class SharingServerModuleProvider extends ModuleProvider {
|
|||
|
||||
@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());
|
||||
JettyServerConfig jettyServerConfig = JettyServerConfig.builder()
|
||||
.host(config.getHost()).port(config.getPort())
|
||||
.contextPath(config.getContextPath())
|
||||
.jettyMinThreads(config.getJettyMinThreads())
|
||||
.jettyMaxThreads(config.getJettyMaxThreads())
|
||||
.jettyAcceptQueueSize(config.getJettyAcceptQueueSize())
|
||||
.jettyAcceptorPriorityDelta(
|
||||
config.getJettyAcceptorPriorityDelta())
|
||||
.jettyIdleTimeOut(config.getJettyIdleTimeOut()).build();
|
||||
|
||||
if (config.getPort() != 0) {
|
||||
jettyServerConfig.setHost(Strings.isBlank(config.getHost()) ? "0.0.0.0" : config.getHost());
|
||||
jettyServerConfig.setPort(config.getPort());
|
||||
jettyServerConfig.setContextPath(config.getContextPath());
|
||||
|
||||
jettyServer = new JettyServer(jettyServerConfig);
|
||||
jettyServer.initialize();
|
||||
|
||||
this.registerServiceImplementation(JettyHandlerRegister.class, new JettyHandlerRegisterImpl(jettyServer));
|
||||
|
|
@ -80,13 +94,17 @@ public class SharingServerModuleProvider extends ModuleProvider {
|
|||
|
||||
if (config.getGRPCPort() != 0) {
|
||||
if (config.isGRPCSslEnabled()) {
|
||||
grpcServer = new GRPCServer(Strings.isBlank(config.getGRPCHost()) ? "0.0.0.0" : config.getGRPCHost(),
|
||||
config.getGRPCPort(),
|
||||
Paths.get(config.getGRPCSslCertChainPath()).toFile(),
|
||||
Paths.get(config.getGRPCSslKeyPath()).toFile());
|
||||
grpcServer = new GRPCServer(
|
||||
Strings.isBlank(config.getGRPCHost()) ? "0.0.0.0" : config.getGRPCHost(),
|
||||
config.getGRPCPort(),
|
||||
Paths.get(config.getGRPCSslCertChainPath()).toFile(),
|
||||
Paths.get(config.getGRPCSslKeyPath()).toFile()
|
||||
);
|
||||
} else {
|
||||
grpcServer = new GRPCServer(Strings.isBlank(config.getGRPCHost()) ? "0.0.0.0" : config.getGRPCHost(),
|
||||
config.getGRPCPort());
|
||||
grpcServer = new GRPCServer(
|
||||
Strings.isBlank(config.getGRPCHost()) ? "0.0.0.0" : config.getGRPCHost(),
|
||||
config.getGRPCPort()
|
||||
);
|
||||
}
|
||||
if (config.getMaxMessageSize() > 0) {
|
||||
grpcServer.setMaxMessageSize(config.getMaxMessageSize());
|
||||
|
|
|
|||
|
|
@ -28,6 +28,11 @@ public class ZipkinReceiverConfig extends ModuleConfig {
|
|||
private String host;
|
||||
private int port;
|
||||
private String contextPath;
|
||||
private int jettyMinThreads = 1;
|
||||
private int jettyMaxThreads = 200;
|
||||
private long jettyIdleTimeOut = 30000;
|
||||
private int jettyAcceptorPriorityDelta = 0;
|
||||
private int jettyAcceptQueueSize = 0;
|
||||
private int expireTime = 20;
|
||||
private int maxCacheSize = 1_000_000;
|
||||
private boolean needAnalysis = false;
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ import org.apache.skywalking.oap.server.library.module.ModuleStartException;
|
|||
import org.apache.skywalking.oap.server.library.module.ServiceNotProvidedException;
|
||||
import org.apache.skywalking.oap.server.library.server.ServerException;
|
||||
import org.apache.skywalking.oap.server.library.server.jetty.JettyServer;
|
||||
import org.apache.skywalking.oap.server.library.server.jetty.JettyServerConfig;
|
||||
import org.apache.skywalking.oap.server.receiver.trace.module.TraceModule;
|
||||
import org.apache.skywalking.oap.server.receiver.trace.provider.parser.ISegmentParserService;
|
||||
import org.apache.skywalking.oap.server.receiver.zipkin.analysis.Receiver2AnalysisBridge;
|
||||
|
|
@ -64,7 +65,19 @@ public class ZipkinReceiverProvider extends ModuleProvider {
|
|||
|
||||
@Override
|
||||
public void start() throws ServiceNotProvidedException, ModuleStartException {
|
||||
jettyServer = new JettyServer(config.getHost(), config.getPort(), config.getContextPath());
|
||||
JettyServerConfig jettyServerConfig = JettyServerConfig.builder()
|
||||
.host(config.getHost())
|
||||
.port(config.getPort())
|
||||
.contextPath(config.getContextPath())
|
||||
.jettyIdleTimeOut(config.getJettyIdleTimeOut())
|
||||
.jettyAcceptorPriorityDelta(
|
||||
config.getJettyAcceptorPriorityDelta())
|
||||
.jettyMinThreads(config.getJettyMinThreads())
|
||||
.jettyMaxThreads(config.getJettyMaxThreads())
|
||||
.jettyAcceptQueueSize(config.getJettyAcceptQueueSize())
|
||||
.build();
|
||||
|
||||
jettyServer = new JettyServer(jettyServerConfig);
|
||||
jettyServer.initialize();
|
||||
|
||||
jettyServer.addHandler(new SpanV1JettyHandler(config, getManager()));
|
||||
|
|
|
|||
Loading…
Reference in New Issue