@@ -20,6 +20,7 @@ import { IFileSystem } from '../../common/platform/types';
20
20
import { IConfigurationService , IDisposableRegistry , IExperimentsManager } from '../../common/types' ;
21
21
import { createDeferred , Deferred } from '../../common/utils/async' ;
22
22
import * as localize from '../../common/utils/localize' ;
23
+ import { StopWatch } from '../../common/utils/stopWatch' ;
23
24
import { IInterpreterService , PythonInterpreter } from '../../interpreter/contracts' ;
24
25
import { captureTelemetry , sendTelemetryEvent } from '../../telemetry' ;
25
26
import { generateCellRangesFromDocument } from '../cellFactory' ;
@@ -78,6 +79,7 @@ import { InteractiveWindowMessageListener } from './interactiveWindowMessageList
78
79
export abstract class InteractiveBase extends WebViewHost < IInteractiveWindowMapping > implements IInteractiveBase {
79
80
private unfinishedCells : ICell [ ] = [ ] ;
80
81
private restartingKernel : boolean = false ;
82
+ private perceivedJupyterStartupTelemetryCaptured : boolean = false ;
81
83
private potentiallyUnfinishedStatus : Disposable [ ] = [ ] ;
82
84
private addSysInfoPromise : Deferred < boolean > | undefined ;
83
85
private _notebook : INotebook | undefined ;
@@ -457,8 +459,8 @@ export abstract class InteractiveBase extends WebViewHost<IInteractiveWindowMapp
457
459
// tslint:disable-next-line: max-func-body-length
458
460
protected async submitCode ( code : string , file : string , line : number , id ?: string , _editor ?: TextEditor , debug ?: boolean ) : Promise < boolean > {
459
461
traceInfo ( `Submitting code for ${ this . id } ` ) ;
462
+ const stopWatch = this . _notebook && ! this . perceivedJupyterStartupTelemetryCaptured ? new StopWatch ( ) : undefined ;
460
463
let result = true ;
461
-
462
464
// Do not execute or render empty code cells
463
465
const cellMatcher = new CellMatcher ( this . configService . getSettings ( ) . datascience ) ;
464
466
if ( cellMatcher . stripFirstMarker ( code ) . length === 0 ) {
@@ -511,7 +513,16 @@ export abstract class InteractiveBase extends WebViewHost<IInteractiveWindowMapp
511
513
if ( file !== Identifiers . EmptyFileName ) {
512
514
await this . _notebook . execute ( `__file__ = '${ file . replace ( / \\ / g, '\\\\' ) } '` , file , line , uuid ( ) , undefined , true ) ;
513
515
}
514
-
516
+ if ( stopWatch && ! this . perceivedJupyterStartupTelemetryCaptured ) {
517
+ this . perceivedJupyterStartupTelemetryCaptured = true ;
518
+ sendTelemetryEvent ( Telemetry . PerceivedJupyterStartupNotebook , stopWatch ?. elapsedTime ) ;
519
+ const disposable = this . _notebook . onSessionStatusChanged ( e => {
520
+ if ( e === ServerStatus . Busy ) {
521
+ sendTelemetryEvent ( Telemetry . StartExecuteNotebookCellPerceivedCold , stopWatch ?. elapsedTime ) ;
522
+ disposable . dispose ( ) ;
523
+ }
524
+ } ) ;
525
+ }
515
526
const observable = this . _notebook . executeObservable ( code , file , line , id , false ) ;
516
527
517
528
// Indicate we executed some code
0 commit comments