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

@@ -28,6 +28,8 @@ import { ICommandService } from 'vs/platform/commands/common/commands';
import { tryMatchCellMagic, extractCellMagicCommandPlusArgs } from 'sql/workbench/services/notebook/browser/utils';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { Disposable } from 'vs/base/common/lifecycle';
import * as TelemetryKeys from 'sql/platform/telemetry/common/telemetryKeys';
import { IAdsTelemetryService } from 'sql/platform/telemetry/common/telemetry';
let modelId = 0;
const ads_execute_command = 'ads_execute_command';
@@ -83,7 +85,8 @@ export class CellModel extends Disposable implements ICellModel {
private _options: ICellModelOptions,
@optional(INotebookService) private _notebookService?: INotebookService,
@optional(ICommandService) private _commandService?: ICommandService,
@optional(IConfigurationService) private _configurationService?: IConfigurationService
@optional(IConfigurationService) private _configurationService?: IConfigurationService,
@optional(IAdsTelemetryService) private _telemetryService?: IAdsTelemetryService,
) {
super();
this.id = `${modelId++}`;
@@ -483,6 +486,9 @@ export class CellModel extends Disposable implements ICellModel {
if (!kernel) {
return false;
}
this._telemetryService?.createActionEvent(TelemetryKeys.TelemetryView.Notebook, TelemetryKeys.NbTelemetryAction.RunCell)
.withAdditionalProperties({ cell_language: kernel.name })
.send();
// If cell is currently running and user clicks the stop/cancel button, call kernel.interrupt()
// This matches the same behavior as JupyterLab
if (this.future && this.future.inProgress) {