Add Notebook telemetry events (#19848)

* add telemetry events

* remove error message in telemetry
This commit is contained in:
Lucy Zhang
2022-07-01 09:14:29 -07:00
committed by GitHub
parent 179f9e8270
commit 4ec2d78269
5 changed files with 12 additions and 3 deletions

View File

@@ -20,6 +20,7 @@ import { IconPathHelper } from './common/iconHelper';
import { ExtensionContextHelper } from './common/extensionContextHelper'; import { ExtensionContextHelper } from './common/extensionContextHelper';
import { BookTreeItem } from './book/bookTreeItem'; import { BookTreeItem } from './book/bookTreeItem';
import Logger from './common/logger'; import Logger from './common/logger';
import { TelemetryReporter, BookTelemetryView, NbTelemetryActions } from './telemetry';
const localize = nls.loadMessageBundle(); const localize = nls.loadMessageBundle();
@@ -80,6 +81,7 @@ export async function activate(extensionContext: vscode.ExtensionContext): Promi
extensionContext.subscriptions.push(vscode.commands.registerCommand('notebook.command.openRemoteBook', async () => { extensionContext.subscriptions.push(vscode.commands.registerCommand('notebook.command.openRemoteBook', async () => {
let dialog = new RemoteBookDialog(remoteBookController); let dialog = new RemoteBookDialog(remoteBookController);
TelemetryReporter.sendActionEvent(BookTelemetryView, NbTelemetryActions.AddRemoteBook);
return dialog.createDialog(); return dialog.createDialog();
})); }));

View File

@@ -21,6 +21,7 @@ export enum NbTelemetryActions {
PinNotebook = 'NotebookPinned', PinNotebook = 'NotebookPinned',
OpenNotebookFromBook = 'NotebookOpenedFromBook', OpenNotebookFromBook = 'NotebookOpenedFromBook',
MoveNotebook = 'MoveNotebook', MoveNotebook = 'MoveNotebook',
DragAndDrop = 'DragAndDrop' DragAndDrop = 'DragAndDrop',
AddRemoteBook = 'AddRemoteBook'
} }

View File

@@ -121,7 +121,9 @@ export const enum NbTelemetryAction {
NewNotebookFromConnections = 'NewNotebookWithConnectionProfile', NewNotebookFromConnections = 'NewNotebookWithConnectionProfile',
UndoCell = 'UndoCell', UndoCell = 'UndoCell',
RedoCell = 'RedoCell', RedoCell = 'RedoCell',
MIMETypeRendererNotFound = 'MIMETypeRendererNotFound' MoveCell = 'MoveCell',
MIMETypeRendererNotFound = 'MIMETypeRendererNotFound',
CellExecutionFailed = 'CellExecutionFailed'
} }
export const enum TelemetryPropertyName { export const enum TelemetryPropertyName {

View File

@@ -18,6 +18,7 @@ import { INotebookService } from 'sql/workbench/services/notebook/browser/notebo
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView'; import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent'; import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
import { CellEditModes, MoveDirection } from 'sql/workbench/services/notebook/browser/models/modelInterfaces'; import { CellEditModes, MoveDirection } from 'sql/workbench/services/notebook/browser/models/modelInterfaces';
import * as TelemetryKeys from 'sql/platform/telemetry/common/telemetryKeys';
const moreActionsLabel = localize('moreActionsLabel', "More"); const moreActionsLabel = localize('moreActionsLabel', "More");
export class EditCellAction extends ToggleableAction { export class EditCellAction extends ToggleableAction {
@@ -105,6 +106,7 @@ export class MoveCellAction extends CellActionBase {
let moveDirection = this._cssClass.includes('move-down') ? MoveDirection.Down : MoveDirection.Up; let moveDirection = this._cssClass.includes('move-down') ? MoveDirection.Down : MoveDirection.Up;
try { try {
context.model.moveCell(context.cell, moveDirection); context.model.moveCell(context.cell, moveDirection);
context.model.sendNotebookTelemetryActionEvent(TelemetryKeys.NbTelemetryAction.MoveCell, { moveDirection: moveDirection });
} catch (error) { } catch (error) {
let message = getErrorMessage(error); let message = getErrorMessage(error);

View File

@@ -602,6 +602,7 @@ export class CellModel extends Disposable implements ICellModel {
} }
public async runCell(notificationService?: INotificationService, connectionManagementService?: IConnectionManagementService): Promise<boolean> { public async runCell(notificationService?: INotificationService, connectionManagementService?: IConnectionManagementService): Promise<boolean> {
let kernel: nb.IKernel | undefined;
try { try {
// Allow screen reader to announce when cell execution is started // Allow screen reader to announce when cell execution is started
alert(localize('cellExecutionStarted', "Cell execution started")); alert(localize('cellExecutionStarted', "Cell execution started"));
@@ -618,7 +619,7 @@ export class CellModel extends Disposable implements ICellModel {
// for this property // for this property
return false; return false;
} }
let kernel = await this.getOrStartKernel(notificationService); kernel = await this.getOrStartKernel(notificationService);
if (!kernel) { if (!kernel) {
return false; return false;
} }
@@ -705,6 +706,7 @@ export class CellModel extends Disposable implements ICellModel {
} else { } else {
message = getErrorMessage(error); message = getErrorMessage(error);
} }
this.notebookModel.sendNotebookTelemetryActionEvent(TelemetryKeys.NbTelemetryAction.CellExecutionFailed, { kernel: kernel, reason: error.message === 'Canceled' ? 'Canceled' : 'Other' });
this.sendNotification(notificationService, Severity.Error, message); this.sendNotification(notificationService, Severity.Error, message);
// TODO track error state for the cell // TODO track error state for the cell
} finally { } finally {