Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update events for insiders #6807

Merged
merged 3 commits into from
Aug 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ interface ISharedProcessInitData {
logLevel: LogLevel;
}

const eventPrefix = 'monacoworkbench';
const eventPrefix = product.quality !== 'stable' ? 'adsworkbench' : 'monacoworkbench'; // {{ SQL CARBON EDIT }}

class MainProcessService implements IMainProcessService {
constructor(private server: Server, private mainRouter: StaticRouter) { }
Expand Down
2 changes: 1 addition & 1 deletion src/vs/code/node/cliProcessMain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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> {
const services = new ServiceCollection();
Expand Down
29 changes: 19 additions & 10 deletions src/vs/platform/telemetry/node/commonProperties.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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; }> {
const result: { [name: string]: string | undefined; } = Object.create(null);

// {{SQL CARBON EDIT}}
// __GDPR__COMMON__ "common.machineId" : { "endPoint": "MacAddressHash", "classification": "EndUserPseudonymizedInformation", "purpose": "FeatureInsight" }
result['common.machineId'] = '';
// __GDPR__COMMON__ "sessionID" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
result['sessionID'] = '';
if (productObject.quality !== 'stable') {
// __GDPR__COMMON__ "common.machineId" : { "endPoint": "MacAddressHash", "classification": "EndUserPseudonymizedInformation", "purpose": "FeatureInsight" }
result['common.machineId'] = machineId;
// __GDPR__COMMON__ "sessionID" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
result['sessionID'] = uuid.generateUuid() + Date.now();
// __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'] = '';
}

// __GDPR__COMMON__ "commitHash" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth" }
result['commitHash'] = '';
// __GDPR__COMMON__ "version" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
result['version'] = version;
// __GDPR__COMMON__ "common.platformVersion" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
Expand All @@ -34,9 +44,8 @@ export async function resolveCommonProperties(commit: string | undefined, versio
// __GDPR__COMMON__ "common.nodeArch" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth" }
result['common.nodeArch'] = process.arch;
// __GDPR__COMMON__ "common.product" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth" }
// {{SQL CARBON EDIT}}
result['common.product'] = productObject.nameShort || 'desktop';
result['common.application.name'] = productObject.nameLong;
result['common.product'] = productObject.nameShort || 'desktop'; // {{SQL CARBON EDIT}}
result['common.application.name'] = productObject.nameLong; // {{SQL CARBON EDIT}}

// dynamic properties which value differs on each call
let seq = 0;
Expand Down
59 changes: 36 additions & 23 deletions src/vs/platform/telemetry/node/workbenchCommonProperties.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,36 +8,49 @@ import { resolveCommonProperties } from 'vs/platform/telemetry/node/commonProper
import { instanceStorageKey, firstSessionDateStorageKey, lastSessionDateStorageKey } from 'vs/platform/telemetry/common/telemetry';
import { cleanRemoteAuthority } from 'vs/platform/telemetry/common/telemetryUtils';

// {{ SQL CARBON EDIT }}
import product from 'vs/platform/product/node/product';
import product from 'vs/platform/product/node/product'; // {{ SQL CARBON EDIT }}

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 instanceId = storageService.get(instanceStorageKey, StorageScope.GLOBAL)!;
const firstSessionDate = storageService.get(firstSessionDateStorageKey, StorageScope.GLOBAL)!;
const lastSessionDate = storageService.get(lastSessionDateStorageKey, StorageScope.GLOBAL)!;

// __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);

// {{SQL CARBON EDIT}}
result['common.application.name'] = product.nameLong;
// {{SQL CARBON EDIT}}
result['common.userId'] = '';

// {{SQL CARBON EDIT}}
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" }
// 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);

result['common.userId'] = ''; // {{SQL CARBON EDIT}}
}

result['common.application.name'] = product.nameLong; // {{SQL CARBON EDIT}}
setUsageDates(storageService);

return result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ import { ApplicationInsights } from '@microsoft/applicationinsights-web';
export class WebTelemetryAppender implements ITelemetryAppender {
private _aiClient?: ApplicationInsights;

constructor(aiKey: string, private _logService: ILogService) {
constructor(aiKey: string, private _logService: ILogService
, @IWorkbenchEnvironmentService private _environmentService: IWorkbenchEnvironmentService) { // {{ SQL CARBON EDIT }}
const initConfig = {
config: {
instrumentationKey: aiKey,
Expand All @@ -44,8 +45,10 @@ export class WebTelemetryAppender implements ITelemetryAppender {
data = validateTelemetryData(data);
this._logService.trace(`telemetry/${eventName}`, data);

// {{ SQL CARBON EDIT }}
const eventPrefix = this._environmentService.appQuality !== 'stable' ? 'adsworkbench/' : 'monacoworkbench/';
this._aiClient.trackEvent({
name: 'monacoworkbench/' + eventName,
name: eventPrefix + eventName,
properties: data.properties,
measurements: data.measurements
});
Expand Down Expand Up @@ -82,7 +85,7 @@ export class TelemetryService extends Disposable implements ITelemetryService {
const aiKey = productService.aiConfig && productService.aiConfig.asimovKey;
if (!environmentService.isExtensionDevelopment && !environmentService.args['disable-telemetry'] && !!productService.enableTelemetry && !!aiKey) {
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),
piiPaths: [environmentService.appRoot]
};
Expand Down