in oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/CoreModuleProvider.java [181:393]
public void prepare() throws ServiceNotProvidedException, ModuleStartException {
if (moduleConfig.isActiveExtraModelColumns()) {
DefaultScopeDefine.activeExtraModelColumns();
}
endpointNameGrouping = new EndpointNameGrouping();
final NamingControl namingControl = new NamingControl(
moduleConfig.getServiceNameMaxLength(),
moduleConfig.getInstanceNameMaxLength(),
moduleConfig.getEndpointNameMaxLength(),
endpointNameGrouping
);
this.registerServiceImplementation(NamingControl.class, namingControl);
this.registerServiceImplementation(EndpointNameGroupService.class, endpointNameGrouping);
MeterEntity.setNamingControl(namingControl);
try {
endpointNameGroupingRuleWatcher = new EndpointNameGroupingRuleWatcher(
this, endpointNameGrouping);
if (moduleConfig.isEnableEndpointNameGroupingByOpenapi()) {
endpointNameGroupingRule4OpenapiWatcher = new EndpointNameGroupingRule4OpenapiWatcher(
this, endpointNameGrouping);
}
} catch (FileNotFoundException e) {
throw new ModuleStartException(e.getMessage(), e);
}
AnnotationScan scopeScan = new AnnotationScan();
scopeScan.registerListener(new DefaultScopeDefine.Listener());
try {
scopeScan.scan();
} catch (Exception e) {
throw new ModuleStartException(e.getMessage(), e);
}
this.registerServiceImplementation(MeterSystem.class, new MeterSystem(getManager()));
AnnotationScan oalDisable = new AnnotationScan();
oalDisable.registerListener(DisableRegister.INSTANCE);
oalDisable.registerListener(new DisableRegister.SingleDisableScanListener());
try {
oalDisable.scan();
} catch (IOException | StorageException e) {
throw new ModuleStartException(e.getMessage(), e);
}
if (moduleConfig.isGRPCSslEnabled()) {
grpcServer = new GRPCServer(moduleConfig.getGRPCHost(), moduleConfig.getGRPCPort(),
moduleConfig.getGRPCSslCertChainPath(),
moduleConfig.getGRPCSslKeyPath(),
null
);
} else {
grpcServer = new GRPCServer(moduleConfig.getGRPCHost(), moduleConfig.getGRPCPort());
}
setBootingParameter("oap.internal.comm.host", moduleConfig.getGRPCHost());
setBootingParameter("oap.internal.comm.port", moduleConfig.getGRPCPort());
setBootingParameter("oap.external.grpc.host", moduleConfig.getGRPCHost());
setBootingParameter("oap.external.grpc.port", moduleConfig.getGRPCPort());
if (moduleConfig.getMaxConcurrentCallsPerConnection() > 0) {
grpcServer.setMaxConcurrentCallsPerConnection(moduleConfig.getMaxConcurrentCallsPerConnection());
}
if (moduleConfig.getMaxMessageSize() > 0) {
grpcServer.setMaxMessageSize(moduleConfig.getMaxMessageSize());
}
if (moduleConfig.getGRPCThreadPoolSize() > 0) {
grpcServer.setThreadPoolSize(moduleConfig.getGRPCThreadPoolSize());
}
grpcServer.initialize();
HTTPServerConfig httpServerConfig = HTTPServerConfig.builder()
.host(moduleConfig.getRestHost())
.port(moduleConfig.getRestPort())
.contextPath(moduleConfig.getRestContextPath())
.idleTimeOut(moduleConfig.getRestIdleTimeOut())
.maxThreads(moduleConfig.getRestMaxThreads())
.acceptQueueSize(
moduleConfig.getRestAcceptQueueSize())
.maxRequestHeaderSize(
moduleConfig.getHttpMaxRequestHeaderSize())
.build();
setBootingParameter("oap.external.http.host", moduleConfig.getRestHost());
setBootingParameter("oap.external.http.port", moduleConfig.getRestPort());
httpServer = new HTTPServer(httpServerConfig);
httpServer.initialize();
this.registerServiceImplementation(ConfigService.class, new ConfigService(moduleConfig, this));
this.registerServiceImplementation(ServerStatusService.class, new ServerStatusService(getManager(), moduleConfig));
this.registerServiceImplementation(HierarchyDefinitionService.class, new HierarchyDefinitionService(moduleConfig));
hierarchyService = new HierarchyService(getManager(), moduleConfig);
this.registerServiceImplementation(HierarchyService.class, hierarchyService);
this.registerServiceImplementation(
DownSamplingConfigService.class, new DownSamplingConfigService(moduleConfig.getDownsampling()));
this.registerServiceImplementation(GRPCHandlerRegister.class, new GRPCHandlerRegisterImpl(grpcServer));
this.registerServiceImplementation(HTTPHandlerRegister.class, new HTTPHandlerRegisterImpl(httpServer));
this.registerServiceImplementation(
IComponentLibraryCatalogService.class,
ComponentLibraryCatalogUtil.hold(new ComponentLibraryCatalogService())
);
this.registerServiceImplementation(SourceReceiver.class, receiver);
WorkerInstancesService instancesService = new WorkerInstancesService();
this.registerServiceImplementation(IWorkerInstanceGetter.class, instancesService);
this.registerServiceImplementation(IWorkerInstanceSetter.class, instancesService);
this.registerServiceImplementation(RemoteSenderService.class, new RemoteSenderService(getManager()));
this.registerServiceImplementation(ModelCreator.class, storageModels);
this.registerServiceImplementation(IModelManager.class, storageModels);
this.registerServiceImplementation(ModelManipulator.class, storageModels);
this.registerServiceImplementation(
NetworkAddressAliasCache.class, new NetworkAddressAliasCache(moduleConfig));
this.registerServiceImplementation(
TopologyQueryService.class, new TopologyQueryService(getManager(), storageModels));
this.registerServiceImplementation(MetricsMetadataQueryService.class, new MetricsMetadataQueryService());
this.registerServiceImplementation(MetricsQueryService.class, new MetricsQueryService(getManager()));
this.registerServiceImplementation(TraceQueryService.class, new TraceQueryService(getManager()));
this.registerServiceImplementation(BrowserLogQueryService.class, new BrowserLogQueryService(getManager()));
this.registerServiceImplementation(LogQueryService.class, new LogQueryService(getManager()));
this.registerServiceImplementation(MetadataQueryService.class, new MetadataQueryService(getManager(), moduleConfig));
this.registerServiceImplementation(AggregationQueryService.class, new AggregationQueryService(getManager()));
this.registerServiceImplementation(AlarmQueryService.class, new AlarmQueryService(getManager()));
this.registerServiceImplementation(TopNRecordsQueryService.class, new TopNRecordsQueryService(getManager()));
this.registerServiceImplementation(EventQueryService.class, new EventQueryService(getManager()));
this.registerServiceImplementation(
TagAutoCompleteQueryService.class, new TagAutoCompleteQueryService(getManager(), moduleConfig));
this.registerServiceImplementation(RecordQueryService.class, new RecordQueryService(getManager()));
this.registerServiceImplementation(HierarchyQueryService.class, new HierarchyQueryService(getManager(), moduleConfig));
this.registerServiceImplementation(
TTLStatusQuery.class, new TTLStatusQuery(
getManager(),
moduleConfig.getMetricsDataTTL(),
moduleConfig.getRecordDataTTL()
)
);
// add profile service implementations
this.registerServiceImplementation(
ProfileTaskMutationService.class, new ProfileTaskMutationService(getManager()));
this.registerServiceImplementation(
ProfileTaskQueryService.class, new ProfileTaskQueryService(getManager(), moduleConfig));
this.registerServiceImplementation(ProfileTaskCache.class, new ProfileTaskCache(getManager(), moduleConfig));
this.registerServiceImplementation(
AsyncProfilerMutationService.class, new AsyncProfilerMutationService(getManager()));
this.registerServiceImplementation(
AsyncProfilerQueryService.class, new AsyncProfilerQueryService(getManager()));
this.registerServiceImplementation(
AsyncProfilerTaskCache.class, new AsyncProfilerTaskCache(getManager(), moduleConfig));
this.registerServiceImplementation(
EBPFProfilingMutationService.class, new EBPFProfilingMutationService(getManager()));
this.registerServiceImplementation(
EBPFProfilingQueryService.class,
new EBPFProfilingQueryService(getManager(), moduleConfig, this.storageModels)
);
this.registerServiceImplementation(
ContinuousProfilingMutationService.class, new ContinuousProfilingMutationService(getManager()));
this.registerServiceImplementation(
ContinuousProfilingQueryService.class, new ContinuousProfilingQueryService(getManager()));
this.registerServiceImplementation(CommandService.class, new CommandService(getManager()));
// add oal engine loader service implementations
oalEngineLoaderService = new OALEngineLoaderService(getManager());
this.registerServiceImplementation(OALEngineLoaderService.class, oalEngineLoaderService);
annotationScan.registerListener(new StreamAnnotationListener(getManager()));
if (moduleConfig.isGRPCSslEnabled()) {
this.remoteClientManager = new RemoteClientManager(getManager(), moduleConfig.getRemoteTimeout(),
moduleConfig.getGRPCSslTrustedCAPath()
);
} else {
this.remoteClientManager = new RemoteClientManager(getManager(), moduleConfig.getRemoteTimeout());
}
this.registerServiceImplementation(RemoteClientManager.class, remoteClientManager);
// Management
this.registerServiceImplementation(
UITemplateManagementService.class, new UITemplateManagementService(getManager()));
this.registerServiceImplementation(
UIMenuManagementService.class, new UIMenuManagementService(getManager(), moduleConfig));
if (moduleConfig.getMetricsDataTTL() < 2) {
throw new ModuleStartException(
"Metric TTL should be at least 2 days, current value is " + moduleConfig.getMetricsDataTTL());
}
setBootingParameter("TTL.metrics", moduleConfig.getMetricsDataTTL());
if (moduleConfig.getRecordDataTTL() < 2) {
throw new ModuleStartException(
"Record TTL should be at least 2 days, current value is " + moduleConfig.getRecordDataTTL());
}
setBootingParameter("TTL.record", moduleConfig.getRecordDataTTL());
final MetricsStreamProcessor metricsStreamProcessor = MetricsStreamProcessor.getInstance();
metricsStreamProcessor.setL1FlushPeriod(moduleConfig.getL1FlushPeriod());
metricsStreamProcessor.setStorageSessionTimeout(moduleConfig.getStorageSessionTimeout());
metricsStreamProcessor.setMetricsDataTTL(moduleConfig.getMetricsDataTTL());
RecordStreamProcessor.getInstance().setRecordDataTTL(moduleConfig.getRecordDataTTL());
TopNStreamProcessor.getInstance().setTopNWorkerReportCycle(moduleConfig.getTopNReportPeriod());
apdexThresholdConfig = new ApdexThresholdConfig(this);
ApdexMetrics.setDICT(apdexThresholdConfig);
loggingConfigWatcher = new LoggingConfigWatcher(this);
WatermarkGRPCInterceptor.create();
this.watermarkWatcher = new WatermarkWatcher(getManager(),
moduleConfig.getMaxHeapMemoryUsagePercent(),
moduleConfig.getMaxDirectMemoryUsage());
}