Skip to content

Commit fe73788

Browse files
authored
report sync operation duration (microsoft#179126)
1 parent 92b87b0 commit fe73788

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/vs/platform/userDataSync/common/userDataAutoSyncService.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ export class UserDataAutoSyncService extends Disposable implements IUserDataAuto
135135
const { enabled, message } = this.isAutoSyncEnabled();
136136
if (enabled) {
137137
if (this.autoSync.value === undefined) {
138-
this.autoSync.value = new AutoSync(this.lastSyncUrl, 1000 * 60 * 5 /* 5 miutes */, this.userDataSyncStoreManagementService, this.userDataSyncStoreService, this.userDataSyncService, this.userDataSyncMachinesService, this.logService, this.storageService);
138+
this.autoSync.value = new AutoSync(this.lastSyncUrl, 1000 * 60 * 5 /* 5 miutes */, this.userDataSyncStoreManagementService, this.userDataSyncStoreService, this.userDataSyncService, this.userDataSyncMachinesService, this.logService, this.telemetryService, this.storageService);
139139
this.autoSync.value.register(this.autoSync.value.onDidStartSync(() => this.lastSyncTriggerTime = new Date().getTime()));
140140
this.autoSync.value.register(this.autoSync.value.onDidFinishSync(e => this.onDidFinishSync(e)));
141141
if (this.startAutoSync()) {
@@ -403,6 +403,7 @@ class AutoSync extends Disposable {
403403
private readonly userDataSyncService: IUserDataSyncService,
404404
private readonly userDataSyncMachinesService: IUserDataSyncMachinesService,
405405
private readonly logService: IUserDataSyncLogService,
406+
private readonly telemetryService: ITelemetryService,
406407
private readonly storageService: IStorageService,
407408
) {
408409
super();
@@ -536,7 +537,15 @@ class AutoSync extends Disposable {
536537
throw new UserDataAutoSyncError(localize('turned off machine', "Cannot sync because syncing is turned off on this machine from another machine."), UserDataSyncErrorCode.TurnedOff);
537538
}
538539

540+
const startTime = new Date().getTime();
539541
await this.syncTask.run();
542+
this.telemetryService.publicLog2<{
543+
duration: number;
544+
}, {
545+
owner: 'sandy081';
546+
comment: 'Report when running a sync operation';
547+
duration: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'Time taken to run sync operation' };
548+
}>('settingsSync:sync', { duration: new Date().getTime() - startTime });
540549

541550
// After syncing, get the manifest if it was not available before
542551
if (this.manifest === null) {

0 commit comments

Comments
 (0)