Search in sources :

Example 1 with RemoteServiceHandler

use of org.apache.skywalking.oap.server.core.remote.RemoteServiceHandler in project incubator-skywalking by apache.

the class GRPCRemoteClientRealServer method main.

public static void main(String[] args) throws ServerException, InterruptedException {
    ModuleManagerTesting moduleManager = new ModuleManagerTesting();
    ModuleDefineTesting moduleDefine = new ModuleDefineTesting();
    moduleManager.put(CoreModule.NAME, moduleDefine);
    GRPCServer server = new GRPCServer("localhost", 10000);
    server.initialize();
    server.addHandler(new RemoteServiceHandler(moduleManager));
    server.start();
    TimeUnit.MINUTES.sleep(10);
}
Also used : GRPCServer(org.apache.skywalking.oap.server.library.server.grpc.GRPCServer) RemoteServiceHandler(org.apache.skywalking.oap.server.core.remote.RemoteServiceHandler) ModuleManagerTesting(org.apache.skywalking.oap.server.testing.module.ModuleManagerTesting) ModuleDefineTesting(org.apache.skywalking.oap.server.testing.module.ModuleDefineTesting)

Example 2 with RemoteServiceHandler

use of org.apache.skywalking.oap.server.core.remote.RemoteServiceHandler in project incubator-skywalking by apache.

the class GRPCRemoteClientTestCase method testPush.

@Test
public void testPush() throws InterruptedException {
    MetricsCreator metricsCreator = mock(MetricsCreator.class);
    when(metricsCreator.createCounter(any(), any(), any(), any())).thenReturn(new CounterMetrics() {

        @Override
        public void inc() {
        }

        @Override
        public void inc(double value) {
        }
    });
    when(metricsCreator.createHistogramMetric(any(), any(), any(), any())).thenReturn(new HistogramMetrics() {

        @Override
        public Timer createTimer() {
            return super.createTimer();
        }

        @Override
        public void observe(double value) {
        }
    });
    ModuleDefineTesting telemetryModuleDefine = new ModuleDefineTesting();
    moduleManager.put(TelemetryModule.NAME, telemetryModuleDefine);
    telemetryModuleDefine.provider().registerServiceImplementation(MetricsCreator.class, metricsCreator);
    grpcServerRule.getServiceRegistry().addService(new RemoteServiceHandler(moduleManager));
    Address address = new Address("not-important", 11, false);
    GRPCRemoteClient remoteClient = spy(new GRPCRemoteClient(moduleManager, address, 1, 10, 10, null));
    remoteClient.connect();
    doReturn(grpcServerRule.getChannel()).when(remoteClient).getChannel();
    for (int i = 0; i < 12; i++) {
        remoteClient.push(nextWorkerName, new TestStreamData());
    }
    TimeUnit.SECONDS.sleep(2);
}
Also used : RemoteServiceHandler(org.apache.skywalking.oap.server.core.remote.RemoteServiceHandler) CounterMetrics(org.apache.skywalking.oap.server.telemetry.api.CounterMetrics) MetricsCreator(org.apache.skywalking.oap.server.telemetry.api.MetricsCreator) HistogramMetrics(org.apache.skywalking.oap.server.telemetry.api.HistogramMetrics) ModuleDefineTesting(org.apache.skywalking.oap.server.testing.module.ModuleDefineTesting) Test(org.junit.Test)

Example 3 with RemoteServiceHandler

use of org.apache.skywalking.oap.server.core.remote.RemoteServiceHandler in project skywalking by apache.

the class CoreModuleProvider method start.

@Override
public void start() throws ModuleStartException {
    grpcServer.addHandler(new RemoteServiceHandler(getManager()));
    grpcServer.addHandler(new HealthCheckServiceHandler());
    remoteClientManager.start();
    // Disable OAL script has higher priority
    oalEngineLoaderService.load(DisableOALDefine.INSTANCE);
    try {
        receiver.scan();
        annotationScan.scan();
    } catch (IOException | IllegalAccessException | InstantiationException | StorageException e) {
        throw new ModuleStartException(e.getMessage(), e);
    }
    Address gRPCServerInstanceAddress = new Address(moduleConfig.getGRPCHost(), moduleConfig.getGRPCPort(), true);
    TelemetryRelatedContext.INSTANCE.setId(gRPCServerInstanceAddress.toString());
    if (CoreModuleConfig.Role.Mixed.name().equalsIgnoreCase(moduleConfig.getRole()) || CoreModuleConfig.Role.Aggregator.name().equalsIgnoreCase(moduleConfig.getRole())) {
        RemoteInstance gRPCServerInstance = new RemoteInstance(gRPCServerInstanceAddress);
        this.getManager().find(ClusterModule.NAME).provider().getService(ClusterRegister.class).registerRemote(gRPCServerInstance);
    }
    OAPNodeChecker.setROLE(CoreModuleConfig.Role.fromName(moduleConfig.getRole()));
    DynamicConfigurationService dynamicConfigurationService = getManager().find(ConfigurationModule.NAME).provider().getService(DynamicConfigurationService.class);
    dynamicConfigurationService.registerConfigChangeWatcher(apdexThresholdConfig);
    dynamicConfigurationService.registerConfigChangeWatcher(endpointNameGroupingRuleWatcher);
    dynamicConfigurationService.registerConfigChangeWatcher(loggingConfigWatcher);
    if (moduleConfig.isEnableEndpointNameGroupingByOpenapi()) {
        dynamicConfigurationService.registerConfigChangeWatcher(endpointNameGroupingRule4OpenapiWatcher);
    }
}
Also used : DynamicConfigurationService(org.apache.skywalking.oap.server.configuration.api.DynamicConfigurationService) Address(org.apache.skywalking.oap.server.core.remote.client.Address) RemoteServiceHandler(org.apache.skywalking.oap.server.core.remote.RemoteServiceHandler) HealthCheckServiceHandler(org.apache.skywalking.oap.server.core.remote.health.HealthCheckServiceHandler) ModuleStartException(org.apache.skywalking.oap.server.library.module.ModuleStartException) RemoteInstance(org.apache.skywalking.oap.server.core.cluster.RemoteInstance) ClusterRegister(org.apache.skywalking.oap.server.core.cluster.ClusterRegister) IOException(java.io.IOException) StorageException(org.apache.skywalking.oap.server.core.storage.StorageException)

