Add guids to RunAll and RunCell events (#17123)

Add guids to RunAll and RunCell events
This commit is contained in:
Daniel Grajeda
2021-09-21 21:56:46 -06:00
committed by GitHub
parent 0e4c67dc0c
commit 4a715e473a
3 changed files with 12 additions and 2 deletions

View File

@@ -375,8 +375,13 @@ export class RunAllCellsAction extends Action {
}
public override async run(context: URI): Promise<void> {
try {
this._telemetryService.sendActionEvent(TelemetryKeys.TelemetryView.Notebook, TelemetryKeys.NbTelemetryAction.RunAll);
const editor = this._notebookService.findNotebookEditor(context);
const azdata_notebook_guid: string = editor.model.getMetaValue('azdata_notebook_guid');
this._telemetryService.createActionEvent(TelemetryKeys.TelemetryView.Notebook, TelemetryKeys.NbTelemetryAction.RunAll)
.withAdditionalProperties({ azdata_notebook_guid })
.send();
await editor.runAllCells();
} catch (e) {
this.notificationService.error(getErrorMessage(e));

View File

@@ -189,6 +189,10 @@ suite('Notebook Actions', function (): void {
});
test('Run All Cells Action', async function (): Promise<void> {
const testNotebookModel = TypeMoq.Mock.ofType<INotebookModel>(NotebookModelStub);
testNotebookModel.setup(x => x.getMetaValue(TypeMoq.It.isAny())).returns(() => undefined);
mockNotebookEditor.setup(x => x.model).returns(() => testNotebookModel.object);
let mockNotification = TypeMoq.Mock.ofType<INotificationService>(TestNotificationService);
mockNotification.setup(n => n.notify(TypeMoq.It.isAny()));