Skip to content

Commit f22e228

Browse files
committed
Partial revert of adae653
1 parent 3ed3969 commit f22e228

File tree

1 file changed

+29
-23
lines changed

1 file changed

+29
-23
lines changed

src/remoteConnector.ts

Lines changed: 29 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ export default class RemoteConnector extends Disposable {
102102

103103
public static AUTH_COMPLETE_PATH = '/auth-complete';
104104
private static LOCK_COUNT = 0;
105+
private static SSH_DEST_KEY = 'ssh-dest:';
105106

106107
constructor(private readonly context: vscode.ExtensionContext, private readonly logger: Log, private readonly telemetry: TelemetryReporter) {
107108
super();
@@ -662,6 +663,8 @@ export default class RemoteConnector extends Disposable {
662663
if (password) {
663664
await this.showSSHPasswordModal(password);
664665
}
666+
667+
this.telemetry.sendTelemetryEvent('vscode_desktop_ssh', { kind: 'gateway', status: 'connected', ...params });
665668
} catch (e) {
666669
this.telemetry.sendTelemetryEvent('vscode_desktop_ssh', { kind: 'gateway', status: 'failed', reason: e.toString(), ...params });
667670
if (e instanceof NoSSHGatewayError) {
@@ -700,6 +703,8 @@ export default class RemoteConnector extends Disposable {
700703
const localAppDestData = await this.getWorkspaceLocalAppSSHDestination(params);
701704
sshDestination = localAppDestData.localAppSSHDest;
702705
localAppSSHConfigPath = localAppDestData.localAppSSHConfigPath;
706+
707+
this.telemetry.sendTelemetryEvent('vscode_desktop_ssh', { kind: 'local-app', status: 'connected', ...params });
703708
} catch (e) {
704709
this.logger.error(`Failed to connect ${params.workspaceId} Gitpod workspace:`, e);
705710
if (e instanceof LocalAppError) {
@@ -726,7 +731,7 @@ export default class RemoteConnector extends Disposable {
726731

727732
await this.updateRemoteSSHConfig(usingSSHGateway, localAppSSHConfigPath);
728733

729-
await this.context.globalState.update(sshDestination!, params);
734+
await this.context.globalState.update(`${RemoteConnector.SSH_DEST_KEY}${sshDestination!}`, params);
730735

731736
vscode.commands.executeCommand(
732737
'vscode.openFolder',
@@ -786,31 +791,32 @@ export default class RemoteConnector extends Disposable {
786791
if (vscode.env.remoteName === 'ssh-remote' && this.context.extension.extensionKind === vscode.ExtensionKind.UI && remoteUri) {
787792
const [, sshDestStr] = remoteUri.authority.split('+');
788793
const sshDest = parseSSHDest(sshDestStr);
789-
const usingSSHGateway = typeof sshDest !== 'string';
790794

791795
const connectionSuccessful = await isRemoteExtensionHostRunning();
792-
const connectionInfo = this.context.globalState.get<SSHConnectionParams>(sshDestStr);
796+
const connectionInfo = this.context.globalState.get<SSHConnectionParams>(`${RemoteConnector.SSH_DEST_KEY}${sshDestStr}`);
793797
if (connectionInfo) {
794-
const kind = usingSSHGateway ? 'gateway' : 'local-app';
795-
if (connectionSuccessful) {
796-
this.telemetry.sendTelemetryEvent('vscode_desktop_ssh', {
797-
kind,
798-
status: 'connected',
799-
instanceId: connectionInfo.instanceId,
800-
workspaceId: connectionInfo.workspaceId,
801-
gitpodHost: connectionInfo.gitpodHost
802-
});
803-
} else {
804-
this.telemetry.sendTelemetryEvent('vscode_desktop_ssh', {
805-
kind,
806-
status: 'failed',
807-
reason: 'remote-ssh extension: connection failed',
808-
instanceId: connectionInfo.instanceId,
809-
workspaceId: connectionInfo.workspaceId,
810-
gitpodHost: connectionInfo.gitpodHost
811-
});
812-
}
813-
await this.context.globalState.update(remoteUri.authority, undefined);
798+
sshDest;
799+
// const usingSSHGateway = typeof sshDest !== 'string';
800+
// const kind = usingSSHGateway ? 'gateway' : 'local-app';
801+
// if (connectionSuccessful) {
802+
// this.telemetry.sendTelemetryEvent('vscode_desktop_ssh', {
803+
// kind,
804+
// status: 'connected',
805+
// instanceId: connectionInfo.instanceId,
806+
// workspaceId: connectionInfo.workspaceId,
807+
// gitpodHost: connectionInfo.gitpodHost
808+
// });
809+
// } else {
810+
// this.telemetry.sendTelemetryEvent('vscode_desktop_ssh', {
811+
// kind,
812+
// status: 'failed',
813+
// reason: 'remote-ssh extension: connection failed',
814+
// instanceId: connectionInfo.instanceId,
815+
// workspaceId: connectionInfo.workspaceId,
816+
// gitpodHost: connectionInfo.gitpodHost
817+
// });
818+
// }
819+
await this.context.globalState.update(`${RemoteConnector.SSH_DEST_KEY}${sshDestStr}`, undefined);
814820
}
815821

816822
return connectionSuccessful;

0 commit comments

Comments
 (0)