@@ -20,9 +20,8 @@ import { canExtensionServiceServerWork } from '../local-ssh/ipc/extensionService
2020
2121export interface ILocalSSHService {
2222 flow ?: UserFlowTelemetryProperties ;
23- isSupportLocalSSH : boolean ;
2423
25- initialize : ( ) => Promise < void > ;
24+ initialize : ( ) => Promise < boolean > ;
2625 extensionServerReady : ( ) => Promise < boolean > ;
2726}
2827
@@ -32,9 +31,8 @@ type FailedToInitializeCode = 'Unknown' | 'LockFailed' | string;
3231const IgnoredFailedCodes : FailedToInitializeCode [ ] = [ 'ENOSPC' ] ;
3332
3433export class LocalSSHService extends Disposable implements ILocalSSHService {
35- private initPromise ! : Promise < void > ;
34+ private initPromise ! : Promise < boolean > ;
3635
37- public isSupportLocalSSH : boolean = false ;
3836 public flow ?: UserFlowTelemetryProperties ;
3937
4038 constructor (
@@ -47,7 +45,7 @@ export class LocalSSHService extends Disposable implements ILocalSSHService {
4745 super ( ) ;
4846 }
4947
50- async initialize ( ) : Promise < void > {
48+ async initialize ( ) : Promise < boolean > {
5149 if ( this . initPromise ) {
5250 return this . initPromise ;
5351 }
@@ -99,20 +97,23 @@ export class LocalSSHService extends Disposable implements ILocalSSHService {
9997 }
10098 }
10199
102- private async doInitialize ( ) {
103- let failureCode : FailedToInitializeCode | undefined ;
100+ private async doInitialize ( ) : Promise < boolean > {
101+ let flowData = this . flow ?? { gitpodHost : this . hostService . gitpodHost , userId : this . sessionService . safeGetUserId ( ) } ;
102+ flowData = { ...flowData , flow : 'local_ssh_config' , useLocalAPP : String ( Configuration . getUseLocalApp ( ) ) } ;
104103 try {
105104 const lockFolder = vscode . Uri . joinPath ( this . context . globalStorageUri , 'initialize' ) ;
106105 await this . lock ( lockFolder . fsPath , async ( ) => {
107106 const locations = await this . copyProxyScript ( ) ;
108107 await this . configureSettings ( locations ) ;
109- this . isSupportLocalSSH = true ;
110108 } ) ;
109+
110+ this . telemetryService . sendUserFlowStatus ( 'success' , flowData ) ;
111+ return true ;
111112 } catch ( e ) {
112113 this . logService . error ( 'Failed to initialize ssh proxy config' , e ) ;
113114
114115 let sendErrorReport = true ;
115- failureCode = 'Unknown' ;
116+ let failureCode : FailedToInitializeCode = 'Unknown' ;
116117 if ( e ?. code ) {
117118 failureCode = e . code ;
118119 sendErrorReport = ! IgnoredFailedCodes . includes ( e . code ) ;
@@ -123,11 +124,10 @@ export class LocalSSHService extends Disposable implements ILocalSSHService {
123124 if ( sendErrorReport ) {
124125 this . telemetryService . sendTelemetryException ( e , { gitpodHost : this . hostService . gitpodHost , useLocalAPP : String ( Configuration . getUseLocalApp ( ) ) } ) ;
125126 }
126- this . isSupportLocalSSH = false ;
127- }
128127
129- const flowData = this . flow ?? { gitpodHost : this . hostService . gitpodHost , userId : this . sessionService . safeGetUserId ( ) } ;
130- this . telemetryService . sendUserFlowStatus ( this . isSupportLocalSSH ? 'success' : 'failure' , { ...flowData , flow : 'local_ssh_config' , failureCode, useLocalAPP : String ( Configuration . getUseLocalApp ( ) ) } ) ;
128+ this . telemetryService . sendUserFlowStatus ( 'failure' , { ...flowData , failureCode } ) ;
129+ return false ;
130+ }
131131 }
132132
133133 private async configureSettings ( { proxyScript, launcher } : { proxyScript : string ; launcher : string } ) {
0 commit comments