Search in sources :

Example 6 with MBeanServerModule

use of io.trino.plugin.base.jmx.MBeanServerModule in project trino by trinodb.

the class JmxConnectorFactory method create.

@Override
public Connector create(String catalogName, Map<String, String> config, ConnectorContext context) {
    Bootstrap app = new Bootstrap(new MBeanServerModule(), binder -> {
        configBinder(binder).bindConfig(JmxConnectorConfig.class);
        binder.bind(NodeManager.class).toInstance(context.getNodeManager());
        binder.bind(JmxConnector.class).in(Scopes.SINGLETON);
        binder.bind(JmxHistoricalData.class).in(Scopes.SINGLETON);
        binder.bind(JmxMetadata.class).in(Scopes.SINGLETON);
        binder.bind(JmxSplitManager.class).in(Scopes.SINGLETON);
        binder.bind(JmxPeriodicSampler.class).in(Scopes.SINGLETON);
        binder.bind(JmxRecordSetProvider.class).in(Scopes.SINGLETON);
    });
    Injector injector = app.doNotInitializeLogging().setRequiredConfigurationProperties(config).initialize();
    return injector.getInstance(JmxConnector.class);
}
Also used : NodeManager(io.trino.spi.NodeManager) MBeanServerModule(io.trino.plugin.base.jmx.MBeanServerModule) Injector(com.google.inject.Injector) Bootstrap(io.airlift.bootstrap.Bootstrap)

Example 7 with MBeanServerModule

use of io.trino.plugin.base.jmx.MBeanServerModule in project trino by trinodb.

the class DbResourceGroupConfigurationManagerFactory method create.

@Override
public ResourceGroupConfigurationManager<?> create(Map<String, String> config, ResourceGroupConfigurationManagerContext context) {
    config = replaceEnvironmentVariables(config);
    FlywayMigration.migrate(new ConfigurationFactory(config).build(DbResourceGroupConfig.class));
    Bootstrap app = new Bootstrap(new MBeanModule(), new MBeanServerModule(), new JsonModule(), new DbResourceGroupsModule(), new PrefixObjectNameGeneratorModule("io.trino.plugin.resourcegroups.db", "trino.plugin.resourcegroups.db"), binder -> binder.bind(String.class).annotatedWith(ForEnvironment.class).toInstance(context.getEnvironment()), binder -> binder.bind(ClusterMemoryPoolManager.class).toInstance(context.getMemoryPoolManager()));
    Injector injector = app.doNotInitializeLogging().setRequiredConfigurationProperties(config).initialize();
    return injector.getInstance(DbResourceGroupConfigurationManager.class);
}
Also used : MBeanModule(org.weakref.jmx.guice.MBeanModule) MBeanServerModule(io.trino.plugin.base.jmx.MBeanServerModule) Injector(com.google.inject.Injector) ConfigurationFactory(io.airlift.configuration.ConfigurationFactory) Bootstrap(io.airlift.bootstrap.Bootstrap) JsonModule(io.airlift.json.JsonModule) PrefixObjectNameGeneratorModule(io.trino.plugin.base.jmx.PrefixObjectNameGeneratorModule)

Example 8 with MBeanServerModule

use of io.trino.plugin.base.jmx.MBeanServerModule in project trino by trinodb.

the class JdbcDiagnosticModule method configure.

@Override
public void configure(Binder binder) {
    binder.install(new MBeanServerModule());
    binder.install(new MBeanModule());
    Provider<CatalogName> catalogName = binder.getProvider(CatalogName.class);
    newExporter(binder).export(Key.get(JdbcClient.class, StatsCollecting.class)).as(generator -> generator.generatedNameOf(JdbcClient.class, catalogName.get().toString()));
    newExporter(binder).export(Key.get(ConnectionFactory.class, StatsCollecting.class)).as(generator -> generator.generatedNameOf(ConnectionFactory.class, catalogName.get().toString()));
    newExporter(binder).export(JdbcClient.class).as(generator -> generator.generatedNameOf(CachingJdbcClient.class, catalogName.get().toString()));
}
Also used : MBeanModule(org.weakref.jmx.guice.MBeanModule) StatisticsAwareConnectionFactory(io.trino.plugin.jdbc.jmx.StatisticsAwareConnectionFactory) MBeanServerModule(io.trino.plugin.base.jmx.MBeanServerModule) CatalogName(io.trino.plugin.base.CatalogName) StatisticsAwareJdbcClient(io.trino.plugin.jdbc.jmx.StatisticsAwareJdbcClient)

Example 9 with MBeanServerModule

use of io.trino.plugin.base.jmx.MBeanServerModule in project trino by trinodb.

the class ElasticsearchConnectorFactory method create.

@Override
public Connector create(String catalogName, Map<String, String> config, ConnectorContext context) {
    requireNonNull(catalogName, "catalogName is null");
    requireNonNull(config, "config is null");
    Bootstrap app = new Bootstrap(new MBeanModule(), new MBeanServerModule(), new ConnectorObjectNameGeneratorModule(catalogName, "io.trino.plugin.elasticsearch", "trino.plugin.elasticsearch"), new JsonModule(), new TypeDeserializerModule(context.getTypeManager()), new ElasticsearchConnectorModule(), binder -> {
        binder.bind(NodeManager.class).toInstance(context.getNodeManager());
    });
    Injector injector = app.doNotInitializeLogging().setRequiredConfigurationProperties(config).initialize();
    return injector.getInstance(ElasticsearchConnector.class);
}
Also used : MBeanModule(org.weakref.jmx.guice.MBeanModule) NodeManager(io.trino.spi.NodeManager) MBeanServerModule(io.trino.plugin.base.jmx.MBeanServerModule) Injector(com.google.inject.Injector) Bootstrap(io.airlift.bootstrap.Bootstrap) ConnectorObjectNameGeneratorModule(io.trino.plugin.base.jmx.ConnectorObjectNameGeneratorModule) JsonModule(io.airlift.json.JsonModule) TypeDeserializerModule(io.trino.plugin.base.TypeDeserializerModule)

Example 10 with MBeanServerModule

use of io.trino.plugin.base.jmx.MBeanServerModule in project trino by trinodb.

the class ThriftConnectorFactory method create.

@Override
public Connector create(String catalogName, Map<String, String> config, ConnectorContext context) {
    Bootstrap app = new Bootstrap(new MBeanModule(), new MBeanServerModule(), new ConnectorObjectNameGeneratorModule(catalogName, "io.trino.plugin.thrift", "trino.plugin.thrift"), new DriftNettyClientModule(), binder -> {
        binder.bind(TypeManager.class).toInstance(context.getTypeManager());
    }, locationModule, new ThriftModule());
    Injector injector = app.doNotInitializeLogging().setRequiredConfigurationProperties(config).initialize();
    return injector.getInstance(ThriftConnector.class);
}
Also used : MBeanModule(org.weakref.jmx.guice.MBeanModule) MBeanServerModule(io.trino.plugin.base.jmx.MBeanServerModule) DriftNettyClientModule(io.airlift.drift.transport.netty.client.DriftNettyClientModule) Injector(com.google.inject.Injector) Bootstrap(io.airlift.bootstrap.Bootstrap) TypeManager(io.trino.spi.type.TypeManager) ConnectorObjectNameGeneratorModule(io.trino.plugin.base.jmx.ConnectorObjectNameGeneratorModule)

Aggregations

MBeanServerModule (io.trino.plugin.base.jmx.MBeanServerModule)11 Injector (com.google.inject.Injector)10 Bootstrap (io.airlift.bootstrap.Bootstrap)10 MBeanModule (org.weakref.jmx.guice.MBeanModule)10 JsonModule (io.airlift.json.JsonModule)8 NodeManager (io.trino.spi.NodeManager)6 ConnectorObjectNameGeneratorModule (io.trino.plugin.base.jmx.ConnectorObjectNameGeneratorModule)5 TypeManager (io.trino.spi.type.TypeManager)4 Key (com.google.inject.Key)3 Module (com.google.inject.Module)3 TypeLiteral (com.google.inject.TypeLiteral)3 LifeCycleManager (io.airlift.bootstrap.LifeCycleManager)3 EventModule (io.airlift.event.client.EventModule)3 CatalogName (io.trino.plugin.base.CatalogName)3 CatalogNameModule (io.trino.plugin.base.CatalogNameModule)3 ClassLoaderSafeConnectorPageSinkProvider (io.trino.plugin.base.classloader.ClassLoaderSafeConnectorPageSinkProvider)3 ClassLoaderSafeConnectorPageSourceProvider (io.trino.plugin.base.classloader.ClassLoaderSafeConnectorPageSourceProvider)3 ClassLoaderSafeConnectorSplitManager (io.trino.plugin.base.classloader.ClassLoaderSafeConnectorSplitManager)3 ClassLoaderSafeNodePartitioningProvider (io.trino.plugin.base.classloader.ClassLoaderSafeNodePartitioningProvider)3 SessionPropertiesProvider (io.trino.plugin.base.session.SessionPropertiesProvider)3