Feature: Usage metrics (#2227)

* added user stats telemetry

* finished daily, weekly and monthly events

* code review comments

* added wekly and monthly start dates

* fixed the day condition using testing
This commit is contained in:
Aditya Bist
2018-08-24 12:11:22 -07:00
committed by GitHub
parent fb565c2548
commit df617f19e0
3 changed files with 55 additions and 0 deletions

View File

@@ -41,6 +41,8 @@ export function resolveWorkbenchCommonProperties(storageService: IStorageService
// result['common.instanceId'] = getOrCreateInstanceId(storageService);
result['common.instanceId'] = '';
// {{SQL CARBON EDIT}}
setUsageDates(storageService);
return result;
});
}
@@ -51,3 +53,20 @@ export function resolveWorkbenchCommonProperties(storageService: IStorageService
// storageService.store('telemetry.instanceId', result);
// return result;
// }
// {{SQL CARBON EDIT}}
function setUsageDates(storageService: IStorageService): void {
// daily last usage date
const appStartDate = new Date('January 1, 2000');
const dailyLastUseDate = storageService.get('telemetry.dailyLastUseDate') || appStartDate;
storageService.store('telemetry.dailyLastUseDate', dailyLastUseDate);
// weekly last usage date
const weeklyLastUseDate = storageService.get('telemetry.weeklyLastUseDate') || appStartDate;
storageService.store('telemetry.weeklyLastUseDate', weeklyLastUseDate);
// monthly last usage date
const monthlyLastUseDate = storageService.get('telemetry.monthlyLastUseDate') || appStartDate;
storageService.store('telemetry.monthlyLastUseDate', monthlyLastUseDate);
}