Search in sources :

Example 1 with ModuleListenerService

use of org.apache.skywalking.apm.collector.cluster.service.ModuleListenerService in project incubator-skywalking by apache.

the class AgentModuleJettyProvider method start.

@Override
public void start(Properties config) throws ServiceNotProvidedException {
    String host = config.getProperty(HOST);
    Integer port = (Integer) config.get(PORT);
    String contextPath = config.getProperty(CONTEXT_PATH);
    ModuleRegisterService moduleRegisterService = getManager().find(ClusterModule.NAME).getService(ModuleRegisterService.class);
    moduleRegisterService.register(AgentJettyModule.NAME, this.name(), new AgentModuleJettyRegistration(host, port, contextPath));
    AgentJettyNamingListener namingListener = new AgentJettyNamingListener();
    ModuleListenerService moduleListenerService = getManager().find(ClusterModule.NAME).getService(ModuleListenerService.class);
    moduleListenerService.addListener(namingListener);
    NamingHandlerRegisterService namingHandlerRegisterService = getManager().find(NamingModule.NAME).getService(NamingHandlerRegisterService.class);
    namingHandlerRegisterService.register(new AgentJettyNamingHandler(namingListener));
    JettyManagerService managerService = getManager().find(JettyManagerModule.NAME).getService(JettyManagerService.class);
    JettyServer jettyServer = managerService.createIfAbsent(host, port, contextPath);
    addHandlers(jettyServer);
}
Also used : NamingHandlerRegisterService(org.apache.skywalking.apm.collector.naming.service.NamingHandlerRegisterService) ModuleRegisterService(org.apache.skywalking.apm.collector.cluster.service.ModuleRegisterService) JettyServer(org.apache.skywalking.apm.collector.server.jetty.JettyServer) ModuleListenerService(org.apache.skywalking.apm.collector.cluster.service.ModuleListenerService) AgentJettyNamingListener(org.apache.skywalking.apm.collector.agent.jetty.provider.handler.naming.AgentJettyNamingListener) JettyManagerService(org.apache.skywalking.apm.collector.jetty.manager.service.JettyManagerService) AgentJettyNamingHandler(org.apache.skywalking.apm.collector.agent.jetty.provider.handler.naming.AgentJettyNamingHandler)

Example 2 with ModuleListenerService

use of org.apache.skywalking.apm.collector.cluster.service.ModuleListenerService in project incubator-skywalking by apache.

the class RemoteModuleGRPCProvider method start.

@Override
public void start(Properties config) throws ServiceNotProvidedException {
    String host = config.getProperty(HOST);
    Integer port = (Integer) config.get(PORT);
    GRPCManagerService managerService = getManager().find(GRPCManagerModule.NAME).getService(GRPCManagerService.class);
    GRPCServer gRPCServer = managerService.createIfAbsent(host, port);
    gRPCServer.addHandler(new RemoteCommonServiceHandler(remoteDataRegisterService));
    ModuleRegisterService moduleRegisterService = getManager().find(ClusterModule.NAME).getService(ModuleRegisterService.class);
    moduleRegisterService.register(RemoteModule.NAME, this.name(), new RemoteModuleGRPCRegistration(host, port));
    ModuleListenerService moduleListenerService = getManager().find(ClusterModule.NAME).getService(ModuleListenerService.class);
    moduleListenerService.addListener(remoteSenderService);
}
Also used : GRPCManagerService(org.apache.skywalking.apm.collector.grpc.manager.service.GRPCManagerService) GRPCServer(org.apache.skywalking.apm.collector.server.grpc.GRPCServer) ModuleRegisterService(org.apache.skywalking.apm.collector.cluster.service.ModuleRegisterService) ModuleListenerService(org.apache.skywalking.apm.collector.cluster.service.ModuleListenerService) RemoteCommonServiceHandler(org.apache.skywalking.apm.collector.remote.grpc.handler.RemoteCommonServiceHandler)

Example 3 with ModuleListenerService

use of org.apache.skywalking.apm.collector.cluster.service.ModuleListenerService in project incubator-skywalking by apache.

the class AgentModuleGRPCProvider method start.

