Skip to content

Commit 9218965

Browse files
authored
add telemetry (microsoft#188518)
1 parent 9d1581a commit 9218965

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

src/vs/workbench/services/userDataProfile/browser/userDataProfileImportExportService.ts

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -239,11 +239,20 @@ export class UserDataProfileImportExportService extends Disposable implements IU
239239
owner: 'sandy081';
240240
comment: 'Report when profile is about to be saved';
241241
};
242+
type CreateProfileInfoClassification = {
243+
owner: 'sandy081';
244+
comment: 'Report when profile is about to be created';
245+
source: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'Type of profile source' };
246+
};
247+
type CreateProfileInfoEvent = {
248+
source: string | undefined;
249+
};
250+
const createProfileTelemetryData: CreateProfileInfoEvent = { source: source instanceof URI ? 'template' : isUserDataProfile(source) ? 'profile' : source ? 'external' : undefined };
242251

243252
if (profile) {
244253
this.telemetryService.publicLog2<{}, SaveProfileInfoClassification>('userDataProfile.startEdit');
245254
} else {
246-
this.telemetryService.publicLog2<{}, SaveProfileInfoClassification>('userDataProfile.startCreate');
255+
this.telemetryService.publicLog2<CreateProfileInfoEvent, CreateProfileInfoClassification>('userDataProfile.startCreate', createProfileTelemetryData);
247256
}
248257

249258
const disposables = new DisposableStore();
@@ -395,7 +404,7 @@ export class UserDataProfileImportExportService extends Disposable implements IU
395404
if (profile) {
396405
this.telemetryService.publicLog2<{}, SaveProfileInfoClassification>('userDataProfile.cancelEdit');
397406
} else {
398-
this.telemetryService.publicLog2<{}, SaveProfileInfoClassification>('userDataProfile.cancelCreate');
407+
this.telemetryService.publicLog2<CreateProfileInfoEvent, CreateProfileInfoClassification>('userDataProfile.cancelCreate', createProfileTelemetryData);
399408
}
400409
return;
401410
}
@@ -414,16 +423,17 @@ export class UserDataProfileImportExportService extends Disposable implements IU
414423
await this.userDataProfileManagementService.updateProfile(profile, { name: result.name, useDefaultFlags: profile.useDefaultFlags && !useDefaultFlags ? {} : useDefaultFlags });
415424
} else {
416425
if (source instanceof URI) {
417-
this.telemetryService.publicLog2<{}, SaveProfileInfoClassification>('userDataProfile.createFromTemplate');
426+
this.telemetryService.publicLog2<CreateProfileInfoEvent, CreateProfileInfoClassification>('userDataProfile.createFromTemplate', createProfileTelemetryData);
418427
await this.importProfile(source, { mode: 'apply', name: result.name, useDefaultFlags });
419428
} else if (isUserDataProfileTemplate(source)) {
420429
source.name = result.name;
430+
this.telemetryService.publicLog2<CreateProfileInfoEvent, CreateProfileInfoClassification>('userDataProfile.createFromExternalTemplate', createProfileTelemetryData);
421431
await this.createAndSwitch(source, false, true, { useDefaultFlags }, localize('create profile', "Create Profile"));
422432
} else if (source) {
423-
this.telemetryService.publicLog2<{}, SaveProfileInfoClassification>('userDataProfile.createFromProfile');
433+
this.telemetryService.publicLog2<CreateProfileInfoEvent, CreateProfileInfoClassification>('userDataProfile.createFromProfile', createProfileTelemetryData);
424434
await this.createFromProfile(source, result.name, { useDefaultFlags });
425435
} else {
426-
this.telemetryService.publicLog2<{}, SaveProfileInfoClassification>('userDataProfile.createEmptyProfile');
436+
this.telemetryService.publicLog2<CreateProfileInfoEvent, CreateProfileInfoClassification>('userDataProfile.createEmptyProfile', createProfileTelemetryData);
427437
await this.userDataProfileManagementService.createAndEnterProfile(result.name, { useDefaultFlags });
428438
}
429439
}

0 commit comments

Comments
 (0)