use of com.hotels.styx.startup.StyxServerComponents in project styx by ExpediaGroup.
the class StyxServerTest method disablesResourceLeakDetectionByDefault.
@Test
public void disablesResourceLeakDetectionByDefault() {
StyxServerComponents config = new StyxServerComponents.Builder().registry(new MicrometerRegistry(new CompositeMeterRegistry())).configuration(EMPTY_CONFIGURATION).additionalServices(Map.of("backendServiceRegistry", new RegistryServiceAdapter(new MemoryBackedRegistry<>()))).build();
new StyxServer(config);
assertThat(ResourceLeakDetector.getLevel(), is(DISABLED));
}
use of com.hotels.styx.startup.StyxServerComponents in project styx by ExpediaGroup.
the class StyxServer method createStyxServer.
private static StyxServer createStyxServer(String[] args) {
Stopwatch stopwatch = new Stopwatch();
StartupConfig startupConfig = parseStartupConfig(args);
LOG.info("Styx home={}", startupConfig.styxHome());
LOG.info("Styx configFileLocation={}", startupConfig.configFileLocation());
LOG.info("Styx logConfigLocation={}", startupConfig.logConfigLocation());
PrometheusMeterRegistry prometheusRegistry = new PrometheusMeterRegistry(PrometheusConfig.DEFAULT);
CompositeMeterRegistry compositeMeterRegistry = new CompositeMeterRegistry();
compositeMeterRegistry.add(prometheusRegistry);
StyxServerComponents components = new StyxServerComponents.Builder().registry(new MicrometerRegistry(compositeMeterRegistry)).styxConfig(parseConfiguration(startupConfig)).startupConfig(startupConfig).loggingSetUp(environment -> activateLogbackConfigurer(startupConfig)).showBanner(true).build();
return new StyxServer(components, stopwatch);
}
use of com.hotels.styx.startup.StyxServerComponents in project styx by ExpediaGroup.
the class StyxServer method httpServer.
private InetServer httpServer(StyxServerComponents components, ConnectorConfig connectorConfig, HttpHandler styxDataPlane) {
Environment environment = components.environment();
CharSequence styxInfoHeaderName = environment.configuration().styxHeaderConfig().styxInfoHeaderName();
ResponseInfoFormat responseInfoFormat = new ResponseInfoFormat(environment);
ServerConnector proxyConnector = new ProxyConnectorFactory(environment.configuration().proxyServerConfig(), environment.centralisedMetrics(), environment.errorListener(), environment.configuration().get(ENCODE_UNWISECHARS).orElse(""), (builder, request) -> builder.header(styxInfoHeaderName, responseInfoFormat.format(request)), environment.configuration().get("requestTracking", Boolean.class).orElse(false), environment.httpMessageFormatter(), environment.configuration().styxHeaderConfig().originIdHeaderName()).create(connectorConfig);
return NettyServerBuilder.newBuilder().setMetricsRegistry(environment.metricRegistry()).bossExecutor(proxyBossExecutor).workerExecutor(proxyWorkerExecutor).setProtocolConnector(proxyConnector).handler(styxDataPlane).build();
}
Aggregations