From 161c182a5623751afa0d90370ea62a4863072321 Mon Sep 17 00:00:00 2001 From: Candice Ye Date: Wed, 31 Jul 2019 14:50:26 -0700 Subject: [PATCH] Fixed telemetry events for visualizer recommendation prompts (#6547) * Fixed telemetry events for visualizer recommendation prompts * Added telemetry event for when Visualizer button in action bar is clicked and added respective telemetry keys * Created TelemetryView and TelemetryAction and relocated new constants --- .../telemetry/common/telemetryKeys.ts | 8 ++++- .../workbench/parts/query/browser/actions.ts | 11 ++++-- .../electron-browser/extensionTipsService.ts | 34 ++++++++++++++++--- 3 files changed, 45 insertions(+), 8 deletions(-) diff --git a/src/sql/platform/telemetry/common/telemetryKeys.ts b/src/sql/platform/telemetry/common/telemetryKeys.ts index fb676998b7..a5bb22d629 100644 --- a/src/sql/platform/telemetry/common/telemetryKeys.ts +++ b/src/sql/platform/telemetry/common/telemetryKeys.ts @@ -64,5 +64,11 @@ export const DeleteAgentProxy = 'DeleteAgentProxy'; export const NotebookMarkdownRendered = 'NotebookMarkdownRendered'; export enum TelemetryView { - Shell = 'Shell' + Shell = 'Shell', + ExtensionRecommendationDialog = 'ExtensionRecommendationDialog', + ResultsPanel = 'ResultsPanel' +} + +export enum TelemetryAction { + Click = 'Click' } diff --git a/src/sql/workbench/parts/query/browser/actions.ts b/src/sql/workbench/parts/query/browser/actions.ts index 5a9c5162c7..c6ea7eef5a 100644 --- a/src/sql/workbench/parts/query/browser/actions.ts +++ b/src/sql/workbench/parts/query/browser/actions.ts @@ -21,6 +21,8 @@ import QueryRunner from 'sql/platform/query/common/queryRunner'; import product from 'vs/platform/product/node/product'; import { GridTableState } from 'sql/workbench/parts/query/common/gridPanelState'; import * as Constants from 'sql/workbench/contrib/extensions/constants'; +import { IAdsTelemetryService } from 'sql/platform/telemetry/telemetry'; +import * as TelemetryKeys from 'sql/platform/telemetry/common/telemetryKeys'; export interface IGridActionContext { gridDataProvider: IGridDataProvider; @@ -226,13 +228,18 @@ export class VisualizerDataAction extends Action { constructor( private runner: QueryRunner, - @IEditorService private editorService: IEditorService, - + @IAdsTelemetryService private adsTelemetryService: IAdsTelemetryService ) { super(VisualizerDataAction.ID, VisualizerDataAction.LABEL, VisualizerDataAction.ICON); } public run(context: IGridActionContext): Promise { + this.adsTelemetryService.sendActionEvent( + TelemetryKeys.TelemetryView.ResultsPanel, + TelemetryKeys.TelemetryAction.Click, + 'VisualizerButton', + 'VisualizerDataAction' + ); this.runner.notifyVisualizeRequested(context.batchId, context.resultId); return Promise.resolve(true); } diff --git a/src/vs/workbench/contrib/extensions/electron-browser/extensionTipsService.ts b/src/vs/workbench/contrib/extensions/electron-browser/extensionTipsService.ts index 5736f52ae3..06397b84cf 100644 --- a/src/vs/workbench/contrib/extensions/electron-browser/extensionTipsService.ts +++ b/src/vs/workbench/contrib/extensions/electron-browser/extensionTipsService.ts @@ -50,6 +50,8 @@ import { extname } from 'vs/base/common/resources'; import { ITextFileService } from 'vs/workbench/services/textfile/common/textfiles'; import { IExeBasedExtensionTip } from 'vs/platform/product/common/product'; import { timeout } from 'vs/base/common/async'; +import { IAdsTelemetryService } from 'sql/platform/telemetry/telemetry'; +import * as TelemetryKeys from 'sql/platform/telemetry/common/telemetryKeys'; const milliSecondsInADay = 1000 * 60 * 60 * 24; const choiceNever = localize('neverShowAgain', "Don't Show Again"); @@ -115,7 +117,8 @@ export class ExtensionTipsService extends Disposable implements IExtensionTipsSe @IExtensionManagementService private readonly extensionManagementService: IExtensionManagementService, @IExtensionsWorkbenchService private readonly extensionWorkbenchService: IExtensionsWorkbenchService, @IExperimentService private readonly experimentService: IExperimentService, - @ITextFileService private readonly textFileService: ITextFileService + @ITextFileService private readonly textFileService: ITextFileService, + @IAdsTelemetryService private readonly adsTelemetryService: IAdsTelemetryService ) { super(); @@ -1167,6 +1170,7 @@ export class ExtensionTipsService extends Disposable implements IExtensionTipsSe let localExtensions: ILocalExtension[]; const getRecommendationPromise = this.getRecommendedExtensionsByScenario(scenarioType).then(recs => { recommendations = recs; }); const getLocalExtensionPromise = this.extensionsService.getInstalled(ExtensionType.User).then(local => { localExtensions = local; }); + const visualizerExtensionNotificationService = 'VisualizerExtensionNotificationService'; let recommendationMessage = localize('ExtensionsRecommended', "Azure Data Studio has extension recommendations."); if (scenarioType === Constants.visualizerExtensions) { @@ -1181,7 +1185,12 @@ export class ExtensionTipsService extends Disposable implements IExtensionTipsSe [{ label: localize('installAll', "Install All"), run: () => { - this.telemetryService.publicLog(scenarioType + 'Recommendations:popup', { userReaction: 'install' }); + this.adsTelemetryService.sendActionEvent( + TelemetryKeys.TelemetryView.ExtensionRecommendationDialog, + TelemetryKeys.TelemetryAction.Click, + 'InstallButton', + visualizerExtensionNotificationService + ); const installAllAction = this.instantiationService.createInstance(InstallRecommendedExtensionsByScenarioAction, scenarioType, recommendations); installAllAction.run(); installAllAction.dispose(); @@ -1189,7 +1198,12 @@ export class ExtensionTipsService extends Disposable implements IExtensionTipsSe }, { label: localize('showRecommendations', "Show Recommendations"), run: () => { - this.telemetryService.publicLog(scenarioType + 'Recommendations:popup', { userReaction: 'show' }); + this.adsTelemetryService.sendActionEvent( + TelemetryKeys.TelemetryView.ExtensionRecommendationDialog, + TelemetryKeys.TelemetryAction.Click, + 'ShowRecommendationsButton', + visualizerExtensionNotificationService + ); const showAction = this.instantiationService.createInstance(ShowRecommendedExtensionsByScenarioAction, scenarioType); showAction.run(); showAction.dispose(); @@ -1199,7 +1213,12 @@ export class ExtensionTipsService extends Disposable implements IExtensionTipsSe label: choiceNever, isSecondary: true, run: () => { - this.telemetryService.publicLog(scenarioType + 'Recommendations:popup', { userReaction: 'neverShowAgain' }); + this.adsTelemetryService.sendActionEvent( + TelemetryKeys.TelemetryView.ExtensionRecommendationDialog, + TelemetryKeys.TelemetryAction.Click, + 'NeverShowAgainButton', + visualizerExtensionNotificationService + ); this.storageService.store(storageKey, true, StorageScope.GLOBAL); c(undefined); } @@ -1207,7 +1226,12 @@ export class ExtensionTipsService extends Disposable implements IExtensionTipsSe { sticky: true, onCancel: () => { - this.telemetryService.publicLog(scenarioType + 'Recommendations:popup', { userReaction: 'cancelled' }); + this.adsTelemetryService.sendActionEvent( + TelemetryKeys.TelemetryView.ExtensionRecommendationDialog, + TelemetryKeys.TelemetryAction.Click, + 'CancelButton', + visualizerExtensionNotificationService + ); c(undefined); } }