Add telemetry for all commands (#6025)

This commit is contained in:
Charles Gagnon
2019-06-14 16:16:21 +00:00
committed by GitHub
parent 6ff34d9894
commit 363af2a85c

View File

@@ -9,15 +9,20 @@ import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { Disposable } from 'vs/base/common/lifecycle';
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
import { ICommandService, ICommandEvent } from 'vs/platform/commands/common/commands';
export class SqlTelemetryContribution extends Disposable implements IWorkbenchContribution {
constructor(
@ITelemetryService private telemetryService: ITelemetryService,
@IStorageService storageService: IStorageService
@IStorageService storageService: IStorageService,
@ICommandService commandService: ICommandService
) {
super();
this._register(
commandService.onWillExecuteCommand(
(e: ICommandEvent) => telemetryService.publicLog('adsCommandExecuted', { id: e.commandId })));
const dailyLastUseDate: number = Date.parse(storageService.get('telemetry.dailyLastUseDate', StorageScope.GLOBAL, '0'));
const weeklyLastUseDate: number = Date.parse(storageService.get('telemetry.weeklyLastUseDate', StorageScope.GLOBAL, '0'));
const monthlyLastUseDate: number = Date.parse(storageService.get('telemetry.monthlyLastUseDate', StorageScope.GLOBAL, '0'));