Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/client/datascience/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ export enum Telemetry {
NotebookOpenTime = 'DS_INTERNAL.NATIVE.NOTEBOOK_OPEN_TIME',
SessionIdleTimeout = 'DATASCIENCE.JUPYTER_IDLE_TIMEOUT',
JupyterNotInstalledErrorShown = 'DATASCIENCE.JUPYTER_NOT_INSTALLED_ERROR_SHOWN',
JupyterCommandSearch = 'DATASCIENCE.JUPYTER_COMMAND_SEARCH',
UserInstalledJupyter = 'DATASCIENCE.USER_INSTALLED_JUPYTER',
UserDidNotInstallJupyter = 'DATASCIENCE.USER_DID_NOT_INSTALL_JUPYTER'
}
Expand Down
17 changes: 14 additions & 3 deletions src/client/datascience/interactive-window/interactiveWindow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
} from '../../common/application/types';
import { ContextKey } from '../../common/contextKey';
import { IFileSystem } from '../../common/platform/types';
import { IConfigurationService, IDisposableRegistry } from '../../common/types';
import { IConfigurationService, IDisposableRegistry, IPersistentStateFactory } from '../../common/types';
import * as localize from '../../common/utils/localize';
import { EXTENSION_ROOT_DIR } from '../../constants';
import { IInterpreterService } from '../../interpreter/contracts';
Expand Down Expand Up @@ -48,6 +48,7 @@ import {
export class InteractiveWindow extends InteractiveBase implements IInteractiveWindow {
private closedEvent: EventEmitter<IInteractiveWindow> = new EventEmitter<IInteractiveWindow>();
private waitingForExportCells: boolean = false;
private trackedJupyterStart: boolean = false;

constructor(
@multiInject(IInteractiveWindowListener) listeners: IInteractiveWindowListener[],
Expand All @@ -71,7 +72,8 @@ export class InteractiveWindow extends InteractiveBase implements IInteractiveWi
@inject(IJupyterVariables) jupyterVariables: IJupyterVariables,
@inject(IJupyterDebugger) jupyterDebugger: IJupyterDebugger,
@inject(INotebookEditorProvider) editorProvider: INotebookEditorProvider,
@inject(IDataScienceErrorHandler) errorHandler: IDataScienceErrorHandler
@inject(IDataScienceErrorHandler) errorHandler: IDataScienceErrorHandler,
@inject(IPersistentStateFactory) private readonly stateFactory: IPersistentStateFactory
) {
super(
listeners,
Expand Down Expand Up @@ -251,7 +253,16 @@ export class InteractiveWindow extends InteractiveBase implements IInteractiveWi
protected async closeBecauseOfFailure(_exc: Error): Promise<void> {
this.dispose();
}

protected startServer(): Promise<void> {
// Keep track of users who have used interactive window in a worksapce folder.
// To be used if/when changing workflows related to startup of jupyter.
if (!this.trackedJupyterStart){
this.trackedJupyterStart = true;
const store = this.stateFactory.createGlobalPersistentState('INTERACTIVE_WINDOW_USED', false);
store.updateValue(true).ignoreErrors();
}
return super.startServer();
}
@captureTelemetry(Telemetry.ExportNotebook, undefined, false)
// tslint:disable-next-line: no-any no-empty
private export(cells: ICell[]) {
Expand Down
20 changes: 18 additions & 2 deletions src/client/datascience/jupyter/jupyterCommandFinder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ export class JupyterCommandFinder {

// First we look in the current interpreter
const current = await this.interpreterService.getActiveInterpreter();

const stopWatch = new StopWatch();
if (isCommandFinderCancelled(command, cancelToken)) {
return cancelledResult;
}
Expand All @@ -220,6 +220,8 @@ export class JupyterCommandFinder {

// Save our error information. This should propagate out as the error information for the command
firstError = found.error;
} else {
this.sendSearchTelemetry(command, 'activeInterpreter', stopWatch.elapsedTime, cancelToken);
}

// Display a progress message when searching, as this could take a while.
Expand All @@ -244,6 +246,11 @@ export class JupyterCommandFinder {
if (found.status === ModuleExistsStatus.NotFound) {
progress.report({ message: localize.DataScience.findJupyterCommandProgressSearchCurrentPath() });
found = await this.findPathCommand(command, cancelToken);
if (found.status !== ModuleExistsStatus.NotFound){
this.sendSearchTelemetry(command, 'path', stopWatch.elapsedTime, cancelToken);
}
} else {
this.sendSearchTelemetry(command, 'otherInterpreter', stopWatch.elapsedTime, cancelToken);
}

return found;
Expand All @@ -256,9 +263,18 @@ export class JupyterCommandFinder {
found.error = firstError;
}

if (found.status === ModuleExistsStatus.NotFound){
this.sendSearchTelemetry(command, 'nowhere', stopWatch.elapsedTime, cancelToken);
}

return found;
}

private sendSearchTelemetry(command: JupyterCommands, where: 'activeInterpreter' | 'otherInterpreter' | 'path' | 'nowhere', elapsedTime: number, cancelToken?: CancellationToken){
if (Cancellation.isCanceled(cancelToken)){
return;
}
sendTelemetryEvent(Telemetry.JupyterCommandSearch, elapsedTime, {where, command});
}
private async searchOtherInterpretersForCommand(
command: JupyterCommands,
progress: ProgressNotification,
Expand Down
3 changes: 2 additions & 1 deletion src/client/telemetry/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { AppinsightsKey, EXTENSION_ROOT_DIR, isTestExecution, PVSC_EXTENSION_ID
import { traceInfo } from '../common/logger';
import { TerminalShellType } from '../common/terminal/types';
import { StopWatch } from '../common/utils/stopWatch';
import { NativeKeyboardCommandTelemetry, NativeMouseCommandTelemetry, Telemetry } from '../datascience/constants';
import { JupyterCommands, NativeKeyboardCommandTelemetry, NativeMouseCommandTelemetry, Telemetry } from '../datascience/constants';
import { DebugConfigurationType } from '../debugger/extension/types';
import { ConsoleType, TriggerType } from '../debugger/types';
import { AutoSelectionRule } from '../interpreter/autoSelection/types';
Expand Down Expand Up @@ -1433,6 +1433,7 @@ export interface IEventNamePropertyMapping {
[Telemetry.SelectJupyterURI]: never | undefined;
[Telemetry.SessionIdleTimeout]: never | undefined;
[Telemetry.JupyterNotInstalledErrorShown]: never | undefined;
[Telemetry.JupyterCommandSearch]: { where: 'activeInterpreter' | 'otherInterpreter' | 'path' | 'nowhere'; command: JupyterCommands };
[Telemetry.UserInstalledJupyter]: never | undefined;
[Telemetry.UserDidNotInstallJupyter]: never | undefined;
[Telemetry.SetJupyterURIToLocal]: never | undefined;
Expand Down