@@ -41,6 +41,7 @@ import { IFileSystem } from '../../common/platform/types';
4141import { IConfigurationService , IDisposableRegistry , IExperimentsManager } from '../../common/types' ;
4242import { createDeferred , Deferred } from '../../common/utils/async' ;
4343import * as localize from '../../common/utils/localize' ;
44+ import { StopWatch } from '../../common/utils/stopWatch' ;
4445import { IInterpreterService , PythonInterpreter } from '../../interpreter/contracts' ;
4546import { captureTelemetry , sendTelemetryEvent } from '../../telemetry' ;
4647import { generateCellRangesFromDocument } from '../cellFactory' ;
@@ -101,6 +102,7 @@ import { InteractiveWindowMessageListener } from './interactiveWindowMessageList
101102export abstract class InteractiveBase extends WebViewHost < IInteractiveWindowMapping > implements IInteractiveBase {
102103 private unfinishedCells : ICell [ ] = [ ] ;
103104 private restartingKernel : boolean = false ;
105+ private perceivedJupyterStartupTelemetryCaptured : boolean = false ;
104106 private potentiallyUnfinishedStatus : Disposable [ ] = [ ] ;
105107 private addSysInfoPromise : Deferred < boolean > | undefined ;
106108 private _notebook : INotebook | undefined ;
@@ -500,8 +502,9 @@ export abstract class InteractiveBase extends WebViewHost<IInteractiveWindowMapp
500502 debug ?: boolean
501503 ) : Promise < boolean > {
502504 traceInfo ( `Submitting code for ${ this . id } ` ) ;
505+ const stopWatch =
506+ this . _notebook && ! this . perceivedJupyterStartupTelemetryCaptured ? new StopWatch ( ) : undefined ;
503507 let result = true ;
504-
505508 // Do not execute or render empty code cells
506509 const cellMatcher = new CellMatcher ( this . configService . getSettings ( ) . datascience ) ;
507510 if ( cellMatcher . stripFirstMarker ( code ) . length === 0 ) {
@@ -568,7 +571,16 @@ export abstract class InteractiveBase extends WebViewHost<IInteractiveWindowMapp
568571 true
569572 ) ;
570573 }
571-
574+ if ( stopWatch && ! this . perceivedJupyterStartupTelemetryCaptured ) {
575+ this . perceivedJupyterStartupTelemetryCaptured = true ;
576+ sendTelemetryEvent ( Telemetry . PerceivedJupyterStartupNotebook , stopWatch ?. elapsedTime ) ;
577+ const disposable = this . _notebook . onSessionStatusChanged ( e => {
578+ if ( e === ServerStatus . Busy ) {
579+ sendTelemetryEvent ( Telemetry . StartExecuteNotebookCellPerceivedCold , stopWatch ?. elapsedTime ) ;
580+ disposable . dispose ( ) ;
581+ }
582+ } ) ;
583+ }
572584 const observable = this . _notebook . executeObservable ( code , file , line , id , false ) ;
573585
574586 // Indicate we executed some code
0 commit comments