mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-19 09:35:36 -05:00
Execution Plan Telemetry for Plan Comparisons (#19610)
* Adds telemetry when plan comparison is invoked * Small formatting change. * Adds telemetry to add execution plan button * Removes unused ExecutionPlanComparisonEditorView constructor parameters * Small formatting adjustment * Adds telemetry to ExecutionPlanComparisonEditorView properties * Code review changes
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as azdata from 'azdata';
|
||||
import * as TelemetryKeys from 'sql/platform/telemetry/common/telemetryKeys';
|
||||
import { SelectBox } from 'sql/base/browser/ui/selectBox/selectBox';
|
||||
import { ITaskbarContent, Taskbar } from 'sql/base/browser/ui/taskbar/taskbar';
|
||||
import { AzdataGraphView } from 'sql/workbench/contrib/executionPlan/browser/azdataGraphView';
|
||||
@@ -14,8 +15,6 @@ import { Action } from 'vs/base/common/actions';
|
||||
import { IContextViewService } from 'vs/platform/contextview/browser/contextView';
|
||||
import { IFileDialogService } from 'vs/platform/dialogs/common/dialogs';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IStorageService } from 'vs/platform/storage/common/storage';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { IColorTheme, ICssStyleCollector, IThemeService, registerThemingParticipant } from 'vs/platform/theme/common/themeService';
|
||||
import * as DOM from 'vs/base/browser/dom';
|
||||
import { ActionsOrientation } from 'vs/base/browser/ui/actionbar/actionbar';
|
||||
@@ -30,7 +29,7 @@ import { errorForeground, listHoverBackground, textLinkForeground } from 'vs/pla
|
||||
import { ExecutionPlanViewHeader } from 'sql/workbench/contrib/executionPlan/browser/executionPlanViewHeader';
|
||||
import { attachSelectBoxStyler } from 'sql/platform/theme/common/styler';
|
||||
import { IProgressService, ProgressLocation } from 'vs/platform/progress/common/progress';
|
||||
|
||||
import { IAdsTelemetryService } from 'sql/platform/telemetry/common/telemetry';
|
||||
|
||||
export class ExecutionPlanComparisonEditorView {
|
||||
|
||||
@@ -105,9 +104,7 @@ export class ExecutionPlanComparisonEditorView {
|
||||
constructor(
|
||||
parentContainer: HTMLElement,
|
||||
@IInstantiationService private _instantiationService: IInstantiationService,
|
||||
@ITelemetryService telemetryService: ITelemetryService,
|
||||
@IThemeService private themeService: IThemeService,
|
||||
@IStorageService storageService: IStorageService,
|
||||
@IExecutionPlanService private _executionPlanService: IExecutionPlanService,
|
||||
@IFileDialogService private _fileDialogService: IFileDialogService,
|
||||
@IContextViewService readonly contextViewService: IContextViewService,
|
||||
@@ -131,11 +128,11 @@ export class ExecutionPlanComparisonEditorView {
|
||||
|
||||
});
|
||||
this._taskbar.context = this;
|
||||
this._addExecutionPlanAction = new AddExecutionPlanAction();
|
||||
this._addExecutionPlanAction = this._instantiationService.createInstance(AddExecutionPlanAction);
|
||||
this._zoomOutAction = new ZoomOutAction();
|
||||
this._zoomInAction = new ZoomInAction();
|
||||
this._zoomToFitAction = new ZoomToFitAction();
|
||||
this._propertiesAction = new PropertiesAction();
|
||||
this._propertiesAction = this._instantiationService.createInstance(PropertiesAction);
|
||||
this._toggleOrientationAction = new ToggleOrientation();
|
||||
this._resetZoomAction = new ZoomReset();
|
||||
const content: ITaskbarContent[] = [
|
||||
@@ -529,11 +526,16 @@ export class ExecutionPlanComparisonEditorView {
|
||||
class AddExecutionPlanAction extends Action {
|
||||
public static ID = 'ep.AddExecutionPlan';
|
||||
public static LABEL = localize('addExecutionPlanLabel', "Add execution plan");
|
||||
constructor() {
|
||||
|
||||
constructor(
|
||||
@IAdsTelemetryService private readonly telemetryService: IAdsTelemetryService
|
||||
) {
|
||||
super(AddExecutionPlanAction.ID, AddExecutionPlanAction.LABEL, addIconClassName);
|
||||
}
|
||||
|
||||
public override async run(context: ExecutionPlanComparisonEditorView): Promise<void> {
|
||||
this.telemetryService.sendActionEvent(TelemetryKeys.TelemetryView.ExecutionPlan, TelemetryKeys.TelemetryAction.AddExecutionPlan);
|
||||
|
||||
await context.openAndAddExecutionPlanFile();
|
||||
}
|
||||
|
||||
@@ -608,11 +610,19 @@ class ToggleOrientation extends Action {
|
||||
class PropertiesAction extends Action {
|
||||
public static ID = 'epCompare.comparePropertiesAction';
|
||||
public static LABEL = localize('epCompare.comparePropertiesAction', "Properties");
|
||||
constructor() {
|
||||
|
||||
constructor(
|
||||
@IAdsTelemetryService private readonly telemetryService: IAdsTelemetryService
|
||||
) {
|
||||
super(PropertiesAction.ID, PropertiesAction.LABEL, openPropertiesIconClassNames);
|
||||
this.enabled = false;
|
||||
}
|
||||
|
||||
public override async run(context: ExecutionPlanComparisonEditorView): Promise<void> {
|
||||
this.telemetryService
|
||||
.createActionEvent(TelemetryKeys.TelemetryView.ExecutionPlan, TelemetryKeys.TelemetryAction.ViewExecutionPlanComparisonProperties)
|
||||
.send();
|
||||
|
||||
context.togglePropertiesView();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -164,7 +164,7 @@ export class ExecutionPlanView implements ISashLayoutProvider {
|
||||
this._instantiationService.createInstance(ZoomToFitAction, 'ActionBar'),
|
||||
this._instantiationService.createInstance(CustomZoomAction, 'ActionBar'),
|
||||
this._instantiationService.createInstance(PropertiesAction, 'ActionBar'),
|
||||
new CompareExecutionPlanAction(),
|
||||
this._instantiationService.createInstance(CompareExecutionPlanAction, 'ActionBar'),
|
||||
this.actionBarToggleTopTip
|
||||
];
|
||||
this._actionBar.pushAction(actionBarActions, { icon: true, label: false });
|
||||
@@ -181,7 +181,7 @@ export class ExecutionPlanView implements ISashLayoutProvider {
|
||||
this._instantiationService.createInstance(ZoomToFitAction, 'ContextMenu'),
|
||||
this._instantiationService.createInstance(CustomZoomAction, 'ContextMenu'),
|
||||
this._instantiationService.createInstance(PropertiesAction, 'ContextMenu'),
|
||||
new CompareExecutionPlanAction(),
|
||||
this._instantiationService.createInstance(CompareExecutionPlanAction, 'ContextMenu'),
|
||||
this.contextMenuToggleTooltipAction
|
||||
];
|
||||
const self = this;
|
||||
@@ -530,11 +530,18 @@ export class CompareExecutionPlanAction extends Action {
|
||||
public static ID = 'ep.tooltipToggleContextMenu';
|
||||
public static COMPARE_PLAN = localize('executionPlanCompareExecutionPlanAction', "Compare execution plan");
|
||||
|
||||
constructor() {
|
||||
constructor(private source: ExecutionPlanActionSource,
|
||||
@IAdsTelemetryService private readonly telemetryService: IAdsTelemetryService
|
||||
) {
|
||||
super(CompareExecutionPlanAction.COMPARE_PLAN, CompareExecutionPlanAction.COMPARE_PLAN, executionPlanCompareIconClassName);
|
||||
}
|
||||
|
||||
public override async run(context: ExecutionPlanView): Promise<void> {
|
||||
this.telemetryService
|
||||
.createActionEvent(TelemetryKeys.TelemetryView.ExecutionPlan, TelemetryKeys.TelemetryAction.CompareExecutionPlan)
|
||||
.withAdditionalProperties({ source: this.source })
|
||||
.send();
|
||||
|
||||
context.compareCurrentExecutionPlan();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user