use of io.micrometer.core.instrument.binder.jetty.JettySslHandshakeMetrics in project zeppelin by apache.
the class ZeppelinServer method initServerConnector.
private static void initServerConnector(Server server, int port, int sslPort) {
ServerConnector connector;
HttpConfiguration httpConfig = new HttpConfiguration();
httpConfig.addCustomizer(new ForwardedRequestCustomizer());
httpConfig.setSendServerVersion(conf.sendJettyName());
httpConfig.setRequestHeaderSize(conf.getJettyRequestHeaderSize());
if (conf.useSsl()) {
LOG.debug("Enabling SSL for Zeppelin Server on port {}", sslPort);
httpConfig.setSecureScheme(HttpScheme.HTTPS.asString());
httpConfig.setSecurePort(sslPort);
HttpConfiguration httpsConfig = new HttpConfiguration(httpConfig);
httpsConfig.addCustomizer(new SecureRequestCustomizer());
SslConnectionFactory sslConnectionFactory = new SslConnectionFactory(getSslContextFactory(conf), HttpVersion.HTTP_1_1.asString());
HttpConnectionFactory httpsConnectionFactory = new HttpConnectionFactory(httpsConfig);
connector = new ServerConnector(server, sslConnectionFactory, httpsConnectionFactory);
connector.setPort(sslPort);
connector.addBean(new JettySslHandshakeMetrics(Metrics.globalRegistry, Tags.empty()));
} else {
HttpConnectionFactory httpConnectionFactory = new HttpConnectionFactory(httpConfig);
connector = new ServerConnector(server, httpConnectionFactory);
connector.setPort(port);
}
// Set some timeout options to make debugging easier.
int timeout = 1000 * 30;
connector.setIdleTimeout(timeout);
connector.setHost(conf.getServerAddress());
connector.addBean(new JettyConnectionMetrics(Metrics.globalRegistry, Tags.empty()));
server.addConnector(connector);
}
Aggregations