Example 4 with RemoteServiceHandler

use of org.apache.skywalking.oap.server.core.remote.RemoteServiceHandler in project skywalking by apache.

the class GRPCRemoteClientTestCase method testPush.

@Test
public void testPush() throws InterruptedException {
    MetricsCreator metricsCreator = mock(MetricsCreator.class);
    when(metricsCreator.createCounter(any(), any(), any(), any())).thenReturn(new CounterMetrics() {

        @Override
        public void inc() {
        }

        @Override
        public void inc(double value) {
        }
    });
    when(metricsCreator.createHistogramMetric(any(), any(), any(), any())).thenReturn(new HistogramMetrics() {

        @Override
        public Timer createTimer() {
            return super.createTimer();
        }

        @Override
        public void observe(double value) {
        }
    });
    ModuleDefineTesting telemetryModuleDefine = new ModuleDefineTesting();
    moduleManager.put(TelemetryModule.NAME, telemetryModuleDefine);
    telemetryModuleDefine.provider().registerServiceImplementation(MetricsCreator.class, metricsCreator);
    grpcServerRule.getServiceRegistry().addService(new RemoteServiceHandler(moduleManager));
    Address address = new Address("not-important", 11, false);
    GRPCRemoteClient remoteClient = spy(new GRPCRemoteClient(moduleManager, address, 1, 10, 10, null));
    remoteClient.connect();
    doReturn(grpcServerRule.getChannel()).when(remoteClient).getChannel();
    for (int i = 0; i < 12; i++) {
        remoteClient.push(nextWorkerName, new TestStreamData());
    }
    TimeUnit.SECONDS.sleep(2);
}
Also used : RemoteServiceHandler(org.apache.skywalking.oap.server.core.remote.RemoteServiceHandler) CounterMetrics(org.apache.skywalking.oap.server.telemetry.api.CounterMetrics) MetricsCreator(org.apache.skywalking.oap.server.telemetry.api.MetricsCreator) HistogramMetrics(org.apache.skywalking.oap.server.telemetry.api.HistogramMetrics) ModuleDefineTesting(org.apache.skywalking.oap.server.testing.module.ModuleDefineTesting) Test(org.junit.Test)

Example 5 with RemoteServiceHandler

use of org.apache.skywalking.oap.server.core.remote.RemoteServiceHandler in project skywalking by apache.

the class GRPCRemoteClientRealServer method main.

public static void main(String[] args) throws ServerException, InterruptedException {
    ModuleManagerTesting moduleManager = new ModuleManagerTesting();
    ModuleDefineTesting moduleDefine = new ModuleDefineTesting();
    moduleManager.put(CoreModule.NAME, moduleDefine);
    GRPCServer server = new GRPCServer("localhost", 10000);
    server.initialize();
    server.addHandler(new RemoteServiceHandler(moduleManager));
    server.start();
    TimeUnit.MINUTES.sleep(10);
}
Also used : GRPCServer(org.apache.skywalking.oap.server.library.server.grpc.GRPCServer) RemoteServiceHandler(org.apache.skywalking.oap.server.core.remote.RemoteServiceHandler) ModuleManagerTesting(org.apache.skywalking.oap.server.testing.module.ModuleManagerTesting) ModuleDefineTesting(org.apache.skywalking.oap.server.testing.module.ModuleDefineTesting)

Aggregations

RemoteServiceHandler (org.apache.skywalking.oap.server.core.remote.RemoteServiceHandler)6 ModuleDefineTesting (org.apache.skywalking.oap.server.testing.module.ModuleDefineTesting)4 IOException (java.io.IOException)2 DynamicConfigurationService (org.apache.skywalking.oap.server.configuration.api.DynamicConfigurationService)2 ClusterRegister (org.apache.skywalking.oap.server.core.cluster.ClusterRegister)2 RemoteInstance (org.apache.skywalking.oap.server.core.cluster.RemoteInstance)2 Address (org.apache.skywalking.oap.server.core.remote.client.Address)2 HealthCheckServiceHandler (org.apache.skywalking.oap.server.core.remote.health.HealthCheckServiceHandler)2 StorageException (org.apache.skywalking.oap.server.core.storage.StorageException)2 ModuleStartException (org.apache.skywalking.oap.server.library.module.ModuleStartException)2 GRPCServer (org.apache.skywalking.oap.server.library.server.grpc.GRPCServer)2 CounterMetrics (org.apache.skywalking.oap.server.telemetry.api.CounterMetrics)2 HistogramMetrics (org.apache.skywalking.oap.server.telemetry.api.HistogramMetrics)2 MetricsCreator (org.apache.skywalking.oap.server.telemetry.api.MetricsCreator)2 ModuleManagerTesting (org.apache.skywalking.oap.server.testing.module.ModuleManagerTesting)2 Test (org.junit.Test)2