int Server::AddBuiltinServices()

in src/brpc/server.cpp [485:592]


int Server::AddBuiltinServices() {
    // Firstly add services shown in tabs.
    if (AddBuiltinService(new (std::nothrow) StatusService)) {
        LOG(ERROR) << "Fail to add StatusService";
        return -1;
    }
    if (AddBuiltinService(new (std::nothrow) VarsService)) {
        LOG(ERROR) << "Fail to add VarsService";
        return -1;
    }
    if (AddBuiltinService(new (std::nothrow) ConnectionsService)) {
        LOG(ERROR) << "Fail to add ConnectionsService";
        return -1;
    }
    if (AddBuiltinService(new (std::nothrow) FlagsService)) {
        LOG(ERROR) << "Fail to add FlagsService";
        return -1;
    }
    if (AddBuiltinService(new (std::nothrow) RpczService)) {
        LOG(ERROR) << "Fail to add RpczService";
        return -1;
    }
    if (AddBuiltinService(new (std::nothrow) HotspotsService)) {
        LOG(ERROR) << "Fail to add HotspotsService";
        return -1;
    }
    if (AddBuiltinService(new (std::nothrow) IndexService)) {
        LOG(ERROR) << "Fail to add IndexService";
        return -1;
    }

    // Add other services.
    if (AddBuiltinService(new (std::nothrow) VersionService(this))) {
        LOG(ERROR) << "Fail to add VersionService";
        return -1;
    }
    if (AddBuiltinService(new (std::nothrow) HealthService)) {
        LOG(ERROR) << "Fail to add HealthService";
        return -1;
    }
    if (AddBuiltinService(new (std::nothrow) ProtobufsService(this))) {
        LOG(ERROR) << "Fail to add ProtobufsService";
        return -1;
    }
    if (AddBuiltinService(new (std::nothrow) BadMethodService)) {
        LOG(ERROR) << "Fail to add BadMethodService";
        return -1;
    }
    if (AddBuiltinService(new (std::nothrow) ListService(this))) {
        LOG(ERROR) << "Fail to add ListService";
        return -1;
    }
    if (AddBuiltinService(new (std::nothrow) PrometheusMetricsService)) {
        LOG(ERROR) << "Fail to add MetricsService";
        return -1;
    }
    if (FLAGS_enable_threads_service &&
        AddBuiltinService(new (std::nothrow) ThreadsService)) {
        LOG(ERROR) << "Fail to add ThreadsService";
        return -1;
    }
    if (AddBuiltinService(new (std::nothrow) MemoryService)) {
        LOG(ERROR) << "Fail to add MemoryService";
        return -1;
    }

#if !BRPC_WITH_GLOG
    if (AddBuiltinService(new (std::nothrow) VLogService)) {
        LOG(ERROR) << "Fail to add VLogService";
        return -1;
    }
#endif

    if (AddBuiltinService(new (std::nothrow) PProfService)) {
        LOG(ERROR) << "Fail to add PProfService";
        return -1;
    }
    if (FLAGS_enable_dir_service &&
        AddBuiltinService(new (std::nothrow) DirService)) {
        LOG(ERROR) << "Fail to add DirService";
        return -1;
    }
    if (AddBuiltinService(new (std::nothrow) BthreadsService)) {
        LOG(ERROR) << "Fail to add BthreadsService";
        return -1;
    }
    if (AddBuiltinService(new (std::nothrow) IdsService)) {
        LOG(ERROR) << "Fail to add IdsService";
        return -1;
    }
    if (AddBuiltinService(new (std::nothrow) SocketsService)) {
        LOG(ERROR) << "Fail to add SocketsService";
        return -1;
    }
    if (AddBuiltinService(new (std::nothrow) GetFaviconService)) {
        LOG(ERROR) << "Fail to add GetFaviconService";
        return -1;
    }
    if (AddBuiltinService(new (std::nothrow) GetJsService)) {
        LOG(ERROR) << "Fail to add GetJsService";
        return -1;
    }
    if (AddBuiltinService(new (std::nothrow) GrpcHealthCheckService)) {
        LOG(ERROR) << "Fail to add GrpcHealthCheckService";
        return -1;
    }
    return 0;
}