@@ -34,8 +34,9 @@ if (!global.fetch) {
3434
3535const FIRST_INSTALL_KEY = 'gitpod-desktop.firstInstall' ;
3636
37- let telemetryService : TelemetryService ;
37+ let telemetryService : TelemetryService | undefined ;
3838let remoteSession : RemoteSession | undefined ;
39+ let logger : vscode . LogOutputChannel | undefined ;
3940
4041export async function activate ( context : vscode . ExtensionContext ) {
4142 const extensionId = context . extension . id ;
@@ -47,18 +48,18 @@ export async function activate(context: vscode.ExtensionContext) {
4748 // sync between machines
4849 context . globalState . setKeysForSync ( [ ReleaseNotes . RELEASE_NOTES_LAST_READ_KEY ] ) ;
4950
50- const logger = vscode . window . createOutputChannel ( 'Gitpod' , { log : true } ) ;
51+ logger = vscode . window . createOutputChannel ( 'Gitpod' , { log : true } ) ;
5152 context . subscriptions . push ( logger ) ;
5253
5354 const onDidChangeLogLevel = ( logLevel : vscode . LogLevel ) => {
54- logger . info ( `Log level: ${ vscode . LogLevel [ logLevel ] } ` ) ;
55+ logger ! . info ( `Log level: ${ vscode . LogLevel [ logLevel ] } ` ) ;
5556 } ;
56- context . subscriptions . push ( logger . onDidChangeLogLevel ( onDidChangeLogLevel ) ) ;
57- onDidChangeLogLevel ( logger . logLevel ) ;
57+ context . subscriptions . push ( logger ! . onDidChangeLogLevel ( onDidChangeLogLevel ) ) ;
58+ onDidChangeLogLevel ( logger ! . logLevel ) ;
5859
5960 logger . info ( `${ extensionId } /${ packageJSON . version } (${ os . release ( ) } ${ os . platform ( ) } ${ os . arch ( ) } ) vscode/${ vscode . version } (${ vscode . env . appName } )` ) ;
6061
61- telemetryService = new TelemetryService ( extensionId , packageJSON . version , packageJSON . segmentKey ) ;
62+ telemetryService = new TelemetryService ( extensionId , packageJSON . version , packageJSON . segmentKey , logger ! ) ;
6263
6364 const notificationService = new NotificationService ( telemetryService ) ;
6465
@@ -112,11 +113,11 @@ export async function activate(context: vscode.ExtensionContext) {
112113 if ( remoteConnectionInfo ) {
113114 commandManager . register ( { id : 'gitpod.api.autoTunnel' , execute : ( ) => remoteConnector . autoTunnelCommand } ) ;
114115
115- remoteSession = new RemoteSession ( remoteConnectionInfo . remoteAuthority , remoteConnectionInfo . connectionInfo , context , hostService , sessionService , settingsSync , experiments , logger , telemetryService , notificationService ) ;
116+ remoteSession = new RemoteSession ( remoteConnectionInfo . remoteAuthority , remoteConnectionInfo . connectionInfo , context , hostService , sessionService , settingsSync , experiments , logger ! , telemetryService ! , notificationService ) ;
116117 await remoteSession . initialize ( ) ;
117118 } else if ( sessionService . isSignedIn ( ) ) {
118119 const restartFlow = { flow : 'restart_workspace' , userId : sessionService . getUserId ( ) } ;
119- checkForStoppedWorkspaces ( context , hostService . gitpodHost , restartFlow , notificationService , logger ) ;
120+ checkForStoppedWorkspaces ( context , hostService . gitpodHost , restartFlow , notificationService , logger ! ) ;
120121 }
121122 } ) ;
122123
@@ -125,15 +126,17 @@ export async function activate(context: vscode.ExtensionContext) {
125126 telemetryService ?. sendTelemetryException ( e ) ;
126127 throw e ;
127128 } finally {
128- telemetryService ?. sendTelemetryEvent ( 'vscode_desktop_activate' , {
129+ const activateProperties = {
129130 remoteName : vscode . env . remoteName || '' ,
130131 remoteUri : String ( ! ! ( vscode . workspace . workspaceFile || vscode . workspace . workspaceFolders ?. [ 0 ] . uri ) ) ,
131132 workspaceId : remoteConnectionInfo ?. connectionInfo . workspaceId || '' ,
132133 instanceId : remoteConnectionInfo ?. connectionInfo . instanceId || '' ,
133134 gitpodHost : remoteConnectionInfo ?. connectionInfo . gitpodHost || '' ,
134135 debugWorkspace : remoteConnectionInfo ? String ( ! ! remoteConnectionInfo . connectionInfo . debugWorkspace ) : '' ,
135136 success : String ( success )
136- } ) ;
137+ } ;
138+ logger ?. info ( 'Activation properties:' , JSON . stringify ( activateProperties , undefined , 2 ) ) ;
139+ telemetryService ?. sendTelemetryEvent ( 'vscode_desktop_activate' , activateProperties ) ;
137140 }
138141}
139142
0 commit comments