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);
}
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);
}
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);
}
}
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);
}
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);
}
Aggregations