@@ -2585,10 +2585,10 @@ index 0000000000000000000000000000000000000000..0d9310038c0ca378579652d89bc8ac84
25852585+ }
25862586diff --git a/src/vs/server/node/server.ts b/src/vs/server/node/server.ts
25872587new file mode 100644
2588- index 0000000000000000000000000000000000000000..45a7bf62a6c07d8771b0257e7c98fae095109eb1
2588+ index 0000000000000000000000000000000000000000..8424965d9c79d34e5513e4cfe543718521ad82c7
25892589--- /dev/null
25902590+++ b/src/vs/server/node/server.ts
2591- @@ -0,0 +1,291 @@
2591+ @@ -0,0 +1,300 @@
25922592+ import { field } from '@coder/logger';
25932593+ import * as fs from 'fs';
25942594+ import * as net from 'net';
@@ -2618,8 +2618,9 @@ index 0000000000000000000000000000000000000000..45a7bf62a6c07d8771b0257e7c98fae0
26182618+ import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
26192619+ import { ILocalizationsService } from 'vs/platform/localizations/common/localizations';
26202620+ import { LocalizationsService } from 'vs/platform/localizations/node/localizations';
2621- + import { getLogLevel, ILogService } from 'vs/platform/log/common/log';
2621+ + import { getLogLevel, ILoggerService, ILogService } from 'vs/platform/log/common/log';
26222622+ import { LoggerChannel } from 'vs/platform/log/common/logIpc';
2623+ + import { LoggerService } from 'vs/platform/log/node/loggerService';
26232624+ import { SpdLogService } from 'vs/platform/log/node/spdlogService';
26242625+ import product from 'vs/platform/product/common/product';
26252626+ import { IProductService } from 'vs/platform/product/common/productService';
@@ -2630,8 +2631,9 @@ index 0000000000000000000000000000000000000000..45a7bf62a6c07d8771b0257e7c98fae0
26302631+ import { RequestService } from 'vs/platform/request/node/requestService';
26312632+ import ErrorTelemetry from 'vs/platform/telemetry/browser/errorTelemetry';
26322633+ import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
2634+ + import { TelemetryLogAppender } from 'vs/platform/telemetry/common/telemetryLogAppender';
26332635+ import { TelemetryService } from 'vs/platform/telemetry/common/telemetryService';
2634- + import { combinedAppender, LogAppender, NullTelemetryService } from 'vs/platform/telemetry/common/telemetryUtils';
2636+ + import { combinedAppender, NullTelemetryService } from 'vs/platform/telemetry/common/telemetryUtils';
26352637+ import { AppInsightsAppender } from 'vs/platform/telemetry/node/appInsightsAppender';
26362638+ import { resolveCommonProperties } from 'vs/platform/telemetry/node/commonProperties';
26372639+ import { INodeProxyService, NodeProxyChannel } from 'vs/server/common/nodeProxy';
@@ -2820,6 +2822,7 @@ index 0000000000000000000000000000000000000000..45a7bf62a6c07d8771b0257e7c98fae0
28202822+ this.services.set(ILogService, logService);
28212823+ this.services.set(IEnvironmentService, environmentService);
28222824+ this.services.set(INativeEnvironmentService, environmentService);
2825+ + this.services.set(ILoggerService, new SyncDescriptor(LoggerService));
28232826+
28242827+ const configurationService = new ConfigurationService(environmentService.settingsResource, fileService);
28252828+ await configurationService.initialize();
@@ -2828,45 +2831,51 @@ index 0000000000000000000000000000000000000000..45a7bf62a6c07d8771b0257e7c98fae0
28282831+ this.services.set(IRequestService, new SyncDescriptor(RequestService));
28292832+ this.services.set(IFileService, fileService);
28302833+ this.services.set(IProductService, { _serviceBrand: undefined, ...product });
2831- + this.services.set(IExtensionGalleryService, new SyncDescriptor(ExtensionGalleryService));
2832- + this.services.set(IExtensionManagementService, new SyncDescriptor(ExtensionManagementService));
2833- +
2834- + if (!environmentService.disableTelemetry) {
2835- + this.services.set(ITelemetryService, new TelemetryService({
2836- + appender: combinedAppender(
2837- + new AppInsightsAppender('code-server', null, () => new TelemetryClient() as any, logService),
2838- + new LogAppender(logService),
2839- + ),
2840- + sendErrorTelemetry: true,
2841- + commonProperties: resolveCommonProperties(
2842- + product.commit, product.version, await getMachineId(),
2843- + [], environmentService.installSourcePath, 'code-server',
2844- + ),
2845- + piiPaths,
2846- + }, configurationService));
2847- + } else {
2848- + this.services.set(ITelemetryService, NullTelemetryService);
2849- + }
2834+ +
2835+ + const machineId = await getMachineId();
28502836+
28512837+ await new Promise((resolve) => {
28522838+ const instantiationService = new InstantiationService(this.services);
2853- + this.services.set(ILocalizationsService, instantiationService.createInstance(LocalizationsService));
2854- + this.services.set(INodeProxyService, instantiationService.createInstance(NodeProxyService));
28552839+
2856- + instantiationService.invokeFunction(() => {
2840+ + instantiationService.invokeFunction((accessor ) => {
28572841+ instantiationService.createInstance(LogsDataCleaner);
2858- + const telemetryService = this.services.get(ITelemetryService) as ITelemetryService;
2842+ +
2843+ + let telemetryService: ITelemetryService;
2844+ + if (!environmentService.disableTelemetry) {
2845+ + telemetryService = new TelemetryService({
2846+ + appender: combinedAppender(
2847+ + new AppInsightsAppender('code-server', null, () => new TelemetryClient() as any),
2848+ + new TelemetryLogAppender(accessor.get(ILoggerService), environmentService)
2849+ + ),
2850+ + sendErrorTelemetry: true,
2851+ + commonProperties: resolveCommonProperties(
2852+ + product.commit, product.version, machineId,
2853+ + [], environmentService.installSourcePath, 'code-server',
2854+ + ),
2855+ + piiPaths,
2856+ + }, configurationService);
2857+ + } else {
2858+ + telemetryService = NullTelemetryService;
2859+ + }
2860+ +
2861+ + this.services.set(ITelemetryService, telemetryService);
2862+ +
2863+ + this.services.set(IExtensionManagementService, new SyncDescriptor(ExtensionManagementService));
2864+ + this.services.set(IExtensionGalleryService, new SyncDescriptor(ExtensionGalleryService));
2865+ + this.services.set(ILocalizationsService, new SyncDescriptor(LocalizationsService));
2866+ + this.services.set(INodeProxyService, new SyncDescriptor(NodeProxyService));
2867+ +
28592868+ this.ipc.registerChannel('extensions', new ExtensionManagementChannel(
2860- + this.services. get(IExtensionManagementService) as IExtensionManagementService ,
2869+ + accessor. get(IExtensionManagementService),
28612870+ (context) => getUriTransformer(context.remoteAuthority),
28622871+ ));
28632872+ this.ipc.registerChannel('remoteextensionsenvironment', new ExtensionEnvironmentChannel(
28642873+ environmentService, logService, telemetryService, '',
28652874+ ));
2866- + this.ipc.registerChannel('request', new RequestChannel(this.services. get(IRequestService) as IRequestService ));
2875+ + this.ipc.registerChannel('request', new RequestChannel(accessor. get(IRequestService)));
28672876+ this.ipc.registerChannel('telemetry', new TelemetryChannel(telemetryService));
2868- + this.ipc.registerChannel('nodeProxy', new NodeProxyChannel(this.services. get(INodeProxyService) as INodeProxyService ));
2869- + this.ipc.registerChannel('localizations', <IServerChannel<any>>createChannelReceiver(this.services. get(ILocalizationsService) as ILocalizationsService ));
2877+ + this.ipc.registerChannel('nodeProxy', new NodeProxyChannel(accessor. get(INodeProxyService)));
2878+ + this.ipc.registerChannel('localizations', <IServerChannel<any>>createChannelReceiver(accessor. get(ILocalizationsService)));
28702879+ this.ipc.registerChannel(REMOTE_FILE_SYSTEM_CHANNEL_NAME, new FileProviderChannel(environmentService, logService));
28712880+ resolve(new ErrorTelemetry(telemetryService));
28722881+ });
0 commit comments