Update events for insiders (#6807)

* Update events for insiders

* Add back in isBuilt check
This commit is contained in:
Charles Gagnon
2019-08-21 07:41:31 -07:00
committed by GitHub
parent ecb80f14f0
commit 3fde278ed2
5 changed files with 61 additions and 36 deletions

View File

@@ -70,7 +70,7 @@ interface ISharedProcessInitData {
logLevel: LogLevel; logLevel: LogLevel;
} }
const eventPrefix = 'monacoworkbench'; const eventPrefix = product.quality !== 'stable' ? 'adsworkbench' : 'monacoworkbench'; // {{ SQL CARBON EDIT }}
class MainProcessService implements IMainProcessService { class MainProcessService implements IMainProcessService {
constructor(private server: Server, private mainRouter: StaticRouter) { } constructor(private server: Server, private mainRouter: StaticRouter) { }

View File

@@ -302,7 +302,7 @@ export class Main {
} }
} }
const eventPrefix = 'monacoworkbench'; const eventPrefix = product.quality !== 'stable' ? 'adsworkbench' : 'monacoworkbench';
export async function main(argv: ParsedArgs): Promise<void> { export async function main(argv: ParsedArgs): Promise<void> {
const services = new ServiceCollection(); const services = new ServiceCollection();

View File

@@ -14,15 +14,25 @@ const productObject = product;
export async function resolveCommonProperties(commit: string | undefined, version: string | undefined, machineId: string | undefined, installSourcePath: string, product?: string): Promise<{ [name: string]: string | undefined; }> { export async function resolveCommonProperties(commit: string | undefined, version: string | undefined, machineId: string | undefined, installSourcePath: string, product?: string): Promise<{ [name: string]: string | undefined; }> {
const result: { [name: string]: string | undefined; } = Object.create(null); const result: { [name: string]: string | undefined; } = Object.create(null);
// {{SQL CARBON EDIT}} // {{SQL CARBON EDIT}}
if (productObject.quality !== 'stable') {
// __GDPR__COMMON__ "common.machineId" : { "endPoint": "MacAddressHash", "classification": "EndUserPseudonymizedInformation", "purpose": "FeatureInsight" } // __GDPR__COMMON__ "common.machineId" : { "endPoint": "MacAddressHash", "classification": "EndUserPseudonymizedInformation", "purpose": "FeatureInsight" }
result['common.machineId'] = ''; result['common.machineId'] = machineId;
// __GDPR__COMMON__ "sessionID" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" } // __GDPR__COMMON__ "sessionID" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
result['sessionID'] = ''; result['sessionID'] = uuid.generateUuid() + Date.now();
// __GDPR__COMMON__ "commitHash" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth" } // __GDPR__COMMON__ "commitHash" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth" }
result['commitHash'] = commit;
} else {
// __GDPR__COMMON__ "common.machineId" : { "endPoint": "MacAddressHash", "classification": "EndUserPseudonymizedInformation", "purpose": "FeatureInsight" }
// result['common.machineId'] = machineId;
result['common.machineId'] = '';
// // __GDPR__COMMON__ "sessionID" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
// result['sessionID'] = uuid.generateUuid() + Date.now();
result['sessionID'] = '';
// __GDPR__COMMON__ "commitHash" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
result['commitHash'] = ''; result['commitHash'] = '';
}
// __GDPR__COMMON__ "version" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" } // __GDPR__COMMON__ "version" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
result['version'] = version; result['version'] = version;
// __GDPR__COMMON__ "common.platformVersion" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" } // __GDPR__COMMON__ "common.platformVersion" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
@@ -34,9 +44,8 @@ export async function resolveCommonProperties(commit: string | undefined, versio
// __GDPR__COMMON__ "common.nodeArch" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth" } // __GDPR__COMMON__ "common.nodeArch" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth" }
result['common.nodeArch'] = process.arch; result['common.nodeArch'] = process.arch;
// __GDPR__COMMON__ "common.product" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth" } // __GDPR__COMMON__ "common.product" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth" }
// {{SQL CARBON EDIT}} result['common.product'] = productObject.nameShort || 'desktop'; // {{SQL CARBON EDIT}}
result['common.product'] = productObject.nameShort || 'desktop'; result['common.application.name'] = productObject.nameLong; // {{SQL CARBON EDIT}}
result['common.application.name'] = productObject.nameLong;
// dynamic properties which value differs on each call // dynamic properties which value differs on each call
let seq = 0; let seq = 0;

View File

@@ -8,8 +8,7 @@ import { resolveCommonProperties } from 'vs/platform/telemetry/node/commonProper
import { instanceStorageKey, firstSessionDateStorageKey, lastSessionDateStorageKey } from 'vs/platform/telemetry/common/telemetry'; import { instanceStorageKey, firstSessionDateStorageKey, lastSessionDateStorageKey } from 'vs/platform/telemetry/common/telemetry';
import { cleanRemoteAuthority } from 'vs/platform/telemetry/common/telemetryUtils'; import { cleanRemoteAuthority } from 'vs/platform/telemetry/common/telemetryUtils';
// {{ SQL CARBON EDIT }} import product from 'vs/platform/product/node/product'; // {{ SQL CARBON EDIT }}
import product from 'vs/platform/product/node/product';
export async function resolveWorkbenchCommonProperties(storageService: IStorageService, commit: string | undefined, version: string | undefined, machineId: string, installSourcePath: string, remoteAuthority?: string): Promise<{ [name: string]: string | undefined }> { export async function resolveWorkbenchCommonProperties(storageService: IStorageService, commit: string | undefined, version: string | undefined, machineId: string, installSourcePath: string, remoteAuthority?: string): Promise<{ [name: string]: string | undefined }> {
const result = await resolveCommonProperties(commit, version, machineId, installSourcePath); const result = await resolveCommonProperties(commit, version, machineId, installSourcePath);
@@ -17,6 +16,22 @@ export async function resolveWorkbenchCommonProperties(storageService: IStorageS
const firstSessionDate = storageService.get(firstSessionDateStorageKey, StorageScope.GLOBAL)!; const firstSessionDate = storageService.get(firstSessionDateStorageKey, StorageScope.GLOBAL)!;
const lastSessionDate = storageService.get(lastSessionDateStorageKey, StorageScope.GLOBAL)!; const lastSessionDate = storageService.get(lastSessionDateStorageKey, StorageScope.GLOBAL)!;
if (product.quality !== 'stable') {
// __GDPR__COMMON__ "common.version.shell" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth" }
result['common.version.shell'] = process.versions && process.versions['electron'];
// __GDPR__COMMON__ "common.version.renderer" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth" }
result['common.version.renderer'] = process.versions && process.versions['chrome'];
// __GDPR__COMMON__ "common.firstSessionDate" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
result['common.firstSessionDate'] = firstSessionDate;
// __GDPR__COMMON__ "common.lastSessionDate" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
result['common.lastSessionDate'] = lastSessionDate || '';
// __GDPR__COMMON__ "common.isNewSession" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
result['common.isNewSession'] = !lastSessionDate ? '1' : '0';
// __GDPR__COMMON__ "common.instanceId" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
result['common.instanceId'] = instanceId;
// __GDPR__COMMON__ "common.remoteAuthority" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth" }
result['common.remoteAuthority'] = cleanRemoteAuthority(remoteAuthority);
} else {
// __GDPR__COMMON__ "common.version.shell" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth" } // __GDPR__COMMON__ "common.version.shell" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth" }
// result['common.version.shell'] = process.versions && process.versions['electron']; // result['common.version.shell'] = process.versions && process.versions['electron'];
// __GDPR__COMMON__ "common.version.renderer" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth" } // __GDPR__COMMON__ "common.version.renderer" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth" }
@@ -32,12 +47,10 @@ export async function resolveWorkbenchCommonProperties(storageService: IStorageS
// __GDPR__COMMON__ "common.remoteAuthority" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth" } // __GDPR__COMMON__ "common.remoteAuthority" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth" }
// result['common.remoteAuthority'] = cleanRemoteAuthority(remoteAuthority); // result['common.remoteAuthority'] = cleanRemoteAuthority(remoteAuthority);
// {{SQL CARBON EDIT}} result['common.userId'] = ''; // {{SQL CARBON EDIT}}
result['common.application.name'] = product.nameLong; }
// {{SQL CARBON EDIT}}
result['common.userId'] = '';
// {{SQL CARBON EDIT}} result['common.application.name'] = product.nameLong; // {{SQL CARBON EDIT}}
setUsageDates(storageService); setUsageDates(storageService);
return result; return result;

View File

@@ -20,7 +20,8 @@ import { ApplicationInsights } from '@microsoft/applicationinsights-web';
export class WebTelemetryAppender implements ITelemetryAppender { export class WebTelemetryAppender implements ITelemetryAppender {
private _aiClient?: ApplicationInsights; private _aiClient?: ApplicationInsights;
constructor(aiKey: string, private _logService: ILogService) { constructor(aiKey: string, private _logService: ILogService
, @IWorkbenchEnvironmentService private _environmentService: IWorkbenchEnvironmentService) { // {{ SQL CARBON EDIT }}
const initConfig = { const initConfig = {
config: { config: {
instrumentationKey: aiKey, instrumentationKey: aiKey,
@@ -44,8 +45,10 @@ export class WebTelemetryAppender implements ITelemetryAppender {
data = validateTelemetryData(data); data = validateTelemetryData(data);
this._logService.trace(`telemetry/${eventName}`, data); this._logService.trace(`telemetry/${eventName}`, data);
// {{ SQL CARBON EDIT }}
const eventPrefix = this._environmentService.appQuality !== 'stable' ? 'adsworkbench/' : 'monacoworkbench/';
this._aiClient.trackEvent({ this._aiClient.trackEvent({
name: 'monacoworkbench/' + eventName, name: eventPrefix + eventName,
properties: data.properties, properties: data.properties,
measurements: data.measurements measurements: data.measurements
}); });
@@ -82,7 +85,7 @@ export class TelemetryService extends Disposable implements ITelemetryService {
const aiKey = productService.aiConfig && productService.aiConfig.asimovKey; const aiKey = productService.aiConfig && productService.aiConfig.asimovKey;
if (!environmentService.isExtensionDevelopment && !environmentService.args['disable-telemetry'] && !!productService.enableTelemetry && !!aiKey) { if (!environmentService.isExtensionDevelopment && !environmentService.args['disable-telemetry'] && !!productService.enableTelemetry && !!aiKey) {
const config: ITelemetryServiceConfig = { const config: ITelemetryServiceConfig = {
appender: combinedAppender(new WebTelemetryAppender(aiKey, logService), new LogAppender(logService)), appender: combinedAppender(new WebTelemetryAppender(aiKey, logService, environmentService), new LogAppender(logService)),
commonProperties: resolveWorkbenchCommonProperties(storageService, productService.commit, productService.version, environmentService.configuration.machineId, environmentService.configuration.remoteAuthority), commonProperties: resolveWorkbenchCommonProperties(storageService, productService.commit, productService.version, environmentService.configuration.machineId, environmentService.configuration.remoteAuthority),
piiPaths: [environmentService.appRoot] piiPaths: [environmentService.appRoot]
}; };