Merge from vscode c58aaab8a1cc22a7139b761166a0d4f37d41e998 (#7880)

* Merge from vscode c58aaab8a1cc22a7139b761166a0d4f37d41e998

* fix pipelines

* fix strict-null-checks

* add missing files
This commit is contained in:
Anthony Dresser
2019-10-21 22:12:22 -07:00
committed by GitHub
parent 7c9be74970
commit 1e22f47304
913 changed files with 18898 additions and 16536 deletions

View File

@@ -15,55 +15,26 @@ import { ClassifiedEvent, StrictPropertyCheck, GDPRClassification } from 'vs/pla
import { IStorageService } from 'vs/platform/storage/common/storage';
import { resolveWorkbenchCommonProperties } from 'vs/platform/telemetry/browser/workbenchCommonProperties';
import { IProductService } from 'vs/platform/product/common/productService';
import { ApplicationInsights } from '@microsoft/applicationinsights-web';
import { IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteAgentService';
export class WebTelemetryAppender implements ITelemetryAppender {
private _aiClient?: ApplicationInsights;
constructor(aiKey: string, private _logService: ILogService
, @IWorkbenchEnvironmentService private _environmentService: IWorkbenchEnvironmentService) { // {{ SQL CARBON EDIT }}
const initConfig = {
config: {
instrumentationKey: aiKey,
endpointUrl: 'https://vortex.data.microsoft.com/collect/v1',
emitLineDelimitedJson: true,
autoTrackPageVisitTime: false,
disableExceptionTracking: true,
disableAjaxTracking: true
}
};
this._aiClient = new ApplicationInsights(initConfig);
this._aiClient.loadAppInsights();
}
constructor(private _logService: ILogService, private _appender: IRemoteAgentService,
@IWorkbenchEnvironmentService private _environmentService: IWorkbenchEnvironmentService) { } // {{ SQL CARBON EDIT }}
log(eventName: string, data: any): void {
if (!this._aiClient) {
return;
}
data = validateTelemetryData(data);
this._logService.trace(`telemetry/${eventName}`, data);
// {{ SQL CARBON EDIT }}
const eventPrefix = this._environmentService.appQuality !== 'stable' ? 'adsworkbench/' : 'monacoworkbench/';
this._aiClient.trackEvent({
name: eventPrefix + eventName,
const eventPrefix = this._environmentService.appQuality !== 'stable' ? '/adsworkbench/' : '/monacoworkbench/'; // {{SQL CARBON EDIT}}
this._appender.logTelemetry(eventPrefix + eventName, {
properties: data.properties,
measurements: data.measurements
});
}
flush(): Promise<void> {
if (this._aiClient) {
return new Promise(resolve => {
this._aiClient!.flush();
this._aiClient = undefined;
resolve(undefined);
});
}
return Promise.resolve();
return this._appender.flushTelemetry();
}
}
@@ -78,14 +49,14 @@ export class TelemetryService extends Disposable implements ITelemetryService {
@ILogService logService: ILogService,
@IConfigurationService configurationService: IConfigurationService,
@IStorageService storageService: IStorageService,
@IProductService productService: IProductService
@IProductService productService: IProductService,
@IRemoteAgentService remoteAgentService: IRemoteAgentService
) {
super();
const aiKey = productService.aiConfig && productService.aiConfig.asimovKey;
if (!environmentService.isExtensionDevelopment && !environmentService.args['disable-telemetry'] && !!productService.enableTelemetry && !!aiKey) {
if (!environmentService.args['disable-telemetry'] && !!productService.enableTelemetry) {
const config: ITelemetryServiceConfig = {
appender: combinedAppender(new WebTelemetryAppender(aiKey, logService, environmentService), new LogAppender(logService)),
appender: combinedAppender(new WebTelemetryAppender(logService, remoteAgentService, environmentService), new LogAppender(logService)), // {{SQL CARBON EDIT}}
commonProperties: resolveWorkbenchCommonProperties(storageService, productService.commit, productService.version, environmentService.configuration.machineId, environmentService.configuration.remoteAuthority),
piiPaths: [environmentService.appRoot]
};