Notebook Telemetry initial changes (#13929)

* initial changes

* add ads-telemetry to nb extension

* add aiKey to notebook extension

* add run cell telemetry in cellmodel

* add NbTelemetryAction

* remove source

* remove telemtery for run notebook for now

* fix optional variable call

* addr comments

* changing the dependency package

* revert

* removed webpack config for telemetry compat

* add opentelemetry to externals

Co-authored-by: Benjin Dubishar <benjin.dubishar@gmail.com>
This commit is contained in:
Maddy
2021-01-25 09:42:37 -08:00
committed by GitHub
parent d059032dee
commit 5be2e01632
7 changed files with 134 additions and 3 deletions

View File

@@ -20,6 +20,7 @@ import { IJupyterBookSectionV2, IJupyterBookSectionV1 } from '../contracts/conte
import { debounce, getPinnedNotebooks } from '../common/utils';
import { IBookPinManager, BookPinManager } from './bookPinManager';
import { BookTocManager, IBookTocManager } from './bookTocManager';
import { TelemetryReporter, BookTelemetryView, NbTelemetryActions } from '../telemetry';
const content = 'content';
@@ -107,6 +108,7 @@ export class BookTreeViewProvider implements vscode.TreeDataProvider<BookTreeIte
}
});
}
TelemetryReporter.createActionEvent(BookTelemetryView, NbTelemetryActions.TrustNotebook).send();
vscode.window.showInformationMessage(loc.msgBookTrusted);
} else {
vscode.window.showInformationMessage(loc.msgBookAlreadyTrusted);
@@ -118,6 +120,7 @@ export class BookTreeViewProvider implements vscode.TreeDataProvider<BookTreeIte
let bookPathToUpdate = bookTreeItem.book?.contentPath;
if (bookPathToUpdate) {
let pinStatusChanged = await this.bookPinManager.pinNotebook(bookTreeItem);
TelemetryReporter.createActionEvent(BookTelemetryView, NbTelemetryActions.PinNotebook).send();
if (pinStatusChanged) {
bookTreeItem.contextValue = 'pinnedNotebook';
}
@@ -138,6 +141,7 @@ export class BookTreeViewProvider implements vscode.TreeDataProvider<BookTreeIte
bookPath = path.normalize(bookPath);
contentPath = path.normalize(contentPath);
await this.bookTocManager.createBook(bookPath, contentPath);
TelemetryReporter.createActionEvent(BookTelemetryView, NbTelemetryActions.CreateBook).send();
}
async editBook(book: BookTreeItem, section: BookTreeItem): Promise<void> {
@@ -163,6 +167,7 @@ export class BookTreeViewProvider implements vscode.TreeDataProvider<BookTreeIte
await this.showPreviewFile(urlToOpen);
}
TelemetryReporter.createActionEvent(BookTelemetryView, NbTelemetryActions.OpenBook).send();
// add file watcher on toc file.
if (!isNotebook) {
fs.watchFile(this.currentBook.tableOfContentsPath, async (curr, prev) => {
@@ -215,6 +220,7 @@ export class BookTreeViewProvider implements vscode.TreeDataProvider<BookTreeIte
}
this._onDidChangeTreeData.fire(undefined);
}
TelemetryReporter.createActionEvent(BookTelemetryView, NbTelemetryActions.CloseBook).send();
} catch (e) {
vscode.window.showErrorMessage(loc.closeBookError(book.root, e instanceof Error ? e.message : e));
} finally {
@@ -307,6 +313,7 @@ export class BookTreeViewProvider implements vscode.TreeDataProvider<BookTreeIte
this._visitedNotebooks = this._visitedNotebooks.concat([normalizedResource]);
}
}
TelemetryReporter.createActionEvent(BookTelemetryView, NbTelemetryActions.OpenNotebookFromBook);
} catch (e) {
vscode.window.showErrorMessage(loc.openNotebookError(resource, e instanceof Error ? e.message : e));
}