use of com.facebook.airlift.tracetoken.TraceTokenModule in project presto by prestodb.
the class PrestoProxy method start.
public static void start(Module... extraModules) {
Bootstrap app = new Bootstrap(ImmutableList.<Module>builder().add(new NodeModule()).add(new HttpServerModule()).add(new JsonModule()).add(new JaxrsModule(true)).add(new MBeanModule()).add(new JmxModule()).add(new LogJmxModule()).add(new TraceTokenModule()).add(new EventModule()).add(new ProxyModule()).add(extraModules).build());
Logger log = Logger.get(PrestoProxy.class);
try {
app.initialize();
log.info("======== SERVER STARTED ========");
} catch (Throwable t) {
log.error(t);
System.exit(1);
}
}
use of com.facebook.airlift.tracetoken.TraceTokenModule in project presto by prestodb.
the class TestHeartbeatFailureDetector method testExcludesCurrentNode.
@Test
public void testExcludesCurrentNode() throws Exception {
Bootstrap app = new Bootstrap(new TestingNodeModule(), new TestingJmxModule(), new TestingDiscoveryModule(), new TestingHttpServerModule(), new TraceTokenModule(), new JsonModule(), new JaxrsModule(true), new FailureDetectorModule(), new Module() {
@Override
public void configure(Binder binder) {
configBinder(binder).bindConfig(InternalCommunicationConfig.class);
configBinder(binder).bindConfig(QueryManagerConfig.class);
discoveryBinder(binder).bindSelector("presto");
discoveryBinder(binder).bindHttpAnnouncement("presto");
// Jersey with jetty 9 requires at least one resource
// todo add a dummy resource to airlift jaxrs in this case
jaxrsBinder(binder).bind(FooResource.class);
}
});
Injector injector = app.doNotInitializeLogging().quiet().initialize();
ServiceSelector selector = injector.getInstance(Key.get(ServiceSelector.class, serviceType("presto")));
assertEquals(selector.selectAllServices().size(), 1);
HeartbeatFailureDetector detector = injector.getInstance(HeartbeatFailureDetector.class);
detector.updateMonitoredServices();
assertEquals(detector.getTotalCount(), 0);
assertEquals(detector.getActiveCount(), 0);
assertEquals(detector.getFailedCount(), 0);
assertTrue(detector.getFailed().isEmpty());
}
use of com.facebook.airlift.tracetoken.TraceTokenModule in project presto by prestodb.
the class PrestoServer method run.
@Override
public void run() {
verifyJvmRequirements();
verifySystemTimeIsReasonable();
Logger log = Logger.get(PrestoServer.class);
ImmutableList.Builder<Module> modules = ImmutableList.builder();
modules.add(new NodeModule(), new DiscoveryModule(), new HttpServerModule(), new JsonModule(), installModuleIf(FeaturesConfig.class, FeaturesConfig::isJsonSerdeCodeGenerationEnabled, binder -> jsonBinder(binder).addModuleBinding().to(AfterburnerModule.class)), new SmileModule(), new JaxrsModule(true), new MBeanModule(), new JmxModule(), new JmxHttpModule(), new LogJmxModule(), new TraceTokenModule(), new JsonEventModule(), new HttpEventModule(), new ServerSecurityModule(), new AccessControlModule(), new EventListenerModule(), new ServerMainModule(sqlParserOptions), new GracefulShutdownModule(), new WarningCollectorModule(), new TempStorageModule(), new QueryPrerequisitesManagerModule(), new NodeTtlFetcherManagerModule(), new ClusterTtlProviderManagerModule());
modules.addAll(getAdditionalModules());
Bootstrap app = new Bootstrap(modules.build());
try {
Injector injector = app.initialize();
injector.getInstance(PluginManager.class).loadPlugins();
ServerConfig serverConfig = injector.getInstance(ServerConfig.class);
if (!serverConfig.isResourceManager()) {
injector.getInstance(StaticCatalogStore.class).loadCatalogs();
}
// TODO: remove this huge hack
updateConnectorIds(injector.getInstance(Announcer.class), injector.getInstance(CatalogManager.class), injector.getInstance(ServerConfig.class), injector.getInstance(NodeSchedulerConfig.class));
// TODO: thrift server port should be announced by discovery server similar to http/https ports
updateThriftServerPort(injector.getInstance(Announcer.class), injector.getInstance(DriftServer.class));
injector.getInstance(StaticFunctionNamespaceStore.class).loadFunctionNamespaceManagers();
injector.getInstance(SessionPropertyDefaults.class).loadConfigurationManager();
injector.getInstance(ResourceGroupManager.class).loadConfigurationManager();
if (!serverConfig.isResourceManager()) {
injector.getInstance(AccessControlManager.class).loadSystemAccessControl();
}
injector.getInstance(PasswordAuthenticatorManager.class).loadPasswordAuthenticator();
injector.getInstance(EventListenerManager.class).loadConfiguredEventListener();
injector.getInstance(TempStorageManager.class).loadTempStorages();
injector.getInstance(QueryPrerequisitesManager.class).loadQueryPrerequisites();
injector.getInstance(NodeTtlFetcherManager.class).loadNodeTtlFetcher();
injector.getInstance(ClusterTtlProviderManager.class).loadClusterTtlProvider();
injector.getInstance(Announcer.class).start();
log.info("======== SERVER STARTED ========");
} catch (Throwable e) {
log.error(e);
System.exit(1);
}
}
Aggregations