Skip to content

Commit

Permalink
Fire telemetry when REPLs are launched via shift+enter (#23944)
Browse files Browse the repository at this point in the history
Related to #23740
In addition to : #23941 

Fire telemetry for when REPL is launched via shift+enter. 
/cc @cwebster-99
  • Loading branch information
anthonykim1 authored Aug 13, 2024
1 parent c13bb07 commit b872cb4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/client/repl/nativeRepl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import { PythonEnvironment } from '../pythonEnvironments/info';
import { createPythonServer, PythonServer } from './pythonServer';
import { executeNotebookCell, openInteractiveREPL, selectNotebookKernel } from './replCommandHandler';
import { createReplController } from './replController';
import { EventName } from '../telemetry/constants';
import { sendTelemetryEvent } from '../telemetry';

export class NativeRepl implements Disposable {
// Adding ! since it will get initialized in create method, not the constructor.
Expand Down Expand Up @@ -159,6 +161,7 @@ let nativeRepl: NativeRepl | undefined; // In multi REPL scenario, hashmap of UR
*/
export async function getNativeRepl(interpreter: PythonEnvironment, disposables: Disposable[]): Promise<NativeRepl> {
if (!nativeRepl) {
sendTelemetryEvent(EventName.REPL, undefined, { replType: 'Native' });
nativeRepl = await NativeRepl.create(interpreter);
disposables.push(nativeRepl);
}
Expand Down
4 changes: 3 additions & 1 deletion src/client/terminals/codeExecution/terminalCodeExecution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import { IInterpreterService } from '../../interpreter/contracts';
import { traceInfo } from '../../logging';
import { buildPythonExecInfo, PythonExecInfo } from '../../pythonEnvironments/exec';
import { ICodeExecutionService } from '../../terminals/types';
import { EventName } from '../../telemetry/constants';
import { sendTelemetryEvent } from '../../telemetry';

@injectable()
export class TerminalCodeExecutionProvider implements ICodeExecutionService {
Expand Down Expand Up @@ -67,7 +69,7 @@ export class TerminalCodeExecutionProvider implements ICodeExecutionService {
await terminalService.show();
return;
}

sendTelemetryEvent(EventName.REPL, undefined, { replType: 'Terminal' });
this.replActive = new Promise<boolean>(async (resolve) => {
const replCommandArgs = await this.getExecutableInfo(resource);
let listener: IDisposable;
Expand Down

0 comments on commit b872cb4

Please sign in to comment.