@@ -34,8 +34,9 @@ if (!global.fetch) {
34
34
35
35
const FIRST_INSTALL_KEY = 'gitpod-desktop.firstInstall' ;
36
36
37
- let telemetryService : TelemetryService ;
37
+ let telemetryService : TelemetryService | undefined ;
38
38
let remoteSession : RemoteSession | undefined ;
39
+ let logger : vscode . LogOutputChannel | undefined ;
39
40
40
41
export async function activate ( context : vscode . ExtensionContext ) {
41
42
const extensionId = context . extension . id ;
@@ -47,18 +48,18 @@ export async function activate(context: vscode.ExtensionContext) {
47
48
// sync between machines
48
49
context . globalState . setKeysForSync ( [ ReleaseNotes . RELEASE_NOTES_LAST_READ_KEY ] ) ;
49
50
50
- const logger = vscode . window . createOutputChannel ( 'Gitpod' , { log : true } ) ;
51
+ logger = vscode . window . createOutputChannel ( 'Gitpod' , { log : true } ) ;
51
52
context . subscriptions . push ( logger ) ;
52
53
53
54
const onDidChangeLogLevel = ( logLevel : vscode . LogLevel ) => {
54
- logger . info ( `Log level: ${ vscode . LogLevel [ logLevel ] } ` ) ;
55
+ logger ! . info ( `Log level: ${ vscode . LogLevel [ logLevel ] } ` ) ;
55
56
} ;
56
- context . subscriptions . push ( logger . onDidChangeLogLevel ( onDidChangeLogLevel ) ) ;
57
- onDidChangeLogLevel ( logger . logLevel ) ;
57
+ context . subscriptions . push ( logger ! . onDidChangeLogLevel ( onDidChangeLogLevel ) ) ;
58
+ onDidChangeLogLevel ( logger ! . logLevel ) ;
58
59
59
60
logger . info ( `${ extensionId } /${ packageJSON . version } (${ os . release ( ) } ${ os . platform ( ) } ${ os . arch ( ) } ) vscode/${ vscode . version } (${ vscode . env . appName } )` ) ;
60
61
61
- telemetryService = new TelemetryService ( extensionId , packageJSON . version , packageJSON . segmentKey ) ;
62
+ telemetryService = new TelemetryService ( extensionId , packageJSON . version , packageJSON . segmentKey , logger ! ) ;
62
63
63
64
const notificationService = new NotificationService ( telemetryService ) ;
64
65
@@ -112,11 +113,11 @@ export async function activate(context: vscode.ExtensionContext) {
112
113
if ( remoteConnectionInfo ) {
113
114
commandManager . register ( { id : 'gitpod.api.autoTunnel' , execute : ( ) => remoteConnector . autoTunnelCommand } ) ;
114
115
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 ) ;
116
117
await remoteSession . initialize ( ) ;
117
118
} else if ( sessionService . isSignedIn ( ) ) {
118
119
const restartFlow = { flow : 'restart_workspace' , userId : sessionService . getUserId ( ) } ;
119
- checkForStoppedWorkspaces ( context , hostService . gitpodHost , restartFlow , notificationService , logger ) ;
120
+ checkForStoppedWorkspaces ( context , hostService . gitpodHost , restartFlow , notificationService , logger ! ) ;
120
121
}
121
122
} ) ;
122
123
@@ -125,15 +126,17 @@ export async function activate(context: vscode.ExtensionContext) {
125
126
telemetryService ?. sendTelemetryException ( e ) ;
126
127
throw e ;
127
128
} finally {
128
- telemetryService ?. sendTelemetryEvent ( 'vscode_desktop_activate' , {
129
+ const activateProperties = {
129
130
remoteName : vscode . env . remoteName || '' ,
130
131
remoteUri : String ( ! ! ( vscode . workspace . workspaceFile || vscode . workspace . workspaceFolders ?. [ 0 ] . uri ) ) ,
131
132
workspaceId : remoteConnectionInfo ?. connectionInfo . workspaceId || '' ,
132
133
instanceId : remoteConnectionInfo ?. connectionInfo . instanceId || '' ,
133
134
gitpodHost : remoteConnectionInfo ?. connectionInfo . gitpodHost || '' ,
134
135
debugWorkspace : remoteConnectionInfo ? String ( ! ! remoteConnectionInfo . connectionInfo . debugWorkspace ) : '' ,
135
136
success : String ( success )
136
- } ) ;
137
+ } ;
138
+ logger ?. info ( 'Activation properties:' , JSON . stringify ( activateProperties , undefined , 2 ) ) ;
139
+ telemetryService ?. sendTelemetryEvent ( 'vscode_desktop_activate' , activateProperties ) ;
137
140
}
138
141
}
139
142
0 commit comments