@Override
public void start(Properties config) throws ServiceNotProvidedException {
    String host = config.getProperty(HOST);
    Integer port = (Integer) config.get(PORT);
    String sslCertChainFilePath = config.getProperty(SSL_CERT_CHAIN_FILEPATH);
    String sslPrivateKeyFilePath = config.getProperty(SSL_PRIVATE_KEY_FILE);
    AuthenticationSimpleChecker.INSTANCE.setExpectedToken(config.getProperty(AUTHENTICATION, ""));
    File sslCertChainFile = null;
    File sslPrivateKeyFile = null;
    if (StringUtil.isNotBlank(sslCertChainFilePath)) {
        sslCertChainFile = new File(sslCertChainFilePath);
        if (!(sslCertChainFile.exists() && sslCertChainFile.isFile())) {
            sslCertChainFile = null;
        }
    }
    if (StringUtil.isNotBlank(sslPrivateKeyFilePath)) {
        sslPrivateKeyFile = new File(sslPrivateKeyFilePath);
        if (!(sslPrivateKeyFile.exists() && sslPrivateKeyFile.isFile())) {
            sslPrivateKeyFile = null;
        }
    }
    ModuleRegisterService moduleRegisterService = getManager().find(ClusterModule.NAME).getService(ModuleRegisterService.class);
    moduleRegisterService.register(AgentGRPCModule.NAME, this.name(), new AgentModuleGRPCRegistration(host, port));
    AgentGRPCNamingListener namingListener = new AgentGRPCNamingListener();
    ModuleListenerService moduleListenerService = getManager().find(ClusterModule.NAME).getService(ModuleListenerService.class);
    moduleListenerService.addListener(namingListener);
    NamingHandlerRegisterService namingHandlerRegisterService = getManager().find(NamingModule.NAME).getService(NamingHandlerRegisterService.class);
    namingHandlerRegisterService.register(new AgentGRPCNamingHandler(namingListener));
    GRPCManagerService managerService = getManager().find(GRPCManagerModule.NAME).getService(GRPCManagerService.class);
    GRPCServer gRPCServer;
    if (sslCertChainFile != null && sslPrivateKeyFile != null) {
        gRPCServer = managerService.createIfAbsent(host, port, sslCertChainFile, sslPrivateKeyFile);
    } else {
        gRPCServer = managerService.createIfAbsent(host, port);
    }
    addHandlers(gRPCServer);
}
Also used : NamingHandlerRegisterService(org.apache.skywalking.apm.collector.naming.service.NamingHandlerRegisterService) GRPCManagerService(org.apache.skywalking.apm.collector.grpc.manager.service.GRPCManagerService) GRPCServer(org.apache.skywalking.apm.collector.server.grpc.GRPCServer) AgentGRPCNamingHandler(org.apache.skywalking.apm.collector.agent.grpc.provider.handler.naming.AgentGRPCNamingHandler) ModuleRegisterService(org.apache.skywalking.apm.collector.cluster.service.ModuleRegisterService) AgentGRPCNamingListener(org.apache.skywalking.apm.collector.agent.grpc.provider.handler.naming.AgentGRPCNamingListener) ModuleListenerService(org.apache.skywalking.apm.collector.cluster.service.ModuleListenerService) File(java.io.File)

Example 4 with ModuleListenerService

use of org.apache.skywalking.apm.collector.cluster.service.ModuleListenerService in project incubator-skywalking by apache.

the class UIModuleJettyProvider method start.

@Override
public void start(Properties config) throws ServiceNotProvidedException {
    String host = config.getProperty(HOST);
    Integer port = (Integer) config.get(PORT);
    String contextPath = config.getProperty(CONTEXT_PATH);
    ModuleRegisterService moduleRegisterService = getManager().find(ClusterModule.NAME).getService(ModuleRegisterService.class);
    moduleRegisterService.register(UIModule.NAME, this.name(), new UIModuleJettyRegistration(host, port, contextPath));
    UIJettyNamingListener namingListener = new UIJettyNamingListener();
    ModuleListenerService moduleListenerService = getManager().find(ClusterModule.NAME).getService(ModuleListenerService.class);
    moduleListenerService.addListener(namingListener);
    NamingHandlerRegisterService namingHandlerRegisterService = getManager().find(NamingModule.NAME).getService(NamingHandlerRegisterService.class);
    namingHandlerRegisterService.register(new UIJettyNamingHandler(namingListener));
    JettyManagerService managerService = getManager().find(JettyManagerModule.NAME).getService(JettyManagerService.class);
    JettyServer jettyServer = managerService.createIfAbsent(host, port, contextPath);
    addHandlers(jettyServer);
}
Also used : NamingHandlerRegisterService(org.apache.skywalking.apm.collector.naming.service.NamingHandlerRegisterService) UIJettyNamingHandler(org.apache.skywalking.apm.collector.ui.jetty.handler.naming.UIJettyNamingHandler) ModuleRegisterService(org.apache.skywalking.apm.collector.cluster.service.ModuleRegisterService) JettyServer(org.apache.skywalking.apm.collector.server.jetty.JettyServer) UIJettyNamingListener(org.apache.skywalking.apm.collector.ui.jetty.handler.naming.UIJettyNamingListener) ModuleListenerService(org.apache.skywalking.apm.collector.cluster.service.ModuleListenerService) JettyManagerService(org.apache.skywalking.apm.collector.jetty.manager.service.JettyManagerService)

Example 5 with ModuleListenerService

use of org.apache.skywalking.apm.collector.cluster.service.ModuleListenerService in project incubator-skywalking by apache.

the class StorageModuleEsProvider method start.

@Override
public void start(Properties config) throws ServiceNotProvidedException {
    Integer indexShardsNumber = (Integer) config.get(INDEX_SHARDS_NUMBER);
    Integer indexReplicasNumber = (Integer) config.get(INDEX_REPLICAS_NUMBER);
    try {
        String namespace = getManager().find(ConfigurationModule.NAME).getService(ICollectorConfig.class).getNamespace();
        elasticSearchClient.setNamespace(namespace);
        elasticSearchClient.initialize();
        ElasticSearchStorageInstaller installer = new ElasticSearchStorageInstaller(indexShardsNumber, indexReplicasNumber);
        installer.install(elasticSearchClient);
    } catch (ClientException | StorageException e) {
        logger.error(e.getMessage(), e);
    }
    String uuId = UUID.randomUUID().toString();
    ModuleRegisterService moduleRegisterService = getManager().find(ClusterModule.NAME).getService(ModuleRegisterService.class);
    moduleRegisterService.register(StorageModule.NAME, this.name(), new StorageModuleEsRegistration(uuId, 0));
    StorageModuleEsNamingListener namingListener = new StorageModuleEsNamingListener();
    ModuleListenerService moduleListenerService = getManager().find(ClusterModule.NAME).getService(ModuleListenerService.class);
    moduleListenerService.addListener(namingListener);
    Integer beforeDay = (Integer) config.getOrDefault(TIME_TO_LIVE_OF_DATA, 3);
    deleteTimer = new DataTTLKeeperTimer(getManager(), namingListener, uuId + 0, beforeDay);
}
Also used : ElasticSearchStorageInstaller(org.apache.skywalking.apm.collector.storage.es.base.define.ElasticSearchStorageInstaller) ModuleRegisterService(org.apache.skywalking.apm.collector.cluster.service.ModuleRegisterService) ModuleListenerService(org.apache.skywalking.apm.collector.cluster.service.ModuleListenerService) ClientException(org.apache.skywalking.apm.collector.client.ClientException) StorageException(org.apache.skywalking.apm.collector.storage.StorageException) ICollectorConfig(org.apache.skywalking.apm.collector.configuration.service.ICollectorConfig)

Aggregations

ModuleListenerService (org.apache.skywalking.apm.collector.cluster.service.ModuleListenerService)5 ModuleRegisterService (org.apache.skywalking.apm.collector.cluster.service.ModuleRegisterService)5 NamingHandlerRegisterService (org.apache.skywalking.apm.collector.naming.service.NamingHandlerRegisterService)3 GRPCManagerService (org.apache.skywalking.apm.collector.grpc.manager.service.GRPCManagerService)2 JettyManagerService (org.apache.skywalking.apm.collector.jetty.manager.service.JettyManagerService)2 GRPCServer (org.apache.skywalking.apm.collector.server.grpc.GRPCServer)2 JettyServer (org.apache.skywalking.apm.collector.server.jetty.JettyServer)2 File (java.io.File)1 AgentGRPCNamingHandler (org.apache.skywalking.apm.collector.agent.grpc.provider.handler.naming.AgentGRPCNamingHandler)1 AgentGRPCNamingListener (org.apache.skywalking.apm.collector.agent.grpc.provider.handler.naming.AgentGRPCNamingListener)1 AgentJettyNamingHandler (org.apache.skywalking.apm.collector.agent.jetty.provider.handler.naming.AgentJettyNamingHandler)1 AgentJettyNamingListener (org.apache.skywalking.apm.collector.agent.jetty.provider.handler.naming.AgentJettyNamingListener)1 ClientException (org.apache.skywalking.apm.collector.client.ClientException)1 ICollectorConfig (org.apache.skywalking.apm.collector.configuration.service.ICollectorConfig)1 RemoteCommonServiceHandler (org.apache.skywalking.apm.collector.remote.grpc.handler.RemoteCommonServiceHandler)1 StorageException (org.apache.skywalking.apm.collector.storage.StorageException)1 ElasticSearchStorageInstaller (org.apache.skywalking.apm.collector.storage.es.base.define.ElasticSearchStorageInstaller)1 UIJettyNamingHandler (org.apache.skywalking.apm.collector.ui.jetty.handler.naming.UIJettyNamingHandler)1 UIJettyNamingListener (org.apache.skywalking.apm.collector.ui.jetty.handler.naming.UIJettyNamingListener